You are on page 1of 18

Matrices

• The size of a matrix with n rows and m columns is denoted by n x m.


Example Give the size of the following matrix
4 3 0 6 −1 0
0 2 −4 −7 1 3 ⟺ 𝑠𝑖𝑧𝑒: 3 × 6
1
−6 1 15 −1 0
2
• Upper case letters are generally used to refer to matrices while lower case letters generally
are used to refer to numbers.
• The entry in the ith row and jth column of the matrix A is denoted by,
aij or (A)ij
𝑎11 𝑎12 ⋯ 𝑎1𝑚 𝑎11 𝑎12 ⋯ 𝑎1𝑚
𝑎21 𝑎22 ⋯ 𝑎2𝑚 𝑎21 𝑎22 ⋯ 𝑎2𝑚
𝐴= ⋮ ⋮ ⋱ ⋮ 𝑜𝑟 𝐴= ⋮ ⋮ ⋱ ⋮
𝑎𝑛1 𝑎𝑛2 ⋯ 𝑎𝑛𝑚 𝑎𝑛1 𝑎𝑛2 ⋯ 𝑎𝑛𝑚 𝑛×𝑚

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 27
Matrices
• This matrix has a single column and is often called a column matrix.
𝑎1
𝑎2
𝒂 = 𝑎ത = ⋮
𝑎𝑛
• This matrix has a single row and is often called a row matrix.
𝒃 = 𝑏ത = 𝑏1 𝑏2 𝑏3 ⋯ 𝑏𝑚
• In this matrix the number of rows is equal to the number of columns. Matrices that have
the same number of rows as columns are called square matrices. In a square matrix the
entries a11, a22, …, ann are called the main diagonal.
𝑎11 𝑎12 ⋯ 𝑎1𝑚
𝑎21 𝑎22 ⋯ 𝑎2𝑚
⋮ ⋮ ⋱ ⋮
𝑎𝑛1 𝑎𝑛2 ⋯ 𝑎𝑛𝑚

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 28
Matrices
• Any matrix can be partitioned into smaller submatrices simply by adding in
horizontal and/or vertical lines between selected rows and/or columns.

