1.3 Matrices and Matrix Operations
1.3 Matrices and Matrix Operations
Dr K
Department of Mathematics and Applied Mathemathematics
University of Johannesburg
2 Operations on Matrices
3 Transpose of a Matrix
4 Trace of a Matrix
5 Partitioned Matrices
Example
2
2 1 −5 −2 ,
2
, −1 3 3 .
3 −2 4
3
Definition
The size of a matrix: a matrix is called m × n if it has m rows
(horizontal lines) and n columns (vertical lines).
A 1 × n matrix is called a row matrix (or row vector).
A m × 1 matrix is called a column matrix (or column
vector).
Row or column vectors are denoted with a bar: a = 1 2 3 .
Dr K Matrices and matrix operations
Definition
A matrix is a rectangular array of numbers. The numbers in the
array are called the entries in the matrix.
Example
2
2 1 −5 −2 ,
2
, −1 3 3 .
3 −2 4
3
Definition
The size of a matrix: a matrix is called m × n if it has m rows
(horizontal lines) and n columns (vertical lines).
A 1 × n matrix is called a row matrix (or row vector).
A m × 1 matrix is called a column matrix (or column
vector).
Row or column vectors are denoted with a bar: a = 1 2 3 .
Dr K Matrices and matrix operations
Definition
A matrix is a rectangular array of numbers. The numbers in the
array are called the entries in the matrix.
Example
2
2 1 −5 −2 ,
2
, −1 3 3 .
3 −2 4
3
Definition
The size of a matrix: a matrix is called m × n if it has m rows
(horizontal lines) and n columns (vertical lines).
A 1 × n matrix is called a row matrix (or row vector).
A m × 1 matrix is called a column matrix (or column
vector).
Row or column vectors are denoted with a bar: a = 1 2 3 .
Dr K Matrices and matrix operations
Definition
A matrix is a rectangular array of numbers. The numbers in the
array are called the entries in the matrix.
Example
2
2 1 −5 −2 ,
2
, −1 3 3 .
3 −2 4
3
Definition
The size of a matrix: a matrix is called m × n if it has m rows
(horizontal lines) and n columns (vertical lines).
A 1 × n matrix is called a row matrix (or row vector).
A m × 1 matrix is called a column matrix (or column
vector).
Row or column vectors are denoted with a bar: a = 1 2 3 .
Dr K Matrices and matrix operations
Notation
Definition
square matrix
A is an m × n matrix with m = n. eg.
2 3 4
4 −1 0
1 1 −5
The main diagonal of a square matrix A are the entries
a11 , a22 , a33 , . . ..
An identity matrix is a square matrix with entries
“1” on its
1 0 0
main diagonal and zeros everywhere else, eg. 0 1 0
0 0 1
Definition
square matrix
A is an m × n matrix with m = n. eg.
2 3 4
4 −1 0
1 1 −5
The main diagonal of a square matrix A are the entries
a11 , a22 , a33 , . . ..
An identity matrix is a square matrix with entries
“1” on its
1 0 0
main diagonal and zeros everywhere else, eg. 0 1 0
0 0 1
Definition
square matrix
A is an m × n matrix with m = n. eg.
2 3 4
4 −1 0
1 1 −5
The main diagonal of a square matrix A are the entries
a11 , a22 , a33 , . . ..
An identity matrix is a square matrix with entries
“1” on its
1 0 0
main diagonal and zeros everywhere else, eg. 0 1 0
0 0 1
Definition
square matrix
A is an m × n matrix with m = n. eg.
2 3 4
4 −1 0
1 1 −5
The main diagonal of a square matrix A are the entries
a11 , a22 , a33 , . . ..
An identity matrix is a square matrix with entries
“1” on its
1 0 0
main diagonal and zeros everywhere else, eg. 0 1 0
0 0 1
Definition
Two matrices are equal if they have the same size and if their
corresponding entries are equal i.e.
if and only if
Definition
Two matrices are equal if they have the same size and if their
corresponding entries are equal i.e.
if and only if
Example
2 1 0 3 −4 3 5 1
If A = −1 0
2 4 and B = 2
2 0 −1.
4 −2 7 0 3 2 −4 5
−2 4 5 4 6 −2 −5 2
A+B = 1 2 2 3 ; A − B = −3 −2 2 5 .
7 0 3 5 1 −4 11 −5
Dr K Matrices and matrix operations
Addition and subtraction
Definition
If A and B are matrices of the same size, then the sum A + B is
the matrix obtained by adding the entries of B to the
corresponding entries of A.
The difference A − B is the matrix obtained by subtracting the
entries of B from the corresponding entries of A.
Example
2 1 0 3 −4 3 5 1
If A = −1 0
2 4 and B = 2
2 0 −1.
4 −2 7 0 3 2 −4 5
−2 4 5 4 6 −2 −5 2
A+B = 1 2 2 3 ; A − B = −3 −2 2 5 .
7 0 3 5 1 −4 11 −5
Dr K Matrices and matrix operations
Addition and subtraction
Definition
If A and B are matrices of the same size, then the sum A + B is
the matrix obtained by adding the entries of B to the
corresponding entries of A.
The difference A − B is the matrix obtained by subtracting the
entries of B from the corresponding entries of A.
Example
2 1 0 3 −4 3 5 1
If A = −1 0
2 4 and B = 2
2 0 −1.
4 −2 7 0 3 2 −4 5
−2 4 5 4 6 −2 −5 2
A+B = 1 2 2 3 ; A − B = −3 −2 2 5 .
7 0 3 5 1 −4 11 −5
Dr K Matrices and matrix operations
Addition and subtraction
Definition
If A and B are matrices of the same size, then the sum A + B is
the matrix obtained by adding the entries of B to the
corresponding entries of A.
The difference A − B is the matrix obtained by subtracting the
entries of B from the corresponding entries of A.
Example
2 1 0 3 −4 3 5 1
If A = −1 0
2 4 and B = 2
2 0 −1.
4 −2 7 0 3 2 −4 5
−2 4 5 4 6 −2 −5 2
A+B = 1 2 2 3 ; A − B = −3 −2 2 5 .
7 0 3 5 1 −4 11 −5
Dr K Matrices and matrix operations
Addition and subtraction
Definition
If A and B are matrices of the same size, then the sum A + B is
the matrix obtained by adding the entries of B to the
corresponding entries of A.
The difference A − B is the matrix obtained by subtracting the
entries of B from the corresponding entries of A.
Example
2 1 0 3 −4 3 5 1
If A = −1 0
2 4 and B = 2
2 0 −1.
4 −2 7 0 3 2 −4 5
−2 4 5 4 6 −2 −5 2
A+B = 1 2 2 3 ; A − B = −3 −2 2 5 .
7 0 3 5 1 −4 11 −5
Dr K Matrices and matrix operations
Addition and subtraction
Definition
If A and B are matrices of the same size, then the sum A + B is
the matrix obtained by adding the entries of B to the
corresponding entries of A.
The difference A − B is the matrix obtained by subtracting the
entries of B from the corresponding entries of A.
Example
2 1 0 3 −4 3 5 1
If A = −1 0
2 4 and B = 2
2 0 −1.
4 −2 7 0 3 2 −4 5
−2 4 5 4 6 −2 −5 2
A+B = 1 2 2 3 ; A − B = −3 −2 2 5 .
7 0 3 5 1 −4 11 −5
Dr K Matrices and matrix operations
Addition and subtraction
Definition
If A and B are matrices of the same size, then the sum A + B is
the matrix obtained by adding the entries of B to the
corresponding entries of A.
The difference A − B is the matrix obtained by subtracting the
entries of B from the corresponding entries of A.
Example
2 1 0 3 −4 3 5 1
If A = −1 0
2 4 and B = 2
2 0 −1.
4 −2 7 0 3 2 −4 5
−2 4 5 4 6 −2 −5 2
A+B = 1 2 2 3 ; A − B = −3 −2 2 5 .
7 0 3 5 1 −4 11 −5
Dr K Matrices and matrix operations
Addition and subtraction
Definition
If A and B are matrices of the same size, then the sum A + B is
the matrix obtained by adding the entries of B to the
corresponding entries of A.
The difference A − B is the matrix obtained by subtracting the
entries of B from the corresponding entries of A.
Example
2 1 0 3 −4 3 5 1
If A = −1 0
2 4 and B = 2
2 0 −1.
4 −2 7 0 3 2 −4 5
−2 4 5 4 6 −2 −5 2
A+B = 1 2 2 3 ; A − B = −3 −2 2 5 .
7 0 3 5 1 −4 11 −5
Dr K Matrices and matrix operations
Example
2 1 0 3
If A = −1 0 2 4
4 −2 7 0
3 2
If C = , then C + A =?
1 6
Definition
If A = [aij ] is any matrix and c is a scalar, then the scalar
multiple cA is the matrix obtained by multiplying each entry of
A by c, i.e.,
cA = [caij ]
Example
2 3 4 0 2 7
Let A = and B = .
1 3 1 −1 3 −5
4 6 8 0 −2 −7
Then 2A = and (−1)B = .
2 6 2 1 −3 5
Definition
If A = [aij ] is any matrix and c is a scalar, then the scalar
multiple cA is the matrix obtained by multiplying each entry of
A by c, i.e.,
cA = [caij ]
Example
2 3 4 0 2 7
Let A = and B = .
1 3 1 −1 3 −5
4 6 8 0 −2 −7
Then 2A = and (−1)B = .
2 6 2 1 −3 5
Definition
If A = [aij ] is any matrix and c is a scalar, then the scalar
multiple cA is the matrix obtained by multiplying each entry of
A by c, i.e.,
cA = [caij ]
Example
2 3 4 0 2 7
Let A = and B = .
1 3 1 −1 3 −5
4 6 8 0 −2 −7
Then 2A = and (−1)B = .
2 6 2 1 −3 5
Definition
If A = [aij ] is any matrix and c is a scalar, then the scalar
multiple cA is the matrix obtained by multiplying each entry of
A by c, i.e.,
cA = [caij ]
Example
2 3 4 0 2 7
Let A = and B = .
1 3 1 −1 3 −5
4 6 8 0 −2 −7
Then 2A = and (−1)B = .
2 6 2 1 −3 5
Definition
If A = [aij ] is any matrix and c is a scalar, then the scalar
multiple cA is the matrix obtained by multiplying each entry of
A by c, i.e.,
cA = [caij ]
Example
2 3 4 0 2 7
Let A = and B = .
1 3 1 −1 3 −5
4 6 8 0 −2 −7
Then 2A = and (−1)B = .
2 6 2 1 −3 5
Example
3 −1 0 1 −1 1
Let A = ,B= and
1 2 −4 −2 0 6
1 0 −2
C= . Compute A + B − C.
3 1 1
3 −2 3
A+B−C =
−4 1 1
Example
3 −1 4 a b c
Solve for a, b, c, d, e and f if A = ,B=
2 0 6 d e f
7 −7 14
and 3A − 2B = .
6 −6 14
1 2 −1
B=
0 3 2
Example
3 −1 0 1 −1 1
Let A = ,B= and
1 2 −4 −2 0 6
1 0 −2
C= . Compute A + B − C.
3 1 1
3 −2 3
A+B−C =
−4 1 1
Example
3 −1 4 a b c
Solve for a, b, c, d, e and f if A = ,B=
2 0 6 d e f
7 −7 14
and 3A − 2B = .
6 −6 14
1 2 −1
B=
0 3 2
Example
3 −1 0 1 −1 1
Let A = ,B= and
1 2 −4 −2 0 6
1 0 −2
C= . Compute A + B − C.
3 1 1
3 −2 3
A+B−C =
−4 1 1
Example
3 −1 4 a b c
Solve for a, b, c, d, e and f if A = ,B=
2 0 6 d e f
7 −7 14
and 3A − 2B = .
6 −6 14
1 2 −1
B=
0 3 2
Example
3 −1 0 1 −1 1
Let A = ,B= and
1 2 −4 −2 0 6
1 0 −2
C= . Compute A + B − C.
3 1 1
3 −2 3
A+B−C =
−4 1 1
Example
3 −1 4 a b c
Solve for a, b, c, d, e and f if A = ,B=
2 0 6 d e f
7 −7 14
and 3A − 2B = .
6 −6 14
1 2 −1
B=
0 3 2
Definition
If A is an m × r matrix and B is an r × n matrix, then the
product AB is an m × n matrix constructed as follows:
The entry in row i and column j of the product is just the
ith row of A multiplied with the corresponding entries in the jth
column of B or
Note
The number of columns of A MUST equal the number of rows
of B to be able to calculate AB.
Definition
If A is an m × r matrix and B is an r × n matrix, then the
product AB is an m × n matrix constructed as follows:
The entry in row i and column j of the product is just the
ith row of A multiplied with the corresponding entries in the jth
column of B or
Note
The number of columns of A MUST equal the number of rows
of B to be able to calculate AB.
Definition
If A is an m × r matrix and B is an r × n matrix, then the
product AB is an m × n matrix constructed as follows:
The entry in row i and column j of the product is just the
ith row of A multiplied with the corresponding entries in the jth
column of B or
Note
The number of columns of A MUST equal the number of rows
of B to be able to calculate AB.
Definition
If A is an m × r matrix and B is an r × n matrix, then the
product AB is an m × n matrix constructed as follows:
The entry in row i and column j of the product is just the
ith row of A multiplied with the corresponding entries in the jth
column of B or
Note
The number of columns of A MUST equal the number of rows
of B to be able to calculate AB.
Definition
If A is an m × r matrix and B is an r × n matrix, then the
product AB is an m × n matrix constructed as follows:
The entry in row i and column j of the product is just the
ith row of A multiplied with the corresponding entries in the jth
column of B or
Note
The number of columns of A MUST equal the number of rows
of B to be able to calculate AB.
Example
3 0
4 −1
Let A = −1 2 and B =
Compute AB and BA if
0 2
1 1
possible.
12 −3
AB = −4 5
4 1
BA is undefined.
Example
3 0
4 −1
Let A = −1 2 and B =
Compute AB and BA if
0 2
1 1
possible.
12 −3
AB = −4 5
4 1
BA is undefined.
Example
2 1 0 3
Find the transpose of the matrices A = −1 0 2 4,
4 −2 7 0
4 −2 1
B= and C = 3 5 2 .
0 2 3
2 −1 4
4 0 3
T
1 0 −2, B T = −2 T
A =
2, C = 5
0 2 7
1 3 2
3 4 0
Example
2 1 0 3
Find the transpose of the matrices A = −1 0 2 4,
4 −2 7 0
4 −2 1
B= and C = 3 5 2 .
0 2 3
2 −1 4
4 0 3
T
1 0 −2, B T = −2 T
A =
2, C = 5
0 2 7
1 3 2
3 4 0
Example
2 1 0 3
Find the transpose of the matrices A = −1 0 2 4,
4 −2 7 0
4 −2 1
B= and C = 3 5 2 .
0 2 3
2 −1 4
4 0 3
T
1 0 −2, B T = −2 T
A =
2, C = 5
0 2 7
1 3 2
3 4 0
Example
2 1 0 3
Find the transpose of the matrices A = −1 0 2 4,
4 −2 7 0
4 −2 1
B= and C = 3 5 2 .
0 2 3
2 −1 4
4 0 3
T
1 0 −2, B T = −2 T
A =
2, C = 5
0 2 7
1 3 2
3 4 0
Example
2 1 0 3
Find the transpose of the matrices A = −1 0 2 4,
4 −2 7 0
4 −2 1
B= and C = 3 5 2 .
0 2 3
2 −1 4
4 0 3
T
1 0 −2, B T = −2 T
A =
2, C = 5
0 2 7
1 3 2
3 4 0
Example
2 1 0 3
Find the transpose of the matrices A = −1 0 2 4,
4 −2 7 0
4 −2 1
B= and C = 3 5 2 .
0 2 3
2 −1 4
4 0 3
T
1 0 −2, B T = −2 T
A =
2, C = 5
0 2 7
1 3 2
3 4 0
Example
2 1 0 3
Find the transpose of the matrices A = −1 0 2 4,
4 −2 7 0
4 −2 1
B= and C = 3 5 2 .
0 2 3
2 −1 4
4 0 3
T
1 0 −2, B T = −2 T
A =
2, C = 5
0 2 7
1 3 2
3 4 0
Example
2 1 0 3
Find the transpose of the matrices A = −1 0 2 4,
4 −2 7 0
4 −2 1
B= and C = 3 5 2 .
0 2 3
2 −1 4
4 0 3
T
1 0 −2, B T = −2 T
A =
2, C = 5
0 2 7
1 3 2
3 4 0
Definition
If A is a square matrix, then the trace of A, denoted tr(A) is the
sum of the entries on the main diagonal of A.
Example
1 2 3
tr 4 5 6 = 1 + 5 + 9 = 15.
7 8 9
Definition
If A is a square matrix, then the trace of A, denoted tr(A) is the
sum of the entries on the main diagonal of A.
Example
1 2 3
tr 4 5 6 = 1 + 5 + 9 = 15.
7 8 9
Definition
If A is a square matrix, then the trace of A, denoted tr(A) is the
sum of the entries on the main diagonal of A.
Example
1 2 3
tr 4 5 6 = 1 + 5 + 9 = 15.
7 8 9
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
12 −6 3
AB = .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
4 −2 1
AB = A A A
0 2 3
12 −6 3
=
−4 12 14
12 −6 3
= .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
4 −2 1
AB = A A A
0 2 3
12 −6 3
=
−4 12 14
12 −6 3
= .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
4 −2 1
AB = A A A
0 2 3
12 −6 3
=
−4 12 14
12 −6 3
= .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
4 −2 1
AB = A A A
0 2 3
12 −6 3
=
−4 12 14
12 −6 3
= .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
4 −2 1
AB = A A A
0 2 3
12 −6 3
=
−4 12 14
12 −6 3
= .
−4 12 14
Example
3 0 4 −2 1
Let A = and B = .
−1 5 0 2 3
4 −2 1
AB = A A A
0 2 3
12 −6 3
=
−4 12 14
12 −6 3
= .
−4 12 14
c1 A1 + c2 A2 + . . . + cr Ar
c1 A1 + c2 A2 + . . . + cr Ar
Example
a11 a12 ... a1n x1
a21 a22 ... a2n x2
Ax = .
.. .. .. ..
.. . . . .
am1 am2 . . . amn xn
a11 a12 a1n
a21 a22 a2n
= x1 . + x2 . + . . . + xn .
.
. .
. .
.
am1 am2 amn
where
3 0 4 3 0
Ab1 = =4 +0
−1 5 0 −1 −5
3 0 −2 3 0
Ab2 = = −2 +2
−1 5 2 −1 −5
3 0 1 3 0
Ab3 = =1 +3
−1 5 3 −1 −5
Linear Equation
Consistent linear system
Homogenous linear
Inconsistent linear
equation
system
System of linear
Augmented matrix
equation
Elementary row
Solution of a linear
operations
system