You are on page 1of 20

MATRIX OPERATIONS

Equality of Matrices

Two matrices A and B are called equal (written A = B) if and only if:
1. They have the same size.
2. Corresponding entries are equal.
𝐴 = 𝐵 𝑖𝑓 𝑎𝑖𝑗 = 𝑏𝑖𝑗 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑖 𝑎𝑛𝑑 𝑗
2 4 3 2 4 3
𝐴 = 9 5 1 𝐵 = 9 5 1
3 7 8 3 7 8
For example if the following two matrices are equal:
1 𝛼 1 2
𝐴= 𝐵=
−1 −𝛽 −1 −4

then we can conclude that 𝛼 = 2 and 𝛽 = 4.


Addition and Subtraction

Two matrices can be added (subtracted) by adding (subtracting) the


corresponding elements of the two matrices.

𝐶 = 𝐴 + 𝐵 = 𝐵 + 𝐴

𝑐𝑖𝑗 = 𝑎𝑖𝑗 + 𝑏𝑖𝑗

Matrices [A], [B] and [C] must have the same order.
𝑎11 𝑎12 𝑎13 𝑏11 𝑏12 𝑏13
𝐴 = 𝑎21 𝑎22 𝑎23 𝐵 = 𝑏21 𝑏22 𝑏23
𝑎31 𝑎32 𝑎33 𝑏31 𝑏32 𝑏33

𝑎11 + 𝑏11 𝑎12 + 𝑏12 𝑎13 + 𝑏13


𝐶 = 𝑎21 + 𝑏21 𝑎22 + 𝑏22 𝑎23 + 𝑏23
𝑎31 + 𝑏31 𝑎32 + 𝑏32 𝑎33 + 𝑏33
Example 1: Given the following matrices,

3 −1 0 1 −1 1 1 0 −2
𝐴= , 𝐵 = , and 𝐶 =
1 2 −4 −2 0 6 3 1 1
Compute −𝐴, 𝐴 − 𝐵, 𝑎𝑛𝑑 𝐴 + 𝐵 − 𝐶

Solution
−3 1 0
−𝐴 =
−1 −2 4

3−1 −1 − −1 0−1 2 0 −1
𝐴−𝐵 = =
1 − −2 2−0 −4 − 6 3 2 −10

3 + 1 − 1 −1 − 1 − 0 0+1+2 3 −2 3
𝐴+𝐵−𝐶 = =
1−2−3 2+0−1 −4 + 6 − 1 −4 1 1
Example 2:
3 2 1 0
Solve +𝑋 = , where 𝑥 is a matrix.
−1 1 −1 2

Solution 1
𝑥 𝑦
𝑋 must be a 2𝑥2 matrix. If 𝑋 = , the equation reads
𝑧 𝑤

1 0 3 2 𝑥 𝑦 3+𝑥 2+𝑦
= + =
−1 2 −1 1 𝑧 𝑤 −1 + 𝑧 1+𝑤

The rule of matrix equality gives 1 = 3 + 𝑥, 0 = 2 + 𝑦, −1 = −1 + 𝑧,


and 2 = 1 + 𝑤.

−2 −2
Thus, X =
0 1
Solution 2

We solve a numerical equation 𝑎 + 𝑥 = 𝑏 by subtracting the


number 𝑎 from both sides to obtain 𝑥 = 𝑏 − 𝑎. This also works for
3 2 1 0
matrices. To solve +𝑋 = , simply subtract the
−1 1 −1 2
3 2
matrix from both sides to get
−1 1

1 0 3 2
𝑋= −
−1 2 −1 1

1−3 0−2
𝑋=
−1 − (−1) 2−1

−2 −2
𝑋=
0 1

Of course, this is the same solution as obtained in Solution 1.


Example 3:

2 1 3 1 1 −1
If 𝐴 = and 𝐵 = , compute 𝐴 + 𝐵.
−1 2 0 2 0 6

Solution

2 + 1 1 + 1 3 + (−1)
𝐴+𝐵 =
−1 − 2 2 − 0 0−6

3 2 2
𝐴+𝐵 =
1 2 6
Multiplication by a Scalar

If a matrix is multiplied by a scalar k, each element of the matrix is


multiplied by k.

𝑘𝑎11 𝑘𝑎12 𝑘𝑎13


𝑘 𝐴 = 𝑘𝑎21 𝑘𝑎22 𝑘𝑎23
𝑘𝑎31 𝑘𝑎32 𝑘𝑎33

In general if A is an 𝑚 × 𝑛 matrix with typical element 𝑎𝑖𝑗 then the


product of a number 𝑘 with 𝐴 is written 𝑘𝐴 and has the
corresponding elements 𝑘𝑎𝑖𝑗 .
Example:
Find 7𝐴 and −3𝐴 of matrix A.
1 2
𝐴=
3 4

Solution:

1 2 7(1) 7(2) 7 14
7𝐴 = 7 = =
3 4 7(3) 7(4) 21 28

1 2 −3 1 −3 2 −3 −6
−3𝐴 = −3 = =
3 4 −3 3 −3 4 −9 −12
Matrix Multiplication

Two matrices can be multiplied together provided they are


compatible with respect to their orders. The number of columns in
the first matrix [𝐴] must be equal to the number of rows in the
second matrix [𝐵]. The resulting matrix [𝐶] will have the same
number of rows as [𝐴] and the same number of columns as [𝐵].

𝑏11 𝑏11
𝑎11 𝑎12 𝑎13
𝐴 = 𝑎 𝑎22 𝑎23 𝐵 = 𝑏21 𝑏22
21
𝑏31 𝑏32
𝑏 𝑏11
𝑎11 𝑎12 𝑎13 11
𝐶 = 𝐴 𝐵 = 𝑎
21 𝑎22 𝑎23 𝑏21 𝑏22
𝑏31 𝑏32

𝑎11 𝑏11 + 𝑎12 𝑏21 + 𝑎13 𝑏31 𝑎11 𝑏12 + 𝑎12 𝑏22 + 𝑎13 𝑏32
𝐶 =
𝑎21 𝑏11 + 𝑎22 𝑏21 + 𝑎23 𝑏31 𝑎21 𝑏12 + 𝑎22 𝑏22 + 𝑎23 𝑏32

where 𝑚 is the number of columns in [𝐴] and also the number of


rows in [𝐵].

𝑐𝑖𝑗 = 𝑎𝑖𝑘 𝑏𝑘𝑗


𝑘=1
Example:
1. Determine the product of [𝐴] and [𝐵].

2 3
2 3 1
𝐴 = 𝐵 = 1 4
5 7 4
5 6

Solution:

𝐶 = 𝐴 𝐵

2𝑥2 + 3𝑥1 + (1𝑥5) 2𝑥3 + 3𝑥4 + (1𝑥6)


𝐶 =
5𝑥2 + 7𝑥1 + (4𝑥5) 5𝑥3 + 7𝑥4 + (4𝑥6)

12 24
𝐶 =
37 67
2. Determine the product of [𝐴] and [𝐵].

2 1 4 4 3
𝐴 = 1 3 2 𝐵 = 1 2
4 −2 5 5 1

Solution:

𝐶 = 𝐴 𝐵

2𝑥4 + 1𝑥1 + (4𝑥5) 2𝑥3 + 1𝑥2 + (4𝑥1)


𝐶 = 1𝑥4 + 3𝑥1 + (2𝑥5) 1𝑥3 + 3𝑥2 + (2𝑥1)
4𝑥4 + −2𝑥1 + (5𝑥5) 4𝑥3 + −2𝑥2 + (5𝑥1)

29 12
𝐶 = 17 11
39 13
3. Compute [A][C], if

3 4 −6 0
1 −2 3 0 1 −2
𝐴= ,𝐵 = , and 𝐶 = 0 −1 2 2
0 3 4 3 −4 5
1 −2 3 4

Solution:
6 0 −1 8
𝐴𝐶 =
4 −11 18 22

Let us break down the multiplication of [𝐴] and [𝐶] in Example 3


down to smaller pieces.

