You are on page 1of 19

2022-2023

Mathematics Chapter1 First stage

Chapter 1
Matrix
Lecturer: Sirwan Gh. Salim

Matrices, and Vectors


A matrix is simply a rectangular (or square) array of numbers
arranged in rows and columns. The entries in a matrix are termed
elements of the matrix. A general representation of a matrix (we’ll
call it A) would be:

 a11 a12 a13  a1 j 


a  a2 j 
 21 a22 a23
A  a31 a32 a33  
 a3 j   aij
 
      
 ai1 ai 2 ai 3  aij 

Where the a’s represent the elements of the matrix. The elements
of a matrix are usually enclosed in brackets, as above. The
subscripts i and j are used here to emphasize that the first number
in a matrix element’s subscript represents its row number and the
second represents its column number. Examples of matrices
include:

 5 0 0.33  a 33 matrix;


1  3 a 22 matrix; an
 0.26 13
2 7.2 : example of a  0  : another square
  square matrix.
 4.91 6  1.35 matrix.

8 2.5  a 32
 6  3 1 a 23
 0  1.1 :
 2 0 9 : rectangular   rectangular
  matrix  5  3  matrix

 9.1 
 2.7  a 41 matrix;
 8 0 1.4  1.3 a 14 matrix; an
example of a  : an example of
: row vector.  0.7  a column
  vector.
 2.3 

1
2022-2023
Mathematics Chapter1 First stage

Diagonal Matrices
This is special form of square matrices. The elements of a matrix for which i
= j are referred to as the diagonal elements of the matrix, while the other
elements (i  j) are referred to as the off-diagonal elements. Thus, in the
matrix

9 3 6
A  1 7 9
0 7 2

The diagonal elements are 9, 7, and 2. A specific type of diagonal


in which all of the off-diagonal elements are zero is termed a
diagonal matrix:
9 0 0
A  0 7 0
0 0 2

Triangular matrices
This is special form of square matrices which come in two forms:
upper triangular, in which all of the elements below the diagonal
are zero,
9 3 6
A  0 7 9
0 0 2

And lower triangular, in which zeros comprise all of the elements


above the diagonal:
9 0 0
A  1 7 0
0 7 2

The Identity Matrix


One especially important diagonal matrix is termed the identity
matrix. The identity matrix is, of course, always a square matrix,
and its diagonal elements are all ones, while its off-diagonal
elements are all zeros. A 44 identity matrix would thus look like
this:
2
2022-2023
Mathematics Chapter1 First stage

1 0 0 0
0 1 0 0
I 
0 0 1 0
 
0 0 0 1

The identity matrix is the functional equivalent of the number 1,


because multiplying a matrix by an identity matrix yields the same
matrix. i.e., AI  A .

Matrix Addition & Subtraction:


Matrix addition is straightforward. Mathematically, we express C =
A + B as

cij  aij  bij 
Meaning you simply sum the corresponding elements of A and B to
get the elements of C. Thus, if
1 2 3 4 5  6
  
A  4 5 6 and B   7 8 9  ,
7 8 9  1  2 3 

Summing the two matrices yields


 a11  b11 a12  b12 a13  b13  1  4 2  5 3  6  5 7  3
C  A  B  a 21  b21 a 22  b22 a 23  b23   4  7 5  8 6  9   3 13 15 
 a31  b31 a32  b32 a33  b33   7  1 8  2 9  3  8 6 12 

For subtraction, you simply subtract the corresponding


elements:
 a11  b11 a12  b12 a13  b13   1  4 2  5 3  (6)  3  3 9 
D  A  B  a 21  b21 a 22  b22  
a 23  b23   4  (7) 58 6  9    11  3  3
 a31  b31 a32  b32 a33  b33   7  1 8  (2) 9  3   6 10 6 

Example: Calculate A  B and A  B for the following:


7 8 2 8 4 2
A  9 2 3, B  8 4 9
 
1 6 4 3 1 6

3
2022-2023
Mathematics Chapter1 First stage

Solution:
Matrix addition & subtraction
15 12 4 
A  B  17 6 12
 4 7 10