Column matrices of A Row matrices of A

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 29
Matrices
• The zero matrix, an n x m matrix whose entries are all zeroes
0
0 0 0 0
02×4 = 0= 0 0 0 0 0 0= 0
0 0 0 0
0
• The identity matrix is a square n x n matrix usually denoted by In The
entries on the main diagonal of the identity matrix are all ones and all the
other entries in the identity matrix are zeroes
1 0 0 0
1 0 0 1 0 0
𝐼2 = 𝐼4 =
0 1 0 0 1 0
0 0 0 1

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 30
Matrix Operations
Definition 1 If A and B are both n x m matrices then we say that A = B
provided corresponding entries from each matrix are equal. Or in other
words, A = B provided aij = bij for all i and j.
Matrices of different sizes cannot be equal.
Example Consider the following matrices.
−9 123 −9 𝑏 −9
𝐴= 𝐵= 𝐶=
3 −7 3 −7 3
𝐴 ≠ 𝐶 𝑎𝑛𝑑 𝐵 ≠ 𝐶
𝐴 = 𝐵 𝑏 = 123
𝐴 ≠ 𝐵 𝑏 ≠ 123

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 31
Matrix Operations
Definition 2 If A and B are both n x m matrices then A±B is a new n x m matrix that is found by
adding/subtracting corresponding entries from each matrix. Or in other words,
𝐴 ± 𝐵 = 𝑎𝑖𝑗 ± 𝑏𝑖𝑗
Matrices of different sizes cannot be added or subtracted
Example For the following matrices perform the indicated operation, if possible.
2 0 2
2 0 −3 2 0 −4 −7 2
𝐴= 𝐵= 𝐶 = −4 9 5
−1 8 10 −5 12 3 7 9
6 0 −6
(a) A+ B (b) B – A (c) A+C
Solution
2 −4 −10 4
𝐴+𝐵 =
11 11 17 4
−2 −4 −4 0
𝐵−𝐴=
13 −5 −3 14
𝐴 + 𝐶 = 𝑁𝑜 𝑆𝑜𝑙𝑢𝑡𝑖𝑜𝑛 because 𝐴 and 𝐶 are different sizes

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 32
Matrix Operations
Definition 3 If A is any matrix and c is any number then the product (or scalar multiple),
cA, is a new matrix of the same size as A and it’s entries are found by multiplying the
original entries of A by c. In other words cA =[caij ] for all i and j.
Example Given the matrices
0 9 8 1 2 3
𝐴 = 2 −3 𝐵 = −7 0 𝐶 = −2 5
−1 1 4 −1 10 −6
1
compute 3𝐴 + 2𝐵 − 𝐶
2
Solution
3 55
1 15
1 0 27 16 2 2 2
3𝐴 + 2𝐵 − 𝐶 = 6 −9 + −14 0 − 5 = 23
2 −1 −7 −
−3 3 8 −2 2 2
5 −3 0 4

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 33
Matrix Operations
Definition 4 If A is an n x p matrix and B is a p x m matrix then the product (or matrix multiplication) is a new matrix with size
n x m whose ijth entry is found by multiplying row i of A times column j of B.
Example Compute AC and CA for the following two matrices, if possible.
8 5 3
1 −3 0 4 −3 10 2
𝐴= 𝐶=
−2 5 −8 9 2 0 −4
−1 −7 5
Solution
8 5 3
1 −3 0 4 −3 10 2
𝐴𝐶 =
−2 5 −8 9 2×4 2 0 −4
−1 −7 5 4×3
1 8 + −3 −3 + 0 2 + 4 −1 1 5 + −3 10 + 0 0 + 4 −7 1 3 + −3 2 + 0 −4 + 4 5
=
−2 8 + 5 −3 + −8 2 + 9 −1 −2 5 + 5 10 + −8 0 + 9 −7 −2 3 + 5 2 + −8 −4 + 9 5
13 −53 17
=
−56 −23 81 2×3
8 5 3
−3 10 2 1 −3 0 4
𝐶𝐴 = = 𝑁𝑜 𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛
2 0 −4 −2 5 −8 9 2×4
−1 −7 5 4×3

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 34
Matrix Operations
Theorem 1 Assuming that A and B are appropriately sized so that AB is defined then,
1. The ith row of AB is given by the matrix product : [ith row of A]B.
2. The jth column of AB is given by the matrix product : A[jth column of B].
Example Compute the second row and third column of AC given the following matrices.
8 5 3
1 −3 0 4 −3 10 2
𝐴= 𝐶=
−2 5 −8 9 2 0 −4
−1 −7 5
Solution
8 5 3
−3 10 2
−2 5 −8 9 1×4
2 0 −4
−1 −7 5 4×3
= −2 8 + 5 −3 + −8 2 + 9 −1 −2 5 + 5 10 + −8 0 + 9 −7 −2 3 + 5 2 + −8 −4 + 9 5

