Copyright Reserved 1
Chapter 4 Matrix Algebra
4.2 Introduction to Matrix concepts
A matrix is a rectangular (or square) array or real numbers
arranged in rows and columns.
� = ���� ��� ������ ��� ���� = �5 1 54 2 7�
The order (or dimension) of the matrix is a � × � where m
is the number of rows and n is the number of columns. A
matrix is square if � = �.
Vectors:
Row vector: Example: �1 2 4� is a 1 × 3 row vector.
Column vector: Example: �124� is a 3 × 1 column vector.
Scalar: Single number. Example: 4 is a scalar
Copyright Reserved 2
4.3 Matrix operations
� = �1 −23 4 �, � = � 2 5−1 1�, � = �1 12 13 1�, � = �102� and
� = �−2 4�.
Matrix addition:
• � + � =
• � + � = � 2 5−1 1� + �102� ≠ Not possible to calculate
Copyright Reserved 3
Matrix subtraction:
• � − � = �1 12 13 1� − �1 12 13 1� =
A matrix with all elements equal to zero is called a zero
matrix.
Transpose of a matrix:
• � = �−2 4� with ��� = −2 (first row, first column)
and ��� = 4 (first row, second column). �′ = �−24 �
• � = � 2 5−1 1� with ��� = 2, ��� = 5, ��� = −1 and ��� = 1. Therefore �′ =
• Note that the transpose of a row vector gives a column
vector & the transpose of a column vector gives a row
vector.
Copyright Reserved 4
Multiplying a matrix by a scalar: 2� = 2�1 −23 4 � =
Matrix multiplication: �� = �1 −23 4 � � 2 5−1 1� = �1��2� + �−2��−1� = 4 �1��5� + �−2��1� = 3�3��2� + �4��−1� = 2 �3��5� + �4��1� = 19" =�4 32 19� .
�� = � 2 5−1 1� �1 −23 4 � =
Note that �� ≠ ��.
�� = � 2 5−1 1��1 12 13 1� ≠ Not possible to calculate.
The order of the matrix ���# is: $��×�� %��×�� $′��×�� = 1 × 1.
Copyright Reserved 5
The Identity Matrix (I):
An Identity matrix is always square and has one’s on the
diagonal and zero’s elsewhere.
Let � = � 1 5−1 3� and � = �1 11 −22 0 �.
�& = � 1 5−1 3� �1 00 1� = � 1 5−1 3� = �.
&� = �1 00 1� � 1 5−1 3� = � 1 5−1 3� = �.
Note: In the previous ex. the Identity matrix is of order 2.
&� = �1 0 00 1 00 0 1��1 11 −22 0 � == �.
Note: In the previous ex. the Identity matrix is of order 3.
Copyright Reserved 6
Take note: We DO NOT give you the Identity matrix. You
have to calculate the order yourself. Calculate: � + 4&
Copyright Reserved 7
Practical example:
Model
L GL GLX GLE
Series A 500 300 280 90
Series B 400 150 220 190
Let ( = �500400300150280220 90190�, �� = �11� and �* = +1111,.
Then ��′ = �1 1� and �*′ = �1111�. Let .′ = �10131820� be the profit for the models.
Then . = /101318200.
Use matrix multiplication to calculate the following:
1. The total number of cars sold for series A and series B.
Copyright Reserved 8
2. The total number of cars sold for each model.
3. Calculate the total profit of Series A and Series B.
Copyright Reserved 9
4.5 The determinant of a matrix
• The determinant is indicated by |�|. • The matrix A must be square.
• |�| is a unique scalar value.
The determinant of a 2 × 2 matrix:
For a 2 × 2 matrix � = ���� ������ ���� the determinant is
calculated using |�| = 3��� ������ ���3 = ������ − ������.
Example � = � 2 5−1 1�.
Then |�| = 3 2 5−1 13 =
Property 1
The determinant of a matrix, A, has the same value as that of
its transpose matrix, A’. That is |�| = |�′|. If � = � 2 5
−1 1� then |�| = 7.
Now �′ = �2 −15 1 � so that 4�′4 = 32 −1
5 1 3 =
Copyright Reserved 10
Property 2
The interchanging of any two rows (or two columns) will
alter the sign, but not the numerical value, of the
determinant.
If � = � 2 5−1 1� then |�| = 7.
Interchanging two rows: 3−1 12 53 =
If � = � 2 5−1 1� then |�| = 7. Interchanging two columns: 35 21 −13 =
Property 3
The multiplication of any one row (or column) by a scalar k,
will change the value of the determinant k-fold.
If � = � 2 5−1 1� then |�| = 7. Multiplying the first row by 5 = 10:
320 50−1 1 3 =
Copyright Reserved 11
Property 4
If each element of a row (or column) is added to (or
subtracted from) the corresponding element of another row
(or column), the value of the determinant remains the same.
If � = � 2 5−1 1� then |�| = 7. Add the first row and the
second row and place the sum in the first row:
3 1 6−1 13 =
Property 5
If one row (or column) is a multiple of another row (or
column) then the determinant is zero. |�| = 31 42 83 =
Note: the second row is a multiple (× 2) of the first row.
Property 6
If one row (or column) of a matrix contains only zeros then
the value of the determinant is zero. |�| = 31 20 03 =
Copyright Reserved 12
The determinant of a 7 × 7 matrix:
|�| = 81 0 22 3 03 4 −28 =
• If |�| = 0 then the matrix A is singular.
• If |�| ≠ 0 then the matrix A is non-singular.
Copyright Reserved 13
Cramer’s rule:
Consider the set of two linear equations: ���9� + ���9� = �� ���9� + ���9� = ��
Matrix notation: �: = � with � = ���� ������ ����, : = �9�9��
and � = ����".
The linear equations can be solved using Cramer’s rule
9� = ;<= >=?<? >??;|%| and 9� = ;>== <=>?= <?;|%| .
Note: This holds if A is non-singular (|�| ≠ 0�.
Copyright Reserved 14
Example 29� − 59� = 31 89� + 99� = −21
Matrix notation: �: = � with � = �2 −58 9 �, : = �9�9�� and � = � 31−21�.
|�| = 32 −58 9 3 =
9� = 3 �� @A@�� B 3|%| =
and
9� = 3� ��C @��3|%| =
Copyright Reserved 15
Consider the set of three linear equations: ���9� + ���9� + ���9� = �� ���9� + ���9� + ���9� = �� ���9� + ���9� + ���9� = ��
Matrix notation: �: = � with � = ���� ��� ������ ��� ������ ��� ����,
: = �9�9�9�� and � = ��������.
The linear equations can be solved using Cramer’s rule
9� = 8<= >=? >=D<? >?? >?D<D >D? >DD8|%|
and
9� = 8>== <= >=D>?= <? >?D>D= <D >DD8|%|
and
9� = 8>== >=? <=>?= >?? <?>D= >D? <D8|%| .
Copyright Reserved 16
Example 9� − 29� = 1 49� − 29� + 9� = 2 9� + 29� − 109� = −1
Matrix notation: �: = � with � = �1 0 −24 −2 11 2 −10�,
: = �9�9�9�� and � = � 12−1�.
|�| = 81 0 −24 −2 11 2 −108 = −2
9� = 8 � E @�� @� �@� � @�E8|%| =
9� = 8� � @�* � �� @� @�E8|%| =
9� = 8� E �* @� �� � @�8|%| =
Copyright Reserved 17
The inverse of a matrix:
If there exists a square, non-singular matrix A then there
exists a square matrix �@� such that �@�� = & and ��@� = & then �@� is the inverse matrix of
A.
Let � = �3 54 7� and test if � 7 −5−4 3 � is the inverse of
matrix A.
��@� = �3 54 7� � 7 −5−4 3 � = �1 00 1�.
Note: You do not have to calculate the inverse of a matrix
by hand, but you have to be able to calculate the inverse of a
matrix using Microsoft Excel.
Copyright Reserved 18
The matrix �@� is used to solve a set of linear equations
�: = � �@���:� = �@���� &: = �@�� : = �@��
Example 39� + 59� = 1 49� + 79� = 0
Solve 9� and 9� using the inverse matrix.
Given: �3 54 7�@� = � 7 −5−4 3 �
�: = � �3 54 7� �9�9�� = �10�
Therefore, : = �@�� �9�9�� = � 7 −5−4 3 � �10� =
Copyright Reserved 19
Example 89� − 9� = 15 9� + 59� = 1 29� + 39� = 4
Solve 9�, 9� and 9� using the inverse matrix.
Given: �8 −1 00 1 52 0 3�@� =
FGH ��* ��* @A�*�E�* �*�* @*E�*@��* @��* C�* IJ
K =��*� 3 3 −510 24 −40−2 −2 8 �
�: = � �8 −1 00 1 52 0 3��9�9�9�� = �1514 �
Therefore, : = �@��
�9�9�9�� = ��*� 3 3 −510 24 −40−2 −2 8 ��1514 � =
Copyright Reserved 20
Practical applications:
Example
Consider the sales of 3 shops at a motor show. Flags, T-
shirts and caps are sold.
Shop Flags T-shirts Caps
1 8 4 10
2 2 3 14
3 5 0 6
The sales matrix ( = �8 4 102 3 145 0 6 �.
Suppose the prices of the items are known and are the same
for the 3 shops. The prices are R10 for a flag, R8 for a T-
shirt and R5 for a cap. Let . = �1085 � and �� = �111�.
Use matrix multiplication to calculate the following:
1. The total number of items sold at the 3 shops.
Copyright Reserved 21
2. The total number of flags, T-shirts and caps sold.
3. The total income for each shop.
Copyright Reserved 22
Suppose the income for the 3 shops is known and the prices
of the items are the same at the 3 shops.
Shop Income
1 162
2 114
3 80
To calculate the prices for the items we need to solve for the
following linear equations: 89� + 49� + 109� = 162 29� + 39� + 149� = 114 59� + 09� + 69� = 80
or (: = � such that �8 4 102 3 145 0 6 ��9�9�9�� = �16211480 �. The following is given: |(| = 226 and (@� = ����� 9 −12 1329 −1 −46−7.5 10 8 �.
Use the information and calculate the following:
1. Test if (@� is the inverse matrix of S.
Copyright Reserved 23
2. Calculate the price of a flag by using Cramer’s rule.
3. Calculate the price of a flag by using the inverse matrix.
Copyright Reserved 24
Excel functions for Matrix Algebra:
Calculating the transpose of a matrix using Excel.
Formula worksheet:
Press Ctrl + Shift + Enter
Value worksheet:
Copyright Reserved 25
Calculating the determinant of a matrix using Excel.
Formula worksheet:
Press Enter
Value worksheet:
Copyright Reserved 26
Calculating the inverse of a matrix using Excel:
Formula worksheet:
Press Ctrl + Shift + Enter
Value worksheet:
Copyright Reserved 27
Multiplying two matrices using Excel:
Formula worksheet:
Press Ctrl + Shift + Enter
Value worksheet: