12.1 Matrices: Multiplying A Matrix and A Vector
12.1 Matrices: Multiplying A Matrix and A Vector
1 Matrices
A matrix is any rectangular array of numbers. For example
3 0 2 5
2 1 6 4
8 13 3 2
is 3 4 matrix, i.e. a rectangular array of numbers with three rows and four columns.
We usually use capital letters for matrices, e.g. A, B, and C, with lowercase letters
reserved for scalars.
A vector is actually a special type of matrix, namely a matrix with only one column.
In particular, a vector from Rn is the same thing as an n 1 matrix.
Multiplying Matrices
There is an operation called matrix multiplication that generalizes the product of a
matrix and a vector. Given two matrices A and B, the product AB is the matrix obtained
by taking the dot product of each row of A with each column of B. For example, if A
and B are 2 2 matrices, then there are four dot products to compute:
" #" # " # " #" # " #
7 1 2 3 14 7 1 2 3 14 22
5 2 0 1 5 2 0 1
This product only makes sense if the rows of A and the columns of B have the same
size. The result always has one row for each row of A and one column for each column
of B.
EXAMPLE 1 0
7 3
5 2 2
Compute AB if A 3
and B
2 2
.
1 1 0
Here A is a 3 4 matrix and B is 4 2 2 4
matrix, so AB will be a 3 2 matrix. 1 6 3 0 1
0
MATRICES 2
SOLUTION We must take the dot product of each row of A with each column of B.
0 3 0 3
7 5 2 2 16 7 5 2 2 16 39
2 2 2 2
3 1 1 0
2 3 1 1 0
4 2 4
1 6 3 0 1 6 3 0
1 0 1 0
0 3 0 3
7 5 2 2 16 39 7 5 2 2 16 39
2 2 2 2
4 4
3 1 1 0
2 3 1 1 0 15
4 2 4
1 6 3 0 1 6 3 0
1 0 1 0
0 3 0 3
7 5 2 2 16 39 7 5 2 2 16 39
2 2 2 2
4 4
3 1 1 0
2
15 3 1 1 0 15
1 4 2 4
6 3 0 18 1 6 3 0 18 27
1 0 1 0
A ( BC ) ( AB ) C
Only two matrices of the same size can be added. Matrix multiplication distributes
over addition from both the left and the right, i.e.
A ( B + C ) AB + AC and (A + B ) C AC + BC
Scalar multiplication for matrices is also quite similar to scalar multiplication for
vectors: " # " #
4 3 1 8 6 2
2
4 2 3 8 4 6
This has a variety of obvious properties, e.g.
k ( A + B ) kA + kB and k ( AB ) ( kA ) B A ( kB )
Square Matrices
A matrix is called square if it has the same number of rows and columns. For example,
2 2 matrices are square, as are 3 3 matrices, and more generally n n matrices.
We can take the determinant of any square matrix A, which we write as det ( A ) . For
example, if
" #
5 2
A
3 4
then det ( A ) 14.
The product of two square matrices of the same size is another square matrix of
that size. For example,
3 1 0 1 2 1 5 6 6
0 1 1 2 0 3 3 1 3
2 1 2 1 1 0 6 6 5
A square matrix is called diagonal if all of its nonzero entries lie along the diagonal
that goes from the upper left to the lower right. For example,
" # 3 0 0
2 0
and 0 7 0
0 5 0 0 4
are diagonal matrices. The determinant of a diagonal matrix is equal to the product if
the entries along the diagonal:
a 0 0
Note that we use square brackets for a 0
ab, 0 b 0 abc.
matrices and vertical lines for and
determinants. 0 b 0 0 c
Inverse Matrices
A diagonal matrix with ones along the diagonal is called an identity matrix:
" # 1 0 0
We usually use the letter I to denote an 1 0
0 1 0
identity matrix. 0 1 0 0 1
Two square matrices are called inverses if their product is the identity matrix. For
example
" # " #
3 0 5 0
and
2 5 2 3
MATRICES 4
Inverse of a 2 2 Matrix
" #
a b
Note that ad bc is the determinant of .
c d
EXAMPLE 2
4 6
Find the inverse of the matrix .
1 2
1 2 6
2 1 4
This simplifies to
1 3
1/2 2
A square matrix is called invertible if it has an inverse. From the formula above,
we see that a 2 2 matrix is invertible as long as its determinant is not zero. This rule
works for matrices of any size:
Ax b
where A is the coefficient matrix, x is the vector of unknowns, and b is the vector of
constant terms. For example, the linear system
2x + 5y 11
3x + 4y 13
We can use inverse matrices to solve n n linear systems. Given a linear system of the
form
Ax b
where A is an invertible square matrix, we can multiply both sides of the equation by
A1 to get
x A1 b
EXAMPLE 3
Use an inverse matrix to solve the system
3x + 2y 7
x + 4y 5
3 2 x 7
1 4 y 5
But
1
3 2 1 4 2 0.4 0.2
10
1 4 1 3 0.1 0.3
so
x 0.4 0.2 7 1.8
y 0.1 0.3 5
0.8
EXERCISES
14 Multiply.
5 1
9 3 1 3 " #
1 7 5
1. 2 9 3 1 2.
9 0 2
3 0 8 1
1 1
1 7 2 2 0 0 1 0
4
3.
2 8 2 1 1
4.
0 6 0
0
0 1 1 2 0 0 5 3
2
6 9 2 2 0 0 1 0
69 Multiply.
1 4
" #" # " #
6 3 1 2 1 3 9 1 0 1
6. 7.
4 1 8 1 9 1 2 2 2 2
6 0
" # " #
3 0 1 2
12. 13.
0 2 3 6
1 0 2
14. Does the matrix 1 1 1 have an inverse? Explain.
2 1 3
" #
2 1
15. Compute 5A + 6A1 if A .
2 2