= −56 −23 81 1×3

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 35
Matrix Operations
3
1 −3 0 4 2 1 3 + −3 2 + 0 −4 + 4 5
=
−2 5 −8 9 2×4 −4 −2 3 + 5 2 + −8 −4 + 9 5
5 4×1
17
=
81 2×1

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 36
Matrix Operations

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 37
Matrix Operations
Example Compute AC for the following matrices.
8 5 3
1 −3 0 4 −3 10 2
𝐴= 𝐶=
−2 5 −8 9 2 0 −4
−1 −7 5
Solution
𝑟1 = 1 −3 0 4 𝑟2 = −2 5 −8 9
8 5 3
−3 10 2
𝑟1 𝐶 = 1 −3 0 4 1×4 = 13 −53 17 1×3
2 0 −4
−1 −7 5 4×3
8 5 3
−3 10 2
𝑟2 𝐶 = −2 5 −8 9 1×4 = −56 −23 81 1×3
2 0 −4
−1 −7 5 4×3
𝑟𝐶 13 −53 17
𝐴𝐶 = 1 =
𝑟2 𝐶 −56 −23 81 2×3

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 38
Matrix Operations
8 5 3
−3 10 2
𝑐1 = 𝑐2 = 𝑐3 =
2 0 −4
−1 −7 8 5
1 −3 0 −3 4 13
=
−2 5 −82×4 2 9 −56 2×1
−1 4×1
5
1 −3 0 4 10 −53
=
−2 5 −8 9 2×4 0 −23 2×1
−7 4×1
3
1 −3 0 4 2 17
=
−2 5 −8 9 2×4 −4 81 2×1
5 4×1
13 −53 17
𝐴𝐶 = 𝐴𝑐1 𝐴𝑐2 𝐴𝑐3 =
−56 −23 81 2×3

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 39
Matrix Operations
Consider A an n x p matrix and x a p x 1 column matrix
𝑎11 𝑎12 ⋯ 𝑎1𝑝 𝑥1 𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑝 𝑥𝑝
𝑎21 𝑎22 ⋯ 𝑎2𝑝 𝑥2 𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑝 𝑥𝑝
𝐴𝐱 = ⋮ ⋮ ⋱ ⋮ ⋮ = ⋮
𝑎𝑛1 𝑎𝑛2 ⋯ 𝑎𝑛𝑝 𝑥𝑝 𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑝 𝑥𝑝 𝑛×1
𝑎11 𝑥1 𝑎12 𝑥2 𝑎1𝑝 𝑥𝑝 𝑎11 𝑎12 𝑎1𝑝
𝑎21 𝑥1 𝑎22 𝑥2 𝑎2𝑝 𝑥𝑝 𝑎21 𝑎22 𝑎2𝑝
= ⋮ + ⋮ +⋯+ ⋮ = 𝑥1 ⋮ + 𝑥2 ⋮ + ⋯ + 𝑥𝑝 ⋮
𝑎𝑛1 𝑥1 𝑎𝑛2 𝑥2 𝑎𝑛𝑝 𝑥𝑝 𝑎𝑛1 𝑎𝑛2 𝑎𝑛𝑝
𝑎11 𝑎12 𝑎1𝑝
𝑎21 𝑎22 𝑎2𝑝
𝐴𝐱 = 𝑥1 ⋮ + 𝑥2 ⋮ + ⋯ + 𝑥𝑝 ⋮ = 𝑥1 𝑐1 + 𝑥2 𝑐2 + ⋯ + 𝑥𝑝 𝑐𝑝
𝑎𝑛1 𝑎𝑛2 𝑎𝑛𝑝

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 40
Matrix Operations
Example Compute Ax directly and as a linear combination for the following matrices.
2
4 1 2 −1
−1
𝐴 = −12 1 3 2 𝐱=
6
0 −5 −10 9
8
Solution
2
4 1 2 −1 11
−1
𝐴𝐱 = −12 1 3 2 = 9
6
0 −5 −10 9 17
8
2
4 1 2 −1 4 1 2 −1
−1
𝐴𝐱 = −12 1 3 2 = 2 −12 − 1 1 + 6 3 + 8 2
6
0 −5 −10 9 0 −5 −10 9
8
8 1 12 −8 11
= −24 − 1 + 18 + 16 = 9
0 −5 −60 72 17

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 41
Matrix Operations
Let’s start out with a general system of n equations and m unknowns.
𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑚 𝑥𝑚 = 𝑏1
𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑚 𝑥𝑚 = 𝑏2

𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑚 𝑥𝑚 = 𝑏𝑛
𝑎11 𝑎12 ⋯ 𝑎1𝑚 𝑥1 𝑏1
𝑎21 𝑎22 ⋯ 𝑎2𝑚 𝑥2 𝑏2
⋮ ⋮ ⋱ ⋮ ⋮ = ⋮ ⇔ 𝐴𝐱 = 𝑏
𝑎𝑛1 𝑎𝑛2 ⋯ 𝑎𝑛𝑚 𝑥𝑚 𝑏𝑛

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 42
Matrix Operations
Definition 5 If A is an n x m matrix then the transpose of A, denoted by
AT, is an m x n matrix that is obtained by interchanging the rows and
columns of A. So, the first row of AT is the first column of A, the second
row of AT is the second column of A, etc. Likewise, the first column of AT
is the first row of A, the second column of AT is the second row of A,
etc.
𝐴 = 𝑎𝑖𝑗 ⇒ 𝐴𝑇 = 𝑎𝑗𝑖 for all 𝑖 and 𝑗
𝑛×𝑚 𝑚×𝑛
Definition 6 If A is a square matrix of size n x n then the trace of A,
denoted by tr(A), is the sum of the entries on main diagonal. Or,
tr 𝐴 = 𝑎11 + 𝑎22 + ⋯ + 𝑎𝑛𝑛
If A is not square then the trace is not defined
Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 43
Matrix Operations
Example Determine the transpose and trace (if it is defined) for each of the following
matrices.
3 2 −6
4 10 −7 0
𝐴= 𝐵 = −9 1 −7
5 −1 3 −2
5 0 12
Solution
4 5
10 −1
𝐴𝑇 = tr(A): Not defined since is not square.
−7 3
0 −2
3 −9 5
𝐵𝑇 = 2 1 0 tr(B) = 3 + 1 + 12 = 16
−6 −7 12

Instructor: Dr. Asseel Al-Gaheeshi University of Kerbala / College of Engineering Advanced Mathematics 44

You might also like