LINEAR ALGEBRA WITH APPLICATIONS
MATH 211
Matrices and Matrix Arithmetic
Part 1
Lecture Notes by Mayada Shahada
Matrices: Page 1/25
Matrices - Basic Definitions and Notation
Definition
Let m and n be positive integers.
An m ⇥ n matrix is a rectangular array of numbers having m rows and
n columns. Such a matrix is said to have size m ⇥ n.
A row matrix (or row) is a 1 ⇥ n matrix, and a column matrix (or
column) is an m ⇥ 1 matrix.
A square matrix is an n ⇥ n matrix.
The (i, j)-entry of a matrix is the entry in row i and column j. For a
matrix A, the (i, j)-entry of A is often written as aij .
Matrices: Matrices Page 2/25
General notation for an m ⇥ n matrix, A:
2 3
a11 a12 a13 . . . a1n
6 a21 a22 a23 . . . a2n 7
6 7
6 a31 a32 a33 . . . a3n 7
A=6 7 = [aij ]
6 .. .. .. .. 7
4 . . . . 5
am1 am2 am3 . . . amn
Matrices: Matrices Page 3/25
Matrices – Properties and Operations
1 Equality: two matrices are equal if and only if they have the same
size and the corresponding entries are equal.
2 Zero Matrix: an m ⇥ n matrix with all entries equal to zero.
3 Addition: matrices must have the same size; add corresponding
entries.
4 Scalar Multiplication: multiply each entry of the matrix by the
scalar.
5 Negative of a Matrix: for an m ⇥ n matrix A, its negative is denoted
A and A = ( 1)A.
6 Subtraction: for m ⇥ n matrices A and B, A B = A + ( 1)B.
Matrices: Matrices Page 4/25
Matrix Addition
Definition
Let A = [aij ] and B = [bij ] be two m ⇥ n matrices. Then A + B = C where
C is the m ⇥ n matrix C = [cij ] defined by
cij = aij + bij
Example
Find A + B if
1 3 0 2
A= ,B = .
2 5 6 1
Matrices: Matrix Addition Page 5/25
Theorem (Properties of Matrix Addition)
Let A, B and C be m ⇥ n matrices. Then the following properties hold.
1 A + B = B + A (matrix addition is commutative).
2 (A + B) + C = A + (B + C ) (matrix addition is associative).
3 There exists an m ⇥ n zero matrix, 0, such that A + 0 = A.
(existence of an additive identity).
4 There exists an m ⇥ n matrix A such that A + ( A) = 0.
(existence of an additive inverse).
Matrices: Matrix Addition Page 6/25
Scalar Multiplication
Definition
Let A = [aij ] be an m ⇥ n matrix and let k be a scalar. Then kA = [kaij ].
Example
Find 3A if 2 3
2 0 1
A=4 3 1 2 5.
0 4 5
Matrices: Scalar Multiplication Page 7/25
Theorem (Properties of Scalar Multiplication)
Let A, B be m ⇥ n matrices and let k, p 2 R (scalars). Then the following
properties hold.
1 k (A + B) = kA + kB.
(scalar multiplication distributes over matrix addition).
2 (k + p) A = kA + pA.
(addition distributes over scalar multiplication).
3 k (pA) = (kp) A. (scalar multiplication is associative).
4 1A = A. (existence of a multiplicative identity).
Matrices: Scalar Multiplication Page 8/25
Example
1 0 2 1 6 8
2 +4 =
1 1 3 0 1 1
Matrices: Scalar Multiplication Page 9/25
Problem
Let A and B be m ⇥ n matrices. Simplify the expression
2[9(A B) + 7(2B A)] 2[3(2B + A) 2(A + 3B) 5(A + B)]
Matrices: Scalar Multiplication Page 10/25
Vectors
Definition
A row matrix or column matrix is often called a vector, and such matrices
are referred to as row vectors and column vectors, respectively. If X is a row
vector of size 1 ⇥ n, and Y is a column vector of size m ⇥ 1, then we write
2 3
y1
⇥ ⇤ 6 y2 7
6 7
X = x1 x2 · · · xn and Y = 6 . 7
4 .. 5
ym
Matrices: Vectors Page 11/25
Vector Product
Definition
Let X be a row vector of size 1 ⇥ n, and Y be a column vector of size
n ⇥ 1. Then the product of (row) vector X and (column) vector Y is the
1 ⇥ 1 matrix given by
2 3
y1 " #
⇥ ⇤6
6 y2 7
7
n
x 1 x2 · · · xn 6
4
..
.
7 = [x1 y1 + x2 y2 + · · · + xn yn ] =
5 Â xj yj .
j=1
yn
Matrices: Vectors Page 12/25
Example
Example
2 3
5
⇥ ⇤6 6 7
1 2 3 4 6 7 = [1 · 5 + 2 · 6 + 3 · 7 + 4 · 8] = [70] .
4 7 5
8
Example
2 3
5
6 6 7
⇥ ⇤6 7
1 2 3 4 6
6 7 7
7
4 8 5
9
is incompatible, therefore multiplication is not defined.
Matrices: Vectors Page 13/25
Definition (The (i, j)-entry of a product)
Let A = [aij ] be an m ⇥ n matrix and B = [bij ] be an n ⇥ p matrix. Then
the (i, j)-entry of AB is given by
n
ai1 b1j + ai2 b2j + · · · + ain bnj = Â aik bkj
k=1
Example
Using the above definition, the (2, 3)-entry of the product
2 3
1 1 2
1 0 3 4
0 2 4 5
2 1 1
1 0 0
is computed using the second row of the first matrix, and the third column
of the second matrix,
resulting in
2 ⇥ 2 + ( 1) ⇥ 4 + 1 ⇥ 0 = 4 4 + 0 = 0.
Matrices: The (i, j)-Entry of a Product Page 14/25
Problem
Find the product AB of matrices 2 3
1 1 2
1 0 3
A= and B = 4 0 2 4 5
2 1 1
1 0 0
Matrices: The (i, j)-Entry of a Product Page 15/25
Compatibility for Matrix Multiplication
Definition
Let A and B be matrices, and suppose that A is m ⇥ n.
In order for the product AB to exist, the number of rows in B must be
equal to the number of columns in A, implying that B is an n ⇥ p
matrix for some p.
When defined, AB is an m ⇥ p matrix.
If the product is defined, then A and B are said to be compatible for
(matrix) multiplication.
Matrices: The (i, j)-Entry of a Product Page 16/25
Example
As we saw in the previous problem
2 3⇥3 3
2⇥3 2⇥3
1 1 2
1 0 3 4 4 1 2
0 2 4 5=
2 1 1 1 4 0
1 0 0
However, if we change the order, the product
2 3⇥3 3 2⇥3
1 1 2
4 1 0 3
0 2 4 5
2 1 1
1 0 0
does not exist.
Matrices: The (i, j)-Entry of a Product Page 17/25
Questions on Matrix Multiplication
Given matrices A and B, is AB = BA?
Suppose A is an m ⇥ n matrix and B is an m0 ⇥ n0 matrix.
The product AB is defined if and only if n = m0 .
The product BA is defined if and only if m = n0 .
Therefore the equation AB = BA makes sense if and only if A is an m ⇥ n
matrix and B is an n ⇥ m matrix for some – possibly different – m and n.
So the right question is:
Given matrices A and B such that both AB and BA are defined, is
AB = BA?
Matrices: Properties of Matrix Multiplication Page 18/25
Matrix Multiplication is Not Commutative
Problem
Let 2 3
1 2
1 1 2 0
A=4 3 0 5 and B =
3 2 1 3
1 4
Does AB exist? If so, compute it.
Does BA exist? If so, compute it.
Solution
Matrices: Properties of Matrix Multiplication Page 19/25
Problem
Let
1 ⇥ ⇤
G= and H = 1 0
1
Does GH exist? If so, compute it.
Does HG exist? If so, compute it.
Solution
Matrices: Properties of Matrix Multiplication Page 20/25
Problem
Let
1 0 1 1
P= and Q =
2 1 0 3
Does PQ exist? If so, compute it.
Does QP exist? If so, compute it.
Solution
Matrices: Properties of Matrix Multiplication Page 21/25
Fact
The three preceding problems illustrate an important property of matrix
multiplication.
In general, matrix multiplication is not commutative, i.e., the order
of the matrices in the product is important.
In other words, in general AB 6= BA.
Matrices: Properties of Matrix Multiplication Page 22/25
Commuting Matrices
Problem
Let
2 0 1 2
U= and V =
0 2 3 4
Does UV exist? If so, compute it.
Does VU exist? If so, compute it.
Solution
Matrices: Properties of Matrix Multiplication Page 23/25
Properties of Matrix Multiplication
Theorem
Let A, B, and C be matrices of the appropriate sizes, and let r 2 R be a
scalar. Then the following properties hold.
1 A(B + C ) = AB + AC .
(matrix multiplication left distributes over matrix addition).
2 (B + C )A = BA + CA.
(matrix multiplication right distributes over matrix addition).
3 A (BC ) = (AB) C . (matrix multiplication is associative).
4 r (AB) = (rA)B = A(rB).
Matrices: Properties of Matrix Multiplication Page 24/25
Practice Problem
Let
2 3 2 3 2 3
1 0 1 1 2 3 4 1 7
A=4 3 1 2 5,B = 4 2 3 1 5,C = 4 1 0 4 5.
0 2 1 3 1 2 3 1 1
Find
1 AB
2 (AB)C
3 (A+B)
4 C (A + B)
Matrices: Properties of Matrix Multiplication Page 25/25