CSC 309
CSC 309
MATRICES
1.0 Introduction:
A matrix is a set of real or complex numbers (or elements) arranged in rows and columns to form
a rectangular array. A matrix having m rows and n columns is called an m x n (ie ‘m by n’) matrix
and is referred to as having order m x n.
The m horizontal lists of numbers are called the rows of A, and the n vertical lists of numbers its
columns. Thus the element aij , called the ij entry, appears in row i and column j. We frequently
denote such a matrix by simply writing A = [aij ].
A matrix with m rows and n columns is called an m by n matrix, written m × n. The pair of numbers
m and n is called the size of the matrix.
3 2 0
e.g this is a 2 x 3 matrix, ie a 2 by 3 matrix, where
4 5 1 3, 2, 0, 4, 5, 1 are the elements of the matrix
Note that in describing the matrix, the number of rows is stated first and the number of columns
second.
3 5 6
7 2 1 this is a matrix of order 4 x 3, ie 4 rows and 3 columns
9 3 0
6 2 7
So the matrix 2 6
6 9 this is 3 x 2
2 3
1
Row matrix (or row vector) is a matrix having only one row, for example: (3 4 5 9) this is a
row matrix of the order 1 x 4
A column n matrix (or column vector) is a matrix having only one column. Example:
1
2
4
A zero matrix (or null matrix) is one where every element is zero. So for a zero matrix A, aij = 0
for all values of i and j. For example
0 0 0
0 0 0
Single element matrix: A single number may be regarded as a 1 x 1 matrix, ie having 1 row and 1
column
Double suffix notation: each element in a matrix has its own particular address or location which
can be defined by a system of double suffixes, the first indicating the row, the second the column,
thus:
therefore
3 5 6 0
7 2 1 6
9 3 0 3
1 8 9 6
Equal Matrices: Matrices are equal if they are identical in every respect—that is, they have the
same dimension and the same elements in the same positions. Put more formally: let A = [aij ] and
B = [bij ]; then A = B if and only if A and B have the same dimension and aij = bij for all values
of i and j.
a11 a12 a13 3 5 6
a21 a22 a23 = 7 2 1
where;
a11 = 3, a12 = 5,a13 = 6
2
a21 = 7, a22 = 2, a23 = 1
A diagonal matrix is a square matrix where all of the elements are zero except possibly those
occupying the positions diagonally from the top-left corner to the bottom right corner. In any
square matrix, these elements constitute what is termed the leading diagonal or principal diagonal.
Thus A = [aij ] is a diagonal matrix if aij = 0 for i 6= j. Examples of diagonal matrices are:
-2 0 0 5 0 0
0 1 0 0 -4 0
0 0 4 0 0 0
An identity matrix (or unit matrix) is a diagonal matrix whose leading diagonal elements are all
1. Note that this means that an identity matrix is necessarily square. Thus if A = [aij ] is an identity
matrix, then aij = 0 for i 6 = j and aii = 1. An identity matrix is often denoted by I when its
dimension is clear from the context or irrelevant to the discussion. When it is necessary to
distinguish identity matrices of different dimensions, we denote the identity matrix of dimension
n£n by In. For example,
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Addition and Subtraction of Matrices: Only matrices having the same dimension can be added
and, where this condition is satisfied, we say that the matrices are conformable for addition.
Example:
3 -1 4 2
A= 2 7 B= -1 1 Find A + B
5 4 -6 0
3 -1 4 2
2 7 + -1 1
5 4 -6 0
3+4 -1 + 2 7 1
A + B = 2 + (-1) 7+1 = 1 8
5 + (-6) 4+0 -1 4
-1 0 2 2 4 7 Find A - B
A= 4 5 -3 B= 1 -6 -1
Solution
A - B = A + (-B)
3
-1 0 2 -2 -4 -7
4 5 -3 + -1 6 1
-3 -4 -5
= 3 11 -2
6 5 12 3 7 1 Find A - B
A= B=
9 4 8 2 10 -5
Solution
6-3 5-7 12-1 3 -2 11
=
9-2 4-10 8+6 7 -6 13
2 3 -2 Find 3A
A=
1 -4 6
Solution
6 9 -6
3A =
3 -12 18
Multiplication of two Matrices: two matrices can be multiplied together only when the number
of the columns in the first is equal to the number of rows in the second. Example:
8
4 7 6 5 = 4x8 + 7x5 + 6x9 = 32 + 35 +54 = 121
2 3 1 9 2x8 + 3x5 + 1x9 16 + 15 +9 40
1 5 8 4 3 1 Find A.B
B=
A= 2 7 2 5 8 6
3 4
Solution
1 5 8 4 3 1
A.B = 2 7 2 5 8 6
3 4
1x8 + 5x2 + 1x4 + 5x5 + 1x3 + 5x8 + 1x1 + 5x6 8+10 4+25 3+40 1+30
2x8 + 7x2 + 2x4 +7x5 + 2x3 + 7x8 +2x1 + 7x6 = 16+14 8+35 6+56 2+42
3x8 + 4x2 +3x4 +4x5 +3x3 +4x8 +3x1 +4x6 24+8 12+20 9+32 3+24
4
18 29 43 31
30 43 62 44
32 32 41 27
Exercise
If
2 -3 4 -1 .
A= 0 -1 B= 2 -1
Find
i. A + 2B
ii. 3A -6B
iii. AB
iv. BA
NOTE:
Two matrices of the same order are said to be conformable for addition or subtraction. Two
matrices of different orders cannot be added or subtracted. For example, the matrices (a) and (b)
above are non-conformable for addition and subtraction.
Theorem:
Let A, B, C be matrices. Then, whenever the products and sums are defined:
i. (AB)C = A(BC) (Associative Law)
ii. A(B + C) = AB + AC (Left Distributive Law).
iii. (B + C)A = BA + CA (Right Distributive Law).
iv. k(AB) = (kA)B = A(kB) where k is a scalar.
AX = B
where A is the matrix consisting of the coefficients, X is the column vector of unknowns, and B is
the column vector of constants. (Here equivalent means that any solution of the system is a solution
to the matrix equation AX = B, and vice versa.) For example, the system
X
x + 2y - 3z = 4 1 2 -3 4
is equivalent to y = 9
5x -6y + 8z 9 5 -6 8
z
Observe that the system is completely determined by the matrix
1 2 -3 4
M = [A, B] = 5 -6 8 9
5
Transposes of a Matrix: The transpose of A, denoted by AT, is the n × m matrix obtained by
interchanging the rows and columns of A. In other words if the rows and columns of a matrix are
interchanged: ie the first row becomes the first columns, the second row becomes the second
column, etc then the new matrix formed is called the transpose. Example:
1 3 1 5 1
AT = 3
A= 5 9 9 5
1 5
35 20
ABT =
79 32
Example:
1 2 3 6 -2 -3 1 0 0
1 3 3 -1 1 0 = 0 1 0 =
1 2 4 -1 0 1 0 0 1
Square Matrices
A matrix with the same number of rows as columns is called a square matrix. A square matrix with
n rows and n columns is said to be of order n, and is called an n-square matrix.
The main diagonal, or simply diagonal, of an n-square matrix A = [aij ] consists of the elements
a11, a22, . . ., ann, that is, the elements from the upper left corner to the lower right corner of the
matrix. The trace of A, written tr(A), is the sum of the diagonal elements, that is, tr(A) = a11 + a22
+···+ ann. The n-square unit matrix, denoted by In, or simply I, is the square matrix with 1’s along
the diagonal and 0’s elsewhere. The unit matrix I plays the same role in matrix multiplication as
the number 1 does in the usual multiplication of numbers. Specifically, for any matrix A,
AI = IA = A
6
for example, the matrices
1 -2 0 1 0 0 0
0 -4 -6 and 0 1 0 0
5 3 2 0 0 1 0
0 0 0 1
Both are square matrices. The first is of order 3, and its diagonal consists of the elements 1, −4, 2
so its trace equals 1 − 4 + 2 = −1. The second matrix is of order 4; its diagonal consists only of 1’s,
and there are only 0’s elsewhere. Thus the second matrix is the unit matrix of order 4.
Polynomials in the matrix A are also defined. Specifically, for any polynomial
1 2
Exa 1: Suppose A = 2 -4
then
A2 = 1 2 1 2 = 7 -6 and
2 -4 2 -4 - 9 22
A3 = A2A = 7 -6 . 1 2 = -11 38
-9 22 2 -4 57 -106