You are on page 1of 19

WTW 164

Unit 1.4: Matrix algebra


Dr HR (Maya) Thackeray
<maya.thackeray@up.ac.za>
Matrices, row vectors, and column vectors
• A matrix is a grid of numbers.
• An m by n matrix has m rows and n columns (those two numbers give
the size of the matrix):
A = [aij] = .

• If two matrices A = [aij] and B = [bij] are the same size, then A = B if
and only if for all i in {1,…,m} and all j in {1,…,n}, we have aij = bij.
• A 1 by n matrix is a row vector (or row matrix) v = [v1 … vn].
• An m by 1 matrix is a column vector (or column matrix) v = .
Types of matrices and their properties
• The m by n matrix O in which all entries are 0 is the (m by n) zero
matrix:
O=.
• The m by 1 zero matrix (which is a column vector) is written 0.
• For an m by n matrix A, the transpose of A is the n by m matrix AT such
that the entry in row i and column j of AT is the entry in row j and
column i of A.
• For example, if A = , then AT = ; if A is a row vector, then AT is a column
vector.
• For every m by n matrix A, we have (AT)T = A.
Square matrices
A square matrix has the same number of rows as columns.
On this page, let A = [aij] be a (square) n by n matrix.
• The main diagonal, or diagonal, of A consists of the entries aii (i in {1,…,n}).
• A is upper triangular if and only if all entries below the main diagonal are 0.
• A is lower triangular if and only if all entries above the main diagonal are 0.
• A is a diagonal matrix if and only if all nonzero entries are on the main
diagonal, that is, if and only if A is both upper triangular and lower triangular.
• A is symmetric if and only if AT = A, that is, if and only if for all i and j in {1,
…,n} we have aij = aji (“reflecting about the main diagonal leaves A the
same”).
The identity matrix
The n by n identity matrix, written I or In, is the n by n matrix

where all entries on the main diagonal are 1 and all other entries are 0.
The jth column vector of the n by n identity matrix is written ej; it has a
1 in the jth position, and every other entry in that column vector is 0.
We shall see that the matrix In “acts like the number 1”.
Matrix addition, negation, and subtraction
Let the matrices A = [aij] and B = [bij] be the same size, say, m by n.
• In the m by n matrix A + B, each entry is the sum of the entries of A
and B in that position: the (i,j) entry of A + B is aij + bij.
• The negation of A is the m by n matrix –A in which each entry is the
negative of A’s entry in that position: the (i,j) entry of –A is –aij.
• In the m by n matrix A – B = A + (–B), each entry is the difference of
the entries of A and B in that position: the (i,j) entry of A – B is aij – bij.
Example: Addition, subtraction, negation
Let A = and B = . We have:
• A+B= =,
• A – B = = , and
• –A = .
We do not define the sum or difference of two matrices if they have
different sizes; + does not make sense.
Properties of matrix addition
If A, B, and C are all m by n matrices and O is the m by n zero matrix,
then we have the following.
• Commutative law: A + B = B + A
• Associative law: (A + B) + C = A + (B + C)
• O is the additive identity for m by n matrices: A + O = O + A = A
• –A is the additive inverse of A for m by n matrices:
A + (–A) = (–A) + A = O
• (A + B)T = AT + BT
Scalar multiplication
Let A = [aij] be an m by n matrix, and let r be a real number.
In the m by n matrix rA, each entry is r times the entry of A in the same
position: the (i,j) entry of rA is raij.
Example: if A = , then
–4A = = .
Properties of scalar multiplication
If A and B are m by n matrices, r and s are real numbers, and O is the m
by n zero matrix, then we have the following.
• Distributive laws: r(A + B) = rA + rB and (r + s)A = rA + sA
• Associative law: (rs)A = r(sA)
• 1A = A
• 0A = O (the number 0 times A is the zero matrix)
• (rA)T = r(AT)
Multiplication: row by column
For a 1 by n row vector v = [v1 v2 … vn] and an n by 1 column vector
w = , define the product vw in the same way as the dot product:
vw = [v1 v2 … vn] = v1w1 + v2w2 + … + vnwn.
Example: [3 –1 3] = (3)(2) + (–1)(5) + (3)(4) = 13.
Multiplication: matrix by column
Recall that a system of linear equations is given by
a11x1 + a12x2 + … + a1nxn = b1
a21x1 + a22x2 + … + a2nxn = b2

am1x1 + am2x2 + … + amnxn = bm.
For the m by n matrix A = [aij] and the n by 1 column vector x = ,
define Ax to be the m by 1 column vector with the left sides of the linear equations
above as entries, in that order.
The system of linear equations can now be written briefly as Ax = b.
Notice that entry i of Ax is the product of row i of A with x.
Example: matrix by column
Suppose A = and x = = .
We have Ax = = = .
Matrix multiplication
If A is an m by n matrix and B is an n by k matrix, then AB is the m by k
matrix in which the (i,j) entry is the dot product of row i in A and
column j in B, that is, ai1b1j + ai2b2j + … + aiqbqj + … + ainbnj.
For AB to be defined, A must have as many columns as B has rows.
B
[ b.1 | … | b.k ]
A AB
Example: Matrix multiplication
Suppose A = and B = .
AB =
=.
Similarly, BA = .
Noncommutativity
We do not have AB = BA in general. For two matrices A and B:
• Sometimes, AB is defined but BA is not.
• Sometimes, AB and BA are both defined but have different sizes.
• Sometimes, AB and BA are both defined and have the same size but are not equal.
• Relatively rarely, we have AB = BA (for example, if A is the n by n identity matrix and
B is an n by n matrix).
For real numbers we have (a + b)(a – b) = a2 – b2.
For square matrices A and B of the same size, we have
(A + B)(A – B) = A2 – AB + BA – B2
but we cannot go further since AB does not necessarily equal BA.
Properties of matrix multiplication
If A is an m by n matrix and Om by m, Om by n, and On by n are the zero matrices of the
indicated sizes, then:
• ImA = A = AIn (this is how I acts like the number 1)
• Om by mA = Om by n = AOn by n
If A is an m by n matrix and B is an n by k matrix, then:
• (AB)T = BTAT
If matrices A, B, and C have respective sizes m by n, n by p, and p by q, then:
• Associative law: (AB)C = A(BC)
If A and B are m by n matrices and C and D are n by k matrices, then:
• Distributive laws: A(C + D) = AC + AD and (A + B)C = AC + BC
Zero divisors; failure of cancellation
For real numbers, if ab = 0 then a = 0 or b = 0. However:
• We can have matrices A and B such that A is not the zero matrix, B is
not the zero matrix, but AB = O. Such matrices A and B are zero divisors.
(Example: A = , B = .)
For real numbers, if ab = ac and a is not 0 then b = c. However:
• We can have matrices A, B, and C such that AB = AC, A is not the zero
matrix, but B is not equal to C. (Indeed, AB = AC implies A(B – C) = O,
which does not imply that A = O or B – C = O.)
(Example: A = , B = , C = .)
Powers of a matrix
Let A be a matrix.
If A is not square, then AA is not defined.
If A is square, then we can multiply A by itself, then multiply the result by
A, …; for each positive integer n, we write An = AA…A (where n copies of A
are multiplied together).
Every identity matrix I satisfies I2 = I3 = … = In = I for each positive integer n.
A square matrix A is called idempotent if A2 = A.
• The matrix is idempotent.
• The n by n identity matrix is idempotent for all positive integers n.

You might also like