You are on page 1of 6

20 CHAPTER 1.

SYSTEMS OF LINEAR EQUATIONS AND MATRICES

1.3 Matrices and Matrix Operations


1.3.1 De…nitions and Notation
Matrices are yet another mathematical object. Learning about matrices means
learning what they are, how they are represented, the types of operations which
can be performed on them, their properties and …nally their applications.

De…nition 50 (matrix) 1. A matrix is a rectangular array of numbers. in


which not only the value of the number is important but also its position
in the array.
2. The numbers in the array are called the entries of the matrix.
3. The size of the matrix is described by the number of its rows and columns
(always in this order). An m n matrix is a matrix which has m rows
and n columns.
4. The elements (or the entries) of a matrix are generally enclosed in brack-
ets, double-subscripting is used to index the elements. The …rst subscript
always denote the row position, the second denotes the column position.
For example
2 3
a11 a12 ::: a1n
6 a21 a22 ::: a2n 7
6 7
A = 6 6 ::: ::: ::: ::: 7 7 (1.5)
4 ::: ::: ::: ::: 5
am1 am2 ::: amn
= [aij ] , i = 1; 2; :::; m, j = 1; 2; :::; n (1.6)

Enclosing the general element aij in square brackets is another way of


representing a matrix A .
5. When m = n , the matrix is said to be a square matrix.
6. The main diagonal in a square matrix contains the elements a11 ; a22 ; a33 ; :::
7. A matrix is said to be upper triangular if all its entries below the main
diagonal are 0.
8. A matrix is said to be lower triangular if all its entries above the main
diagonal are 0.
9. If all the entries of a square matrix are zero, except those entries on the
main diagonal, then we say the matrix is a diagonal matrix.
10. The n n identity matrix is an n n matrix having ones on the main
diagonal, and zeroes everywhere else. It is usually denoted In .
11. We say that two matrices are equal whenever they have the same dimen-
sion, and their corresponding entries are equal.
1.3. MATRICES AND MATRIX OPERATIONS 21

De…nition 51 (row and column vectors) Vectors are special forms of ma-
trices.
1. A row vector is a vector which has only one row. In other words, it is an
1 n matrix.
2. A column vector is a vector which has only one column. In other words,
it is an m 1 matrix.
Example 52 Here are some matrices
2 3
1 2
1. 4 5 2:5 5 is a 3 2 matrix.
0 1
2 3
1 2 3
2. 4 3 p5 9 5 is a square (3 3) matrix.
2 0
2 3
1 0 0
3. 4 0 1 0 5is the 3 3 identity matrix.
0 0 1
2 3
1 3 5 4
6 0 2 6 4 7
4. 6 7
4 0 0 2 1 5 is a 4 4 upper triangular matrix.
0 0 0 5
2 3
1
6 2 7
5. 6 7
4 3 5 is a column vector. It is also a 4 1 matrix.
10
6. 5 0 2 is a row vector. It is also a 1 3 matrix.
In the case of a vector, there is no need to use double subscripts. For example,
instead of writing A = a11 a12 a13 a14 , we write A = a1 a2 a3 a4 .
In the special case that m = n = 1, the matrix is a 1 1 matrix and may be
written A = [a11 ] = [a] = a. In other words, subscripts are not needed. Since
the matrix only has one entry, it is the same as a number (also called a scalar).

1.3.2 Operations on Matrices


For each operation, we give the conditions under which the operation can be
performed. We then explain how the operation is performed. For the remaining
of this section, unless speci…ed otherwise, we assume that
A = [aij ]
B = [bij ]
C = [cij ]
22 CHAPTER 1. SYSTEMS OF LINEAR EQUATIONS AND MATRICES

Addition and Subtraction


Only matrices having the same size can be added or subtracted.

The resulting matrix has the same size.

To add (subtract) two matrices having the same size, simply add (sub-
tract) the corresponding entries. In other words, if C = A + B, then
cij = aij + bij . Same for subtraction.

Example 53 Examples of matrix addition/subtraction.


2 3
1 3 5 2 4 5
1. 4 2 5 5+ 4 1 = 6 6
0 1 3 2 3 3
2 3 2 3
1 2 1 1 1
2. 4 3 4 5 4 2 2 2 5Cannot be done, the matrices do not have the
5 6 3 3 3
same dimension.

Scalar Multiplication
This is multiplication of a matrix by a number.

This operation can always be done.

The result is a matrix of the same size.

Simply multiply each entry of the matrix by the number.

Example 54 Examples of multiplication of a matrix by a scalar.


2 3 2 3
1 0 4 0
1. 4 4 2 1 5=4 8 4 5
3 10 12 40

a11 a12 a11 a12


2. =
a21 a22 a21 a22

Multiplication of a Row Vector by a Column Vector


The row and column vector must have the same number of elements. This
means that if the …rst vector has n entries (that is is a 1 n matrix), then
the second vector must also have n entries (that is must be a n 1 matrix).

The result is a 1 1 matrix or a scalar.


