CHAPTER 02: LINEAR AND MATRIX ALGEBRA
by
Dr R. Netshikweta
University Of Venda
MAT 1249/1649
Second Semester 2024
[Link]@[Link]
1 / 21
Topic: Linear and Matrix Algebra
Objectives:
z Explains what is meant by a Matrix
z Shows how Matrices can be added, subtracted and
multiplied
z Explains what is meant by the Determinant and the Inverse
of a Matrix, and further shows how to calculate them
z Shows how Matrices can be used to solve system of linear
equations
2 / 21
What is a matrix?
Defn:
z A matrix is a set of numbers arranged in the form of a
rectangle and enclosed in brackets.
z The plural of matrix is matrices. For example,
A = 5 −3 −7 ,
1 2 3
1 −4 5
B= , and C = 2 4 6 .
7 0 −2
2 6 9
are all matrices
3 / 21
Terminologies
z Each number in a matrix is known as an element (or an
entry) of a matrix.
z A matrix whose elements are all zeros is called a zero
matrix. e.g
0 0
H=
0 0
z If a matrix has m rows and n columns, it is called an
m × n matrix (read as ”m by n matrix”).
e.g. Matrix A is a 1 × 3, B has size 2 × 3 and C has size 3 × 3.
z NB!! We refer to the size of a matrix by giving its
number of rows and number of columns, in that order.
4 / 21
Terminologies Cont...
z A matrix in which the number of rows equal to the
number of columns is called a square matrix.
e.g. Matrix C is a square matrix.
z A square matrix whose elements off the main diagonal are
zeros is called a diagonal matrix. For example,
−1 0 0
1 0 9 0
M= T = D= 0 8 0 .
0 1 0 0
0 0 −17
are all examples of diagonal matrices.
z A square matrix with 1’s on the main diagonal and zero’s
everywhere is called a Identity matrix.
e.g. Matrix M is an identity matrix.
z NB!! An identity matrix is often denoted by a capital
5 / 21
letter I.
Position of an Element in a Matrix
z The position of an element in a matrix is given by the row
and column containing the element.
z This is equally denoted using double subscript notation
aij where i is the row and j the element aij . For example,
recall matrix A, we have
a11 = 1, a12 = −4, a13 = 5,
a21 = 7, a22 = 0, a23 = −2,
z Two matrices are said to be equal if they have the same
size and their corresponding elements are equal, i.e, if
a11 a12 b11 b12
A= and B =
a21 a22 b21 b22
then A = B if a11 = b11 , a12 = b12 , a21 = b21 , and
6 / 21
a22 = b22 .
Matrix Manipulation
Addition and Subtraction of Matrices:
> Matrices may be added or subtracted only if they have the
same size.
> Two matrices having the same size can be added or
subtracted by simply adding or subtracting the
corresponding elements.
1 2 5 2 1+5 2+2 6 4
+ = = .
3 4 1 0 3+1 4+0 4 4
Similarly,
1 2 5 2 1−5 2−2 −4 0
− = =
3 4 1 0 3−1 4−0 2 4
7 / 21
Matrix Manipulation Cont...
Scalar multiplication or division:
> A matrix is multiplied (divided) by a number (or scalar) by
multiplying (dividing) each element by that number.
> For example:
1 2 4×1 4×2 4 8
4 = = ,
3 −9 4 × 3 4 × (−9) 12 −36
and
− 31 × 1 − 13 × 2
1 1 2
− =
3 3 −9 − 3 × 3 − 13 × (−9)
1
1
− 3 − 23
=
−1 −3
8 / 21
Matrix Manipulation Cont...
Multiplying two matrices together:
> Two matrices can only be multiplied together if the
number of columns in the first is the same as the number
of rows in the second.
> Here, the corresponding entries from a ro and a column in
the respective matrices are multiplied together and the
resulting products are added. For example, given
2 −1 2 −3
A= and B =
3 4 5 1
> The number of columns in the first matrix is 2 and this is
the same as the number of rows in the second.
9 / 21
Matrix Manipulation Cont...
> We can therefore perform the multiplication and the
answer will have size 2 × 2.
> Thus,
2 −1 2 −3
AB =
3 4 5 1
(2)(2) + (−1)(5) (2)(−3) + (−1)(1)
=
(3)(2) + (4)(5) (3)(−3) + (4)(1)
−1 −7
=
26 −5
> Similarly, we can also perform the multiplication of BA
and the answer will still have size 2 × 2 but with different
10 / 21
entries compared to AB.
Matrix Manipulation Cont...
> Thus,
2 −3 2 −1
BA =
5 1 3 4
(2)(2) + (−3)(3) (2)(−1) + (−3)(4)
=
(5)(2) + (4)(5) (5)(−1) + (1)(4)
−5 −14
=
13 −1
> This shows that AB 6= BA, hence, in general, matrix
multiplication is commutative.
11 / 21
Exercise: Matrix Manipulations
> Exercise: consider the following matrices,
1 2 1 1 8 4
A= , B= and C =
3 5 −2 0 6 3
> Find:
(a) A + B (b)B + A (c)B − C
(d) C − B (e)AB (f )BA
(g) BC (h)CB (f ) − 4A
12 / 21
Determinant of a 2 × 2 Matrix
> Given a matrix
a b
A= ,
c d
we define the determinant of A to be ad − bc.
> We denote the determinant of A by |A|, det(A) or
2 −1
.
3 4
> Example: If
2 −1 1 −4
A= and B =
3 4 7 3
then det(A) = (2)(4) − (−1)(3) = 8 + 3 = 11 and
13 / 21
det(B) = (1)(2) − (−4)(7) = 2 + 28 = 30
Inversion of a 2 × 2 Matrix
> Definition: Let A be a 2 × 2 matrix. If there exists a 2 × 2
matrix B such that AB = BA = I, then B is called the
inverse of A.
> The inverse of A is always denoted by A−1 .
> Note that not all square matrices have inverse. A square
matrix has an inverse if and only if its determinant is not
zero.
> Example: Show that the inverse of
1 1 −1 −2 1
A= is A =
3 2 3 −1
1 −1 3 1
B= is B −1 =
−2 3 2 1
14 / 21
Inversion of a 2 × 2 Matrix Cont...
> Soln: We have to show that AA−1 = I and BB −1 = I:
−1 1 1 −2 1
AA =
3 2 3 −1
(1)(−2) + (1)(3) (1)(1) + (1)(−1)
=
(3)(−2) + (2)(3) (3)(1) + (2)(−1)
1 0
=
0 1
> Similarly,
−1 1 −1 3 1 1 0
BB = =
−2 3 2 1 0 1
15 / 21
Exercise: Matrix Inversion
> Show that the inverse of
1 2 −1 −7 2
A= is A =
4 7 4 −1
−3 1 −1 −1 1
B= is B =
−2 1 −2 3
> Determine B −1 if:
1 2 1 1
(i) B = (ii) B =
3 5 −2 0
8 4 −1 −1
(iii) B = (iv) B =
6 3 2 1
16 / 21
Application of matrices to solving simultaneous
equations
z Matrices are used in a variety of application, including
solving systems of linear equations
z A linear system can be written as an equation of the form
AX = B, where A, X and B are matrices.
z If the matrix A has an inverse A−1 , then the matrix
equation may be solved as follows:
AX = B
−1
A (AX) = A−1 B
(A−1 A)X = A−1 B
IX = A−1 B
X = A−1 B
17 / 21
Example: Application of matrices to solving
simultaneous equations
z Example: Use the inverse matrix to solve the following
system of linear equations:
2x + y = 6
−4x + 2y = 12
z Soln: We write the system in the form AX = B. Thus,
2 1 x 6
=
−4 2 y 12
where
2 1 x 6
A= ; X= ; and B =
−4 2 y 12
18 / 21
Example: Application of matrices to solving
simultaneous equations Cont...
z The solution to our given system of quations is:
X = A−1 B
z Now, given
2 1
.
−4 2
z Then
1 2 −1
A−1 =
(2)(2) − (−4)(1) 4 1
1 2 −1
=
8 4 2
1
− 18
= 4
1 1
19 / 21 2 4
Example: Application of matrices to solving
simultaneous equations Cont...
z Finally,
1
− 81
x 4 6
X= = 1 1
y 2 4 12
1 1
(6) − (12)
4 8
=
1 1
(6) + (12)
2 4
0
=
6
z Therefore, the solution to the system is x = 0 and y = 6.
20 / 21
Exercise: Application of matrices to solving
simultaneous equations
> Use matrices to solve the following simultaneous
equations:
(a) 2x + 3y = −2; 3x + 5y = 6
(b) 2x + 3y = 12; 3x + 5y = 15
(c) 2x + 3y = 6; 4x + 6y = 12
(d) 2x − 3y = 1; x + 2y = −3
(e) 3x + y = −2; 3x + y = 3.
21 / 21