3
1 −2 3 ∙ 0 = 1𝑥3 + −2𝑥0 + 3𝑥1 = 6
1
3 4
1 −2 3 ∙ 0 −1
1 −2
= 1)(3 + −2)(0 + 3)(1 1)(4 + −2)(−1 + 3)(−2

= 6 0

3 4 −6 0
1 −2 3 ∙ 0 −1 2 2
1 −2 3 4
= 3+0+3 4+2−6 −6 − 4 + 9 0 − 4 + 12

= 6 0 −1 8
Now compute the second row to get

6 0 −1 8
𝐴𝐶 =
4 −11 18 22
Transpose of a Matrix

The transpose [A]T of an m × n matrix [A] is the m × n matrix


obtained by interchanging the rows and columns of [A]. For example

𝑎11 𝑎12 𝑎13 4 5 2


𝐴 = 𝑎21 𝑎22 𝑎23 = −3 1 7
𝑎31 𝑎32 𝑎33 2 9 6
𝑎11 𝑎21 𝑎31 4 −3 2
𝐴 𝑇 = 𝑎12 𝑎22 𝑎32 = 5 1 9
𝑎13 𝑎23 𝑎33 2 7 6

The resulting matrix is called the transposed matrix of 𝐴 and denoted


𝐴𝑇. In the previous example it is clear that 𝐴𝑇 is not equal to 𝐴 since
the matrices are of different sizes. If 𝐴 is square 𝑛 × 𝑛 then 𝐴𝑇 will
also be 𝑛 × 𝑛.
Example:
Write down the transpose of each of the following matrices.
1.
1
𝐴= 3 𝐵= 5 2 6
2

1 2 3 1 −1
𝐶= 3 4 𝐷= 1 3 2
5 6 −1 2 1

Solution:

5
𝐴𝑇 = 1 3 2 𝐵𝑇 = 2
6
1 3 5
𝐶𝑇 = 𝐷𝑇 = 𝐷
2 4 6

2.
1 2 3 1 4 7
If 𝐵 is 4 5 6 then 𝐵𝑇 is 2 5 8
7 8 9 3 6 9

Both matrices are 3 × 3 but 𝐵 and 𝐵𝑇 are clearly different.


Transpose of a Sum
The transpose of a sum is the sum of transposes
𝐴 + 𝐵 𝑇 = 𝐴 𝑇 + 𝐵 𝑇

Transpose of a Product
The transpose of a product is the product of the transposes in the
reverse order.

𝐴 ∙ 𝐵 𝑇 = 𝐵 𝑇 ∙ 𝐴 𝑇
Numerical example of the product rule

𝑇
Example 1: Find 𝐴 ∙ 𝐵 if

2 3
4 3 0 1
𝐴 = 0 4 𝐵 =
2 1 5 3
5 1
Solution:
4 2
𝐴 ∙ 𝐵 𝑇 = 𝐵 𝑇 ∙ 𝐴 𝑇= 3 1 ∙ 2 0 5
0 5 3 4 1
1 3

4 2 + (2)(3) 4 0 + (2)(4) 4 5 + (2)(1) 14 8 22


3 2 + (1)(3) 3 0 + (1)(4) 3 5 + (1)(1)
= = 9 4 16
0 2 + (5)(3) 0 0 + (5)(4) 0 5 + (5)(1) 15 20 5
1 2 + (3)(3) 1 0 + (3)(4) 1 5 + (3)(1) 11 12 8
Symmetric Matrices
When the transpose of a matrix is equal to the original matrix i.e.
𝐴𝑇 = 𝐴, then we say that the matrix A is symmetric. In the
previous example (example 2) B is not symmetric.

Example:
1 −2 3 1 −2 3
If 𝐶 = −2 4 −5 then 𝐶 𝑇 = −2 4 −5
3 −5 6 3 −5 6

Clearly 𝐶𝑇 = 𝐶 and C is a symmetric matrix. Notice how the leading


diagonal acts as a “mirror”; for example c12 =−2 and c21 =−2. In
general cij =cji for a symmetric matrix.

You might also like