1 4 0 
A  B   1  2  6

 2 5  2

Matrix Multiplication:

Scalar Multiplication
In linear algebra, individual numbers are referred to as scalars.
Multiplication of a matrix by a scalar proceeds element-by-
element, with the scalar being multiplied by each element in turn.
Mathematically, we express multiplication of a matrix A by a scalar
as: cA  caij   caij 
Where c is the scalar, thus, multiplication by the scalar 3 is
accomplished as:
 3 1  3  3 3  1  9 3
3   
1.7 2 3  1.7 3  2 5.1 6
Multiplication of Matrices
If C is a matrix resulting from the multiplication of two matrices, A
and B, then the elements cij of C are given by:
n
cij   aik bkj Equation 1
k 1

Where k = 1, 2,…, n is the number of columns in A and the


number of rows in B. Look carefully at the subscripts of a and b,
and note that Equation 1 requires that the number of columns
in the left-hand matrix must be the same as the number of
rows in the right-hand matrix. Also note that Equation 1 tells
us that the product matrix has i rows and j columns.
4
2022-2023
Mathematics Chapter1 First stage

 a11 a12 a13  b11 b12 b13 


A  a 21 a 22 a 23  and B  b21 b22
 b23  ,
a31 a32 a33  b31 b32 b33 

Then n = 3, and the product C = AB is defined by Equation 1 as:

 a11b11  a12b21  a13b31 a11b12  a12b22  a13b32 a11b13  a12b23  a13b33 


AB  a21b11  a22b21  a23b31 a21b12  a22b22  a23b32 a21b13  a22b23  a23b33 
 a31b11  a32b21  a33b31 a31b12  a32b22  a33b32 a31b13  a32b23  a33b33 
In other words, you multiply each of the elements of a row in the
left-hand matrix by the corresponding elements of a column in the
right-hand matrix (that’s why the number of elements in the row
and the column must be equal), and then sum the resulting n
products to obtain one element in the product matrix.
The choice of the row and column to be used in the multiplication
and summation is based on which element of the product matrix
(C) that you wish to calculate:
 The left-hand matrix row you work with is the same as
the row of the product matrix element you wish to
calculate.
 The right-hand matrix column you work with is the same
as the column of the product matrix element you wish to
calculate.
For example, suppose you define the matrix C as the product of
the two 33 matrices, A and B, shown above. If you wish to
calculate the value of c11 ,
c11 c12 c13 
c c23 
 21 c22
c31 c32 c33 

You work element-by-element across the first row of the left-hand


matrix and element-by-element down the first column of the right-
hand matrix as follows:
5
2022-2023
Mathematics Chapter1 First stage

 a11 a12 a13  b11 b12 b13 



c11  a 21 a 22 a 23  b b23   c11  a11b11  a12 b21  a13b31
 21 b22
a31 a32 a33  b31 b32 b33 

Similarly, to calculate the value of c23


 c11 c12 c13 
c c 22 c 23 
 21
c31 c32 c33 

You work across the second row of the left-hand matrix and down
the third column of the right-hand matrix:

 a11 a12 a13  b11 b12 b13 


c 23  a 21 a 22 a 23  b b23   c23  a 21b13  a 22 b23  a 23b33
  21 b22
a31 a32 a33  b31 b32 b33 

Example: find the product of two matrices, A and B. Let


1 2 3  4 5 6
A  4 5 6 and B  7 8 9 .
 
7 8 9 1 2 3

Solution:
We first note that multiplication of A by B is allowed by Equation 1
because the number of columns in A is the same as the number of
rows in B, which allows us to calculate C = AB as:
1 2 3 4 5 6
C  AB  4 5 6 7 8 9
7 8 9 1 2 3

1* 4  2 * 7  3 *1 1* 5  2 * 8  3 * 2 1* 6  2 * 9  3 * 3 
 4 * 4  5 * 7  6 *1 4 * 5  5 * 8  6 * 2 4 * 6  5 * 9  6 * 3
7 * 4  8 * 7  9 *1 7 * 5  8 * 8  9 * 2 7 * 6  8 * 9  9 * 3

 21 27 33 
 57 72 87 
93 117 141

6
2022-2023
Mathematics Chapter1 First stage

Practice Problems:
For each of the following, determine whether the indicated
multiplication is allowed and, if it is, calculate the corresponding
product matrix:
2 1 3  1 6 1 
a. 1 8 3  3 5 3 
5 7 1  2 4  9

 4 3 1  5 
b. 2 2 2 4
1 4 3 3

5   4 3 1 
c. 4 2 2 2
3 1 4 3

2 3  2  0.75
d.   
4 8  1 0.5 
1  2 6 5 3
e.   
2 5 1.3 5 5 1
Matrix Multiplication
a. Multiplication is allowed:
 5 29  22
answer =  17 58  2 
 14 69 17 

b. Multiplication is allowed:
35
answer = 24
30

c. Multiplication is not allowed.


d. Multiplication is allowed:
1 0
answer =  
0 1 

7
2022-2023
Mathematics Chapter1 First stage

e. Multiplication is not allowed.


Solution of a system of Linear equations using matrices:

Linear Equation in (n) variables:


a1 x1  a2 x2  a3 x3  ....  an xn  b
Where x1 , x2 , x3 ,..., xn are variables and
a1 , a2 , a3 ,..., an and b are constants.

Linear System:
A Linear System of m linear equations and (n) unknowns is:
a11 x1  a12 x2  a13 x3  ....  a1n xn  b1
a21 x1  a22 x2  a23 x3  ....  a2 n xn  b2
a31 x1  a32 x2  a33 x3  ....  a3n xn  b3
.......... .......... .......... .......... .......... .....
.......... .......... .......... .......... .......... .....
.......... .......... .......... .......... .......... ......
am1 x1  am 2 x2  am 3 x3  ....  amn xn  bm

The matrix representation is


𝐴𝑥 = 𝑏
 a11 a12  a1n   x1   b1 
a  a2 n   x2   b2 
 21 a22 
          
    
am1 am 2  amn   xn  bm 
Where
 a11 a12  a1n   x1   b1 
a a22  a2 n  x  b 
A   21 , x   , b   2 
2

       
     
am1 am 2  amn   n
x bm 

Augmented matrix: augmented matrix is a matrix obtained by


adjoining matrix (b) to matrix (A)
8
2022-2023
Mathematics Chapter1 First stage

 a11 a12 a13 : b1 


A : b  a21 a22 a23 : b2 
Augmented matrix is
a31 a32 a33 : b3 

Example: Write the matrix and augmented form of the system of


linear equations

3x – y + 6z = 6
x + y +z = 2
2x + y+4z = 3

Solution: Matrix form of the system is

3 1
6   x  6 
1 11   y   2

2 14  z  3
 3  1 6 : 6
 
Augmented form is A : b  1 1 1 : 2  .
2 1 4 : 3

Determinant of Matrix
The determinant of the matrix A is denoted by |𝐴|,
If A is a (2*2) matrices, the determinant of the matrix can be
found as below:-
3 2
Example: 𝐴 = | | 𝑡ℎ𝑒𝑛 |𝐴| = (−9 − 10) = −19
5 −3

Minor:
Minor: the minor of an element in determinant is a determinant
removing the rows and columns which pass through that element.
9
2022-2023
Mathematics Chapter1 First stage

𝑎11 𝑎12 𝑎13


𝑎 𝑎23
𝐴 = [𝑎21 𝑎22 𝑎23 ] ; 𝑚𝑖𝑛𝑜𝑟 𝑜𝑓 𝑎12 = | 21
𝑎31 𝑎33 |
𝑎31 𝑎32 𝑎33

Example: Find the minor of the element (-3, 4)


𝟏 𝟐 𝟎
𝑨 = [−𝟑 𝟏 −𝟏]
𝟐 𝟒 −𝟏
𝟐 𝟎
𝒎𝒊𝒏𝒐𝒓 𝒐𝒇 𝒆𝒍𝒆𝒎𝒆𝒏𝒕(−𝟑) = | |
𝟒 −𝟏
𝟏 𝟎
𝒎𝒊𝒏𝒐𝒓 𝒐𝒇 𝒆𝒍𝒆𝒎𝒆𝒏𝒕(𝟒) = | |
−𝟑 −𝟏

Finding Determinant of a (3 * 3) matrix

a21 a23 a a13 a a13


or   a12  a22 11  a32 11
a31 a33 a31 a33 a21 a23

  
By using   
  

10
2022-2023
Mathematics Chapter1 First stage

Example: find the determinant of the matrix A


 1 2 4 
A   1 1 13 
 2 6 1 
Solution:

1 13 1 13 1 1
| A | 1  (2) 4
6 1 2  1 2 6
 1(1  78)  2(1  (26))  4(6  (2))  3
Note:
1- If all elements of a matrix above the principal diagonal (or
below the principal diagonal) are zero, then the value of the
determinant is the product of the elements on the principal
diagonal.
𝟓 𝟔 −𝟏
𝑩 = [𝟎 𝟏 𝟑]
𝟎 𝟎 𝟐
𝑑𝑒𝑡𝑒𝑟𝑚𝑖𝑛𝑎𝑛𝑡 𝐴 = |𝐴| = 5 ∗ 1 ∗ 2 = 10
𝟏 𝟎 𝟎
𝑪 = [𝟐 𝟓 𝟎]
𝟎 −𝟏 𝟐
𝑑𝑒𝑡𝑒𝑟𝑚𝑖𝑛𝑎𝑛𝑡 𝐶 = |𝐶| = 1 ∗ 5 ∗ 2 = 10

2- The value of a determinant remains unchanging if the


element of a row or column is changed by adding to then any
multiple of the corresponding elements in any other row (or
column).

𝟐 𝟏 𝟎
𝑨 = [𝟑 −𝟏 −𝟐] 𝒊𝒇 𝟐𝑹𝟐 + 𝑹𝟑 → 𝑹𝟑
𝟐 𝟑 𝟏
2 1 0
𝐴 = [3 −1 −𝟐]
8 1 −𝟑

H.W: For the same matrix, 𝒊𝒇 𝑹𝟐 + 𝟑𝑹𝟏 → 𝑹𝟐

𝒊𝒇 𝑹𝟐 + 𝟓𝑹𝟏 → 𝑹𝟐
11
2022-2023
Mathematics Chapter1 First stage

Example: find the determinant of the matrix A (4*4)

1 −2 3 1
2 1 0 2
𝐴=| |
−1 2 1 −2
0 1 2 1

Solution:

1 −2 3 1
2 1 0 2
𝐴=| | −2𝑅1 + 𝑅2 → 𝑅2
−1 2 1 −2
0 1 2 1
𝑅1 + 𝑅3 → 𝑅3

1 −2 3 1
0 5 −6 0 1
𝐴=| | − 𝑅2 + 𝑅4 → 𝑅4
0 0 4 −1 5
0 1 2 1
1 −2 3 1
0 5 −6 0 4
𝐴 = ||0 0 4 −1|| − 𝑅3 + 𝑅4 → 𝑅4
5
16
0 0 1
5

1 −2 3 1
0 5 −6 0
|
𝐴 = |0 0 4 −1||
9
0 0 0
5
𝟗
|𝑨| = 𝟏 ∗ 𝟓 ∗ 𝟒 ∗ = 𝟑𝟔
𝟓

12
2022-2023
Mathematics Chapter1 First stage

Example: Solve the system of equations


x - 3y   3 1
2x  y  8 2
Solution:
From equation 1: 𝑥 = 3𝑦 − 3
Substitute the value of x in equation 2
2(3𝑦 − 3) + 𝑦 = 8
+7y = 14  y = 2
From equation 1
x = -3 +3y
x = -3 + 6 = 3
Solution is x = 3 and y = 2
Check Substitute the solution in Equations 1 and 2
Equation 1  3 – 3(2) = 3 – 6 = -3
Equation 2  2(3) +2 = 6 + 2 = 8