1.3. MATRICES AND MATRIX OPERATIONS 23
23
b1
6 b2 7
Suppose that A = a1 a2 ::: an and B = 6 7
4 : 5. Then
bn

AB = a1 b1 + a2 b2 + :::an bn
Xn
= ai bi
i=1

You will note that the result is a scalar.

Example 55 Examples of multiplication of a row vector by a column vector.


2 3
2
6 1 7
1. 1 3 5 7 6 7
4 5 5 = [1 2 + 3 1 + 5 5 + 7 10] = 100
10
2 3
1
6 2 7
2. 1 3 5 4 7 6 . This cannot be done, the vectors do not have the same
3 5
4
number of elements.

Matrix Multiplication
Let us assume that A is m p and B is q n.

The product of A and B, denoted AB can be performed only if p = q.


In other words, the number of columns of the …rst matrix, A must be the
same as the number of rows of the second matrix, B.

In the case p = q, then AB is a new matrix. Its size is m n.

In summary, if we put next to each other the dimensions of the matrices


we are trying to multiply, in this case m p and q n, then we see that we
can do the multiplication if the inner numbers (p and q) are equal. The
size is given by the outer numbers (m and n).

Matrix multiplication is a little bit more complicated than the other oper-
ations. We explain it by showing how each entry of the resulting matrix is
obtained. Let us assume that A = [aij ] is m p and B = [bij ] is p n. Let
C = [cij ] = AB. Then, C is a m n matrix. cij is obtained by multiplying
the ith row of A by the j th column of B. In other words,
p
X
cij = aik bkj , i = 1; 2; :::; m, j = 1; 2; :::; n
k=1
24 CHAPTER 1. SYSTEMS OF LINEAR EQUATIONS AND MATRICES

Remark 56 Because of the condition on the sizes of the matrices, one can see
easily that matrix multiplication will not be commutative. For example, if A is
3 4 and B is 4 5 then one can compute AB. Its size will be 3 5. However,
BA cannot be computed. Even in cases when both AB and BA can be computed,
they are unlikely to be the same. For example
2 32 3 2 3
1 2 3 1 1 1 14 14 14
4 2 3 4 5 4 2 2 2 5 = 4 20 20 20 5
3 4 5 3 3 3 26 26 26

but 2 32 3 2 3
1 1 1 1 2 3 6 9 12
4 2 2 2 54 2 3 4 5 = 4 12 18 24 5
3 3 3 3 4 5 18 27 36

Example 57 Examples of matrix multiplication.


2 32 3 2 3
1 2 3 1 1 1 14 14 14
1. 4 2 3 4 5 4 2 2 2 5 = 4 20 20 20 5
3 4 5 3 3 3 26 26 26
2 32 9 3
3 2 3
1 2 3 4 4 1 1 0 0
2. 4 3 2 1 5 4 174
3
4 2 5=4 0 1 0 5
7 1
1 3 6 4 4 1 0 0 1
2 32 3 2 3
1 2 3 x x + 2y + 3z
3. 4 3 2 1 5 4 y 5 = 4 3x + 2y + z 5
1 3 6 z x + 3y + 6z
2 3
2 3 1 1 1
1 2 3 6
2 2 2 7
4. 4 2 3 4 56 7
4 3 3 3 5 cannot be done (why?)
3 4 5
4 4 4
2 32 3 2 3
1 2 3 1 0 0 1 2 3
5. 4 2 3 4 5 4 0 1 0 5 = 4 2 3 4 5. In fact if A is m n, then
3 4 5 0 0 1 3 4 5
AIn =A

1.3.3 Transpose and trace of a matrix


The operations we have de…ned earlier, have analogous operations with real
numbers. We now de…ne two operations which do not. We will see applications
of these operations later on in the course.

De…nition 58 (Transpose of a Matrix) If A is an m n matrix then the


transpose of A, denoted AT is the n m matrix obtained from A by inter-
changing the rows and columns of A.
1.3. MATRICES AND MATRIX OPERATIONS 25

Example 59
2 3T 2 3
1 2 3 1 4 7
4 4 5 6 5 =4 2 5 8 5
7 8 9 3 6 9

Example 60
2 3T 2 3
a11 a12 a13 a11 a21 a31
4 a21 a22 a23 5 = 4 a12 a22 a32 5
a31 a32 a33 a13 a23 a33

Example 61
2 3T
1
4 3 5 = 1 3 5
5

We are simply switching the rows and the columns. If A = [aij ] then AT =
[aji ]. Note that in this process, the elements on the main diagonal remain
unchanged.

De…nition 62 (Trace of a Matrix) If A is a square matrix (n n) then the


trace of A, denoted tr (A), is de…ned to be the sum of its entries on the main
diagonal of A. tr (A) is not de…ned if A is not a square matrix.

1 2
Example 63 if A = then tr (A) = 8.
4 7
2 3
a11 a12 a13
Example 64 If A = 4 a21 a22 a23 5, then tr (A) = a11 + a22 + a33 .
a31 a32 a33

1.3.4 Problems
Do numbers 1 - 5, 12 - 14, 19 - 23, 25 on pages 34-37

You might also like