Matrices
Matrices
A. Musopole
The Polytechnic
[email protected]
22 15 17 10
17 21 16 14
12 16 7 21
This looks simple- but there is a simpler way we can use to present
this information.
Some examples:
12 13 7 3 12
12 13
M = 15 11 6 4 ; B =
; X = 15 ; and
15 11
8 7 9 2 8
A= 8 7 9 2 .
Matrix M has 3 rows and 4 columns- it is a 3×4 matrix. The
numbers of rows and columns for this matrix are different- it is an
example of a rectangular matrix. Matrix B is a 2×2 matrix. The
number of rows is equal to the number of columns- it is a square
matrix. Matrix A is a 1×4 matrix- it has only one row, hence it is
called a row matrix. Matrix X is a 3×1 matrix- it has only one
column, hence it is called a column matrix.
The number of rows and columns that a matrix has is called its order
or its dimension. By convention, rows are listed first, and columns
second.
Consider the matrices provided below.
12 13 7 12 13 12
M = 15 11 6 ; B = 15 11 ; X = 15 ; and A = 8 7 .
8 7 9 14 13 8
9
A. Musopole (Poly) Matrices April 12, 2021 11 / 57
Types of Matrices...
Matrices can be used to represent real life data- this is when the data
is in two dimension.
Example: A small company that has got branches in Lilongwe and
Mzuzu is involved in the production of breads, bans, and cup cakes.
Last year, profits made in Lilongwe were MK15, 000, 000.00,
MK11, 000, 000.00, and MK6, 000, 000.00 on breads, bans, and cup
cakes respectively. Profits made in Mzuzu were MK8, 000, 000.00,
MK7, 000, 000.00, and MK9, 000, 000.00 on breads, bans and cup
cakes respectively.
In matrix form, the data can be represented is below (the values are
in millions of Malawi Kwachas).
bread
ban cake
Lilongwe 15 11 6
Mzuzu 8 7 9
Let the matrices N and P represent numbers of items baked and prices of
the items (for a unit). Then
340
2050 3210 1230
N= and P = 150 .
2113 2986 2400
200
With the order the same, A = B if a11 = b11 , a12 = b12 , a13 = b13 ,
a21 = b21 , a22 = b22 , a23 = b23 , a31 = b31 , a32 = b32 , and a33 = b33 .
Consider the given matrices- the matrices are equal.
10 8 10 8
Z = 9 7 and Y = 9 7 .
−4 5 −4 5
Thus Z = Y .
A. Musopole (Poly) Matrices April 12, 2021 16 / 57
Equality of Matrices...
Let us look at the matrices provided below- the matrices are equal.
10 8 −12 4 10 8 −12 4
H= a 7 14 −16 and G = 9 7 14 23 y .
−4 5 18 10 −4 5 3x 10
2 2
y = −16 ⇒ 3× y = −16×3
3 3
2y −48
⇒2y = −48 ⇒ =
2 2
⇒y = −24.
4 −2 1 3 4 + 1 −2 + 3 5 1
P +Q = + = = .
6 8 4 2 6+4 8+2 10 10
R + P is not possible (R and P have different dimensions).
1 3 4 −2 1 + 4 3 + (−2) 5 1
Q +P = + = = .
4 2 6 8 4+6 2+8 10 10
6 2 10 5 1 3 6 − 5 2 − 1 10 − 3
S −R = − =
9 −4 2 7 4 2 9 − 7 −4 − 4 2 − 2
1 1 7
=
2 −8 0
5 1 3 6 2 10 5−6 1−2 3 − 10
R −S = − =
7 4 2 9 −4 2 7 − 9 4 − (−4) 2 − 2
−1 −1 −7
= .
−2 8 0
Consider matrices
−2 2x 13 −8 5 9 6 y 4
M= ;N= ; and O = .
y 13 −4 2 3 −11 −2x 10 7
2x = 5 − y
2y = 2 − x
2y = 2 − x
⇒2(5 − 2x) = 2 − x
⇒10 − 4x = 2 − x
⇒ − 4x + x = 2 − 10
⇒ − 3x = −8
−3x −8
⇒ =
−3 −3
2
⇒x = 2 .
3
2x = 5 − y
2
⇒2 2 =5−y
3
16
⇒ =5−y
3
16
⇒ − 5 = −y
3
1
⇒ = −y
3
1
⇒y = − .
3
Then
b11 b12
a11 a12 a13
C = AB = b21 b22
a21 a22 a23
b31 b32
a11 b11 + a12 b21 + a13 b31 a11 b12 + a12 b22 + a13 b32
= .
a21 b11 + a22 b21 + a23 b31 a21 b12 + a22 b22 + a23 b32
−4 7
3 2
VK = 5 2
1 5
9 1
−4×3 + 7×1 −4×2 + 7×5 −5 27
= 5×3 + 2×1 5×2 + 2×5 = 17 20 .
9×3 + 1×1 9×2 + 1×5 28 23
Then
850
QP = 12 7 11 350 = 12×850 + 7×350 + 11×120 = 13970
120
Try: Product M has fixed cost of K4, 200 and variable cost of K2, 000 per
product; and product N has fixed cost of K1, 000 and variable cost of
K1, 500 per product.
Suppose for each, M and N, q products have been produced, come
up with matrices for costs (C ) and quantity (Q)- the matrices should
be in a manner that they can be multiplied.
Find CQ and interpret.
Product M sell at K3, 500 and product N sell at K2, 200. Come up
with the revenue matrix (PQ- where P is cost matrix). And evaluate
PQ − CQ. Interpret PQ − CQ.
What quantity, q, will make profits on M and N the same?
(Matrix multiplication is not commutative- thus AB6=BA.)
Find
−4Q.
0.5P.
−3R + 2P.
3Q − 2P + 4R.
a11 a12
|A| = = a11 a22 − a12 a21 .
a21 a22
3 −3
Example: For matrix K = , let us determine the
4 7
determinant.
3 −3
Example: For matrix K = , the determinant is
4 7
3 −3
|K | = = 3×7 − (−3)×4 = 33.
4 7
|A| = (a11 a22 a33 + a12 a23 a31 + a13 a21 a32 )
− (a31 a22 a13 + a32 a23 a11 + a33 a21 a12 ) .
3 2 1
Example: consider the matrix V = 1 1 1 . Let us find its determinant.
3 1 2
1 1 1 1 1
3 1 2 3 1
− − −
Then
−1 1 a22 −a12
A =
|A| −a21 a11
with |A|6=0. When we get |A| = 0, the inverse does not exist.
For each of the matrices below, let us try to find the inverse.
5 −9 −3 −6
Z= ;B= .
4 3 4 8
For each of the matrices below, let us try to find the inverse.
5 −9 −3 −6
Z= ;B= .
4 3 4 8
3 -1 0 -1
C11 = (−1)1+1 = −2, C12 = (−1)1+2 = 3,
4 -2 -3 -2
0 3 2 1
C13 = (−1)1+3 = 9, C21 = (−1)2+1 = 8,
-3 4 4 -2
7 1 7 2
C22 = (−1)2+2 = −11, C23 = (−1)2+3 = −34,
-3 -2 -3 4
2 1 7 1
C31 = (−1)3+1 = −5, C32 = (−1)3+2 = 7,
3 -1 0 -1
7 2
C33 = (−1)3+3 = 21.
0 3
det(A) = a11 C11 + a12 C12 + a13 C13 = 7(−2) + 2(3) + 1(9) = 1.
Then
T T
C C12 C13 −2 3 9
1 1 11 1
A−1 = adj(A) = C21 C22 C23 = 8 −11 −34
det(A) det(A) 1
C31 C32 C33 −5 7 21
−2 8 −5
= 3 −11 7 .
9 −34 21
a11 x + a12 y = r
a21 x + a22 y = s
Multiplying the matrices and using the equality property should give us
back the original system of equations.
AX = B
⇒A−1 AX = A−1 B
⇒I X = A−1 B
⇒X = A−1 B.
x
We know that X = . Thus the solution (values of x and y ) is
y
found by multiplying the inverse of A and matrix B.
Example: Let us solve the system below.
2x = 5 − y
2y = 2 − x
2x + y = 5
x + 2y = 2
Then
2
− 13
8
−1 3 5
X =A B= = 31
− 13 2
3 2 −3
8
Thus x = 3 = 2 23 and y = − 13 .
This method involves the calculation of determinants and their ratios. The
value of only one variable is found. If you have several variables, then the
formula is applied several times. Suppose we have the system below.
a11 x + a12 y = r
a21 x + a22 y = s
r a12 a11 r
|Ax | s a22 |Ay | a21 s
x= = ,y= = .
|A| |A| |A| |A|
2x = 5 − y
2y = 2 − x
2x = 5 − y
2y = 2 − x
2x + y = 5
x + 2y = 2
5 1
|Ax | 2 2
x= =
|A| 3
10 − 2 8
= =
3 3
and
2 5
|Ay | 1 2
y= =
|A| 3
4−5 1
= =− .
3 3
Let us try to solve the systems of linear equations below. Let us try to use
both methods that we have covered.
1.
2.
7x1 + 2x2 + x3 = 21
3x2 − x3 = 5
−3x1 + 4x2 − 2x3 = −1