Methods for solving System of Linear equations


1- Gaussian Elimination Method
Gaussian elimination is one of the popular methods of solving
linear equations.
Example: Solve the system of linear equations by Gaussian-
elimination method

x1 + x2 + 2x3 = 8
- x1 - 2x2 + 3x3 = 1
3x1 - 7 x2 + 4x3 = 10

Solution: Augmented matrix is

1 1 2: 8
 1  2 3 : 1 
  R1+R2 R2
 3  7 4 : 10
-3R1+R3 R3

13
2022-2023
Mathematics Chapter1 First stage

1 1 2:8 
 5 : 9 
 0  1 -10R2+R3 R3
0  10  2 : - 14

1 1 2 : 8 
0  1 5 : 9 
  
0 0  52 : - 104

-52 x3 = -104 x3 =2

-1x2 +5x3 = 9 -1x2 +5 *2 = 9 x2 = 1

x1 + x2 + 2x3 = 8 x1 = 3

Solution is x1 = 3, x2 = 1, x3 = 2.

Example: Solve for x, y and z


x  2 y  6  4z

 x  13z  6  y
2 x  6 y  z  1

Solution:
Arrange the equations
X – 2y + 4z = 6
X + y + 13z = 6
-2x + 6y – z = -1
Augmented Matrix:

 1 2 4 6
 1 1 13 6  - R1 + R2 R2

 2 6 1 1

14
2022-2023
Mathematics Chapter1 First stage

 1 2 4 6
0 3 9 0  2 R1 + R3 R3

 2 6 1 1

1 2 4 6
0 3 9 0  𝑅3 −
2
𝑅2 → 𝑅3
 3
0 2 7 11

1 2 4 6
0 1 3 0 

0 0 1 11

Now by backward substitution to solve for variables:

𝑧 = 11 , 𝑦 + 3(11) = 0 → 𝑦 = −33 , 𝑥 − 2(−33) + 4(11) = 6 → 𝑥 = −104

2- Cramer’s Rule

Cramer’s rule is a method of solving a system of linear equations


through the use of determinants.

Given the system

This system has the unique solution

15
2022-2023
Mathematics Chapter1 First stage

Example 1: Solve (using Cramer’s Rule)

3x  2 y  1
5 x  3 y  11

3 2 1 2
D  (9  10)  19 Dx   (3  22)  19
5 3 11 3
3 1
Dy   (33  5)  38
5 11

Dx 19 Dy 38
Now, x   1 and y   2
D 19 D 19

Example 2: Use Cramer’s Rule to solve the system:

4x - y + z = -5

2x + 2y + 3z = 10

5x – 2y + 6z = 1

Solution: We begin by setting up four determinants:

D consists of the coefficients of x, y, and z from the three


equations

is obtained by replacing the x-coefficients in the first column of


D with the constants from the right sides of the equations.

is obtained by replacing the y-coefficients in the second column of D with the


constants from the right sides of the equations.

16
2022-2023
Mathematics Chapter1 First stage

is obtained by replacing the z-coefficients in the third column of D with the


constants from the right sides of the equations.

Next, we evaluate the four determinants:

= 4(12 – (-6)) + 1(12 – 15) + 1(-4 – 10)

= 4(18) + 1(-3) + 1(-14)

= 72 – 3 – 14

= 55

= -5(12 – (-6)) + 1(60 – 3) + 1(-20 – 2)

= -5(18)+1(57) + 1(-22)

= -90 + 57 – 22

= -55

= 4(60 – 3) + 5(12 – 15) + 1(2 – 50)

= 4(57) + 5(-3) + 1(-48)

= 228 - 15 – 48

= 165

17
2022-2023
Mathematics Chapter1 First stage

= 4(2 – (-20)) + 1(2 – 50) – 5(-4 – 10)

= 4(22) + 1(-48) – 5(-14)

= 88 – 48 + 70

= 110

Substitute these four values into the formula from Cramer’s Rule:

So, the solution is (-1, 3, 2).

18
2022-2023
Mathematics Chapter1 First stage

19

You might also like