Topic 2 Matrices and System of Linear Equations
Topic 2 Matrices and System of Linear Equations
9 8 7
6 5 4
3 2 1
7
4
1
31
21
11
=
=
=
a
a
a
8
5
2
32
22
12
=
=
=
a
a
a
9
6
3
33
23
13
=
=
=
a
a
a
Elements of matrix A:
Types Of Matrices
Equality of Matrices
Introduction
(
(
(
6 7 2 3 7
8 9 5 1 1
3 6 4 0 2
TYPES OF MATRICES
(
(
(
3 4 10
2 0 0
3 1 8
| | 0 7 5 9
(
0 0
0 0
(
(
(
(
6
0
7
9
3 x 3
3 x 5
2 x 2
4 x 1
1 x 4
(zero
Matrix)
(Column
matrix)
(square
matrix)
(called a row
matrix)
(rectangular
matrix)
TYPES OF MATRICES
3 x 3
3 x 3
3 x 3
3 x 3
3 x 3
(lower triangular
matrix)
(identity matrix)
(diagonal
matrix)
(scalar matrix)
(upper triangular
matrix)
(
(
(
7 0 0
0 3 0
0 0 1
(
(
(
7 0 0
0 3 0
0 0 1
(
(
(
7 0 0
0 3 0
0 0 1
Equality of Matrices
Two matrices are equal if they
have the same order and same
entries.
Example
Exercises
1. Find the value of x and y for the following: [MO1]
(a)
(b)
(c)
(d)
(
=
(
4 3
5 0
3
5
y
x
(
=
(
+ +
10 2
4 3
5 2
3
y
x y x
(
=
(
y
x
3 2
2 1
9 2
1
(
(
(
=
(
(
(
+
z
y
y
x
x 4
3 2
2
Algebraic Operations
Addition/Subtraction
Additions or subtractions of matrices can
be done if they have the same dimensions
whereby the two matrices must have the
same number of rows and the same
number of columns.
When two matrices are added or
subtracted then the order of matrix
should be the same.
(
=
3 1 0
2 2 1
A
(
=
4 1 2
4 0 3
B
(
= +
2
B A
If A and B are both m n matrices then the sum of A and B,
denoted A + B, is a matrix obtained by adding corresponding
elements of A and B.
add these
(
=
3 1 0
2 2 1
A
(
=
4 1 2
4 0 3
B
(
= +
2 2
B A
add these
(
=
3 1 0
2 2 1
A
(
=
4 1 2
4 0 3
B
(
= +
6 2 2
B A
add these
(
=
3 1 0
2 2 1
A
(
=
4 1 2
4 0 3
B
(
= +
2
6 2 2
B A
add these
(
=
3 1 0
2 2 1
A
(
=
4 1 2
4 0 3
B
(
= +
0 2
6 2 2
B A
add these
(
=
3 1 0
2 2 1
A
(
=
4 1 2
4 0 3
B
(
= +
1 0 2
6 2 2
B A
add these
Example :
A + B = C
(
=
(
+
(
12 10
7 1
8 7
5 0
4 3
2 1
Multiplication
Scalar Multiplication
Example :
A =
2A =
=
(
4 7
7 1
(
4 7
7 1
2
(
8 14
14 2
To multiply matrices A and B
look at their dimensions
p n n m
MUST BE SAME
SIZE OF PRODUCT
If the number of columns of A does not
equal the number of rows of B then the
product AB is undefined.
Multiplication of Two Matrices
Necessary condition for matrix multiplication
Column of first matrix should be equal to the row
of the second of matrix.
Example :
(
0 0
2 1
0 4
3 2
(
+ +
+ +
0 0 2 4 0 0 1 4
0 3 2 2 0 3 1 2
(
8 4
4 2
x
+
The multiplication of matrices is easier shown than put
into words. You multiply the rows of the first matrix
with the columns of the second adding products
(
=
1 4 0
1 2 3
A
(
(
(
=
1 3
3 1
4 2
B
Find AB
First we multiply across the first row and down the
first column adding products. We put the answer in
the first row, first column of the answer.
( ) 2 3( ) ( )( ) 1 2 2 3 + ( )( ) ( )( ) ( )( ) 5 3 1 1 2 2 3 = + +
(
=
1 4 0
1 2 3
A
(
(
(
=
1 3
3 1
4 2
B
Find AB
We multiplied across first row and down first column
so we put the answer in the first row, first column.
(
=
5
AB
Now we multiply across the first row and down the second
column and well put the answer in the first row, second
column.
( )( ) 4 3 ( )( ) ( )( ) 3 2 4 3 + ( )( ) ( )( ) ( )( ) 7 1 1 3 2 4 3 = + + (
=
7 5
AB
Now we multiply across the second row and down the first
column and well put the answer in the second row, first
column.
( )( ) 2 0 ( )( ) ( )( ) 1 4 2 0 + ( )( ) ( )( ) ( )( ) 1 3 1 1 4 2 0 = + +
(
=
1
7 5
AB
Now we multiply across the second row and down the
second column and well put the answer in the second row,
second column.
( )( ) 4 0 ( )( ) ( )( ) 3 4 4 0 + ( )( ) ( )( ) ( )( ) 11 1 1 3 4 4 0 = + +
(
=
11 1
7 5
AB
Notice the sizes of A and B and the size of the product AB.
(
(
(
=
6
BA
(
(
(
=
12 6
BA
(
(
(
=
2 12 6
BA
(
(
(
= 3
2 12 6
BA
(
(
(
= 14 3
2 12 6
BA
(
(
(
= 4 14 3
2 12 6
BA
(
(
(
=
9
4 14 3
2 12 6
BA
(
(
(
=
10 9
4 14 3
2 12 6
BA
(
(
(
=
4 10 9
4 14 3
2 12 6
BA
Now lets look at the product BA.
(
(
(
=
1 3
3 1
4 2
B
(
=
1 4 0
1 2 3
A
BA AB=
23
32
across first row as
we go down first
column:
( )( ) ( )( ) 6 0 4 3 2 = +
across first row as
we go down
second column:
( )( ) ( )( ) 12 4 4 2 2 = +
across first row as
we go down third
column:
( )( ) ( )( ) 2 1 4 1 2 = +
across second row
as we go down
first column:
( )( ) ( )( ) 3 0 3 3 1 = +
across second row
as we go down
second column:
( )( ) ( )( ) 14 4 3 2 1 = +
across second row
as we go down
third column:
( )( ) ( )( ) 4 1 3 1 1 = +
across third row
as we go down
first column:
( )( ) ( )( ) 9 0 1 3 3 = +
across third row
as we go down
second column:
( )( ) ( )( ) 10 4 1 2 3 = +
across third row
as we go down
third column:
( )( ) ( )( ) 4 1 1 1 3 = +
Completely different than AB!
Commuter's Beware!
Computation: A x B = C
A =
2 3
1 1
1 0
(
(
(
and B =
1 1 1
1 0 2
(
(
[3 x 2] [2 x 3]
A and B can be multiplied
(
(
(
=
(
(
(
= + = + = +
= + = + = +
= + = + = +
=
1 1 1
3 1 2
8 2 5
1 2 * 0 1 * 1 1 0 * 0 1 * 1 1 1 * 0 1 * 1
3 2 * 1 1 * 1 1 0 * 1 1 * 1 2 1 * 1 1 * 1
8 2 * 3 1 * 2 2 0 * 3 1 * 2 5 1 * 3 1 * 2
C
[3 x 3]
Computation: A x B = C
(
(
(
=
(
(
(
= + = + = +
= + = + = +
= + = + = +
=
1 1 1
3 1 2
8 2 5
1 2 * 0 1 * 1 1 0 * 0 1 * 1 1 1 * 0 1 * 1
3 2 * 1 1 * 1 1 0 * 1 1 * 1 2 1 * 1 1 * 1
8 2 * 3 1 * 2 2 0 * 3 1 * 2 5 1 * 3 1 * 2
C
A =
2 3
1 1
1 0
(
(
(
and B =
1 1 1
1 0 2
(
(
[3 x 2] [2 x 3]
[3 x 3]
Result is 3 x 3
Exercises
1. A = B = C =
Find: [MO2]
(a) A + C
(b) C A
(c) 3A 2C
(d) A + 2C
(e) AB
(
2 0 1
0 4 3
(
(
(
4 3 1
5 1 0
2 1 6
(
1 2 3
5 1 2
Example:
A =
(
0 3
2 1
(
=
0 2
3 1
T
A
Example
Try this:
Determinant of Matrix
The determinant of matrix is a unique real
number for every square matrix. The
determinant of a square matrix is denoted by
Det A or .
Determinant of Matrix 2 x 2
Let us consider a 2 x 2 matrix :
(
=
22 21
12 11
a a
a a
A
21 12 22 11
a a a a A =
A
-
Example :
Find the value of the determinant for matrix A.
Solution :
(
=
5 9
7 3
A
) 9 7 ( ) 5 3 ( = A
48 =
Determinant for Matrix 3 x 3
Let us consider a 3 x 3 matrix :
(
(
(
=
33 32 31
23 22 21
13 12 11
a a a
a a a
a a a
A
32 31
22 21
13
33 31
23 21
12
33 32
23 22
11
a a
a a
a
a a
a a
a
a a
a a
a A + =
Should remember that | | is a sign of
the determinant
Example
(
(
(
=
5 1 2
2 1 4
3 2 1
A
A
Continue :
) 2 4 ( 3 ) 4 20 ( 2 ) 2 5 ( 1 + + +
35 =
Systems of Linear Equations [MO2]
A system of linear equations is a collection of two @ more
linear equations, each containing one or more variables.
The following is a system of three equations containing three
variables.
Using a matrix notation, we can write this system in simplified
form.
This is called the augmented matrix of the system.
5 3 2 2
16 2 3 4
1 2
=
= +
= +
z y x
z y x
y x
(
(
(
5
16
3
3 2 2
2 3 4
0 1 1
Matrix equation
5 3 2 2
16 2 3 4
1 2
=
= +
= +
z y x
z y x
y x
Exercise
Write the augmented matrix of each system. [MO2]
(a)
(b)
5 3 2
6 4 3
=
=
y x
y x
0 8 2
0 1
0 2
= +
= +
= +
y x
z x
z y x
Solving a system using Cramers Rule [MO2]
Consider the pair of simultaneous equations
Let the matrix of coefficient be , that is
Therefore by using Cramers Rule
for 2 x 2 Matrix
A
q dy cx
p by ax
= +
= +
(
=
d c
b a
A
A
d q
b p
X
(
=
A
q c
p a
Y
(
=
Example:
Solve the system by using Cramers Rule
8x+5y=2
2x-4y=-10
Continue:
By using Cramers Rule:
42
4 10
5 2
= x
42
10 2
2 8
= y
1
42
42
42
) 50 ( 8
42
4 10
5 2
=
= x
2
42
84
42
4 80
42
10 2
2 8
=
= y
Therefore, x = -1, and y = 2
Example:
Solve the system 3x - 2y + z = 9
x + 2y - 2z = -5
x + y - 4z = -2
Cramers Rule
x =
9 2 1
5 2 2
2 1 4
3 2 1
1 2 2
1 1 4
=
23
23
= 1 y =
3 9 1
1 5 2
1 2 4
3 2 1
1 2 2
1 1 4
=
69
23
= 3
Example, continued: 3x - 2y + z = 9
x + 2y - 2z = -5
x + y - 4z = -2
Cramers Rule
z =
3 2 9
1 2 5
1 1 2
3 2 1
1 2 2
1 1 4
=
0
23
= 0
The solution is
(1, -3, 0)
Three shops A, B, and C sells three
grades of T-shirts with the top grade
providing a profit of RMx a piece, and the
moderate and low grades providing profits
of RMy and RMz a piece respectively. On
a certain day, the number of the three
grades sold and the total profit of each of
the types are shown in the table below:
Example:
Grades of T-shirts
Profit
Shop Low Moderate Top
A 10 20 30 RM260
B 20 40 50 RM460
C 30 50 60 RM570
Use the Cramers Rule to find x, y, and z.
Solution:
Continue:
Exercise: