0% found this document useful (0 votes)
16 views40 pages

Matrix Algebra - ComMSc

Uploaded by

usj.dcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views40 pages

Matrix Algebra - ComMSc

Uploaded by

usj.dcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 40

M.Sc.

In Computer Science

Matrix
Algebra
Naleen Ganegoda
Department of Mathematics
University of Sri Jayewardenepura

1
Matrices
For what ?

• For better representation of information


• As a technique of solving a system of linear
equations

Let’s see some illustrations before going to the theories.

2
A static problem...

3
An electric circuit.... (Kirchhoff's laws)
The algebraic sum of currents in a network meeting at a point is zero.
The directed sum of the voltages around any closed loop is zero.

4
Learning outcomes
• Define a matrix
• Understand what is meant by the equality of two matrices
• Add and subtract two matrices
• Multiply a matrix by a scalar and multiply two matrices
together
• Obtain the transpose of a matrix
• Recognize special types of matrix
• Obtain the determinant, cofactors and adjoint of a square
matrix
• Obtain the inverse of a matrix
• Solve a set of linear equations using inverse matrices
• Eigenvalues and Eigenvectors

5
Matrices
Definition: A matrix is a set of numbers (or elements)
arranged in rows and columns to form rectangular array.

A matrix having m rows and n columns is called an mn


(i.e. ‘m by n’) matrix and is referred to as having
order mn .

e.g.  5 7 2  is a 23 matrix, i.e. a ‘2 by 3’ matrix.


 
 6 3 8

Note : Number of rows is stated first and the number of


columns second.

6
Ex: Find the order
 2  1
 
i.  5 9
 4 0 
 

 8 1 9
ii.  
 2 5 2

0 2 1 
 
iii .  4  2  1 
 7 1  6
 
7
Special Matrices
Row matrix: A row matrix consists of one row only.
eg. 4 2 3 4 is a row matrix of order 14.

Column matrix: A column matrix consists of one column


only.
eg.  6
 
 3  is a column matrix of order 31.
 8
 

Single element matrix: A single number may be regarded as


a 11 matrix, i.e. having 1 row and 1column.
eg. 3

8
Matrix notation
Double suffix notation: each element in a matrix has its own
particular ‘address’ or location which can be defined by a
system of double suffixes, the first indicating the row, the
second the column. Thus a 23 matrix has the notation:

 a11 a12 a13 


 
 a21 a22 a23 
eg. a12 indicates the element that belongs to the first row and
second column.

9
Matrix notation ctd…

A whole matrix can be denoted by a single general element


enclosed in brackets.

eg.
 a11 a12

a13 
  
can be denoted by aij or
 a21 a22 a23  23

simply by a 
ij

Similarly,  x1  x
can be denoted by  orx 
x  i 21 i
 2

10
Equality of Matrices
Two matrices are said to be equal if corresponding elements
throughout are equal.
 a11 a12   3  2 
So, if     
 a21 a22   4 1 

then a11 3 , a12  2 , a21 4 , a22 1

11
Addition & Subtraction of Matrices

To be added or subtracted, two matrices must be of the same


order. The sum or subtraction is then determined by adding or
subtracting corresponding elements.
eg.
 4 2 3   1 8 9   4 1 2  8 3  9   5 10 12 
          
 5 7 6   3 5 4   5  3 7  5 6  4   8 12 10 
and
 6 5 12   3 7 1   6  3 5  7 12  1  3  2 11
          
 9 4 8   2 10  5   9  2 4  10 8  5   7  6 13
12
Ex: Simplify the followings

i )1 4 2  1 3 0 

 3 4   2 3
ii )    
 1  8   3 8
 4 2 3 1 8 9
iii )    
 5 7 6  3 5 4
 7 4    6 7  1 2
iv )       
 1  7   5 8  3 7
13
Multiplication of matrices
There are two types of multiplication.

1. Scalar multiplication
2. Matrix multiplication

14
Multiplication of matrices ctd…

1. Scalar multiplication
To multiply a matrix by a single number (i.e. a scalar),
each individual element of the matrix is multiplied by
that number:
eg.
3 2 5   12 8 20 
4    
6 1 7   24 4 28 
In general,
k aij  kaij 
Ex:

 2 4 2   2  2  3
i ) 3   ii )  2  
  7 5  1 9 6 2 
15
Multiplication of matrices ctd…

2. Matrix multiplication
Two matrices can be multiplied together only when the
number of columns in the first is equal to number of
rows in the second.
 b1 
 
  a11 a a
 
eg. if 12 13 

and B  b2 
 a21 a a
22 23  b 
 3
Then,  b1 
B  a11
 a a13     a11 b1  a12 b2  a13 b3 
a23   b2   a21b1  a22 b2  a23 b3 
12

 a 21 a
 b3 
22

Here,
order (2 3) order (3 1)  order (2 1)
16
Matrix multiplication ctd…

eg.  5 4   2 1   (5 2)  (4 7) (5 1)  (4 6)   38 29 


         
 8 3   7 6   (8 2)  (3 7) (8 1)  (3 6)   37 26 

 3
Ex: i ) 2 6  
 5
 
2 5   3 5

ii )    
1  9 

 4 1
 2
3  4 2  
iii ) 
8 
  5
 7 5  
 0
 1 0 3
 
Ex: If A  2  1 4  , then find A 2.
  2 4 5
  17
Matrix multiplication ctd…

Matrix multiplication is generally not commutative. That is,


AB  BA in general.

eg.  1 2  0  1
A   B  
 3 4 6 7 

 10  2 6  1 1 2 7   12 13 


AB    
 3 0  4 6  3  1 4 7   24 25 

 0 1  13 0 2  14   3  4 


BA    
 6 1 7 3 6 2 7 4   27 40 
Thus, AB  BA
18
No matrix division please.........!

19
Transpose of a matrix
If the rows and columns are interchanged, then the new matrix
so formed is called the transpose of the original matrix.

Here, the 1st row becomes the 1st column, the 2nd row becomes
2nd column, etc.

If A is the original matrix, its transpose is denoted by A T .

eg.  3 1
 3 8  9
A    AT  8 0 
1 0 4  
    9 4

21
More special matrices
Square matrix: a matrix whose number of rows and
number of columns are equal.
eg. 

1 2 5

6 8 9
1 7 4
 

Symmetric matrix: a square matrix ( aij ) whose aij a ji .


Thus, it is symmetrical around the leading diagonal.
eg.  2 1 0 
1 3 6
0 6 7 

Note: For a symmetric matrix A, A A T .
In the case, T we call A as skew-
A  A
symmetric.
Ex: Write down an example for a 33 skew-symmetric 22
More special matrices ctd...

Diagonal matrix: a square matrix whose elements that do


not belong to the leading diagonal are zero.
eg.  5 0 0 
 
0 2 0
0 0 7 

Identity matrix (Unit matrix): a diagonal matrix in which


the elements on the leading diagonal are all unity (one).
eg.  1 0 
 
 0 1
The identity matrix is denoted by I .

Ex. Determine AI and IA for a given matrix A and see the


special feature there.
23
More special matrices ctd...
Null matrix (zero matrix): a matrix whose elements are
all zero.
eg.  0 0 0 
 
0 0 0

The null matrix is denoted by 0 .

Ex: Can we always claim A=0 or B=0 for a case of two


matrices A and B satisfying AB=0 ? See this with the
followings. 1 9 
 2 1 - 3  
A   B  4 - 6 
 6 3 - 9 2 4 
 

24
Determinant of a square matrix
The determinant of a square matrix is the determinant having the same
elements as those of the matrix.

 2 1 2 1
e.g. Determinant of   is which has the value 8.
 4 6 4 6

Determinant of a square matrix A is denoted by |A| or det A .


If |A|=0, then A is called a singular matrix.

ex. Evaluate the determinants of the following matrices

2 0 0
1 2 1 0  
i)   ii)   iii)  0 3 0
 -1 3 0 1 0 0 5 

iv) Show that A  A T for any square matrix A.

Result: If A and B are two square matrices of same order, then |AB| = |A| |B|.
Cofactors of a square matrix
Each element of a square matrix has a cofactor, which is simply the minor of the element in the
determinant together with its place sign.

2 3 5
 
eg. Let A  4 1 6 .
1 4 0 

1 6
Cofactor
Try to find all theof is 
other2cofactors.  24
4 0
4 6
Cofactor of 3 is  6
1 0
Adjoint of a square matrix
Adjoint of a matrix A is a matrix which is formed by the
transpose of the matrix of cofactors of A .

 a11 a a 
 12 13 
eg. A  a 21 a 22 a23

 
 a31 a 32 a33 

 A11 A12 A13 


 
Let C  A21 A22 A23  where A ij is the cofactor of aij .
 
 A31 A32 A33 
C is the matrix of cofactors of A.
Now, the transpose of C (ie. C T ) is called the adjoint of A
and it is denoted by adj A.
Adjoint of a square matrix ctd…
 2 3 5
 
eg. A  4 1 6 
 1 4 0
 
Matrix of cofactors
 - 24 6 15 
 
C  20 - 5 - 5 
 13 8 - 10 
 
 - 24 20 13 
T
 
Then, adj A C  6 - 5 8 
 15 - 5 - 10 
 
Ex : Find the adjoints of the following matrices.
 5 2 4 4 1 8 
   
i)  3 1 2  ii)  9 3 10 
 7 8 4 7 0 1 
   
Inverse of a square matrix

A square matrix A is said to be invertible if there exists a


matrix B such that
AB = BA = I, where I is the identity matrix.

Here, matrix B is unique (only one of such exists).

1
B is called the inverse of A and denoted by A .
Finding the inverse
Method 1
 2 5
eg. Find the inverse of A  
 1 3
Thus, we have to find B such that AB I.
 2 5  a b   1 0 
     
 1 3  c d   0 1 
 2a  5c 2b  5d   1 0 
   
 a  3c b  3d   0 1 
2a  5c 1 , a  3c 0  a 3, c -1
2b  5d 0 , b  3d 1  b -5, d 2
1  3  5
Inverse of A : A  
 1 2 
Finding the inverse ctd…
Method 2
1
-1
Using the formula A  adj A .
A
Remark : In case A 0, A is not invertible
eg.
 2 3 5  - 24 20 13 
   
A  4 1 6   adj A  6 - 5 8  and A 45
 1 4 0  15 - 5 - 10 
   
 - 24 20 13 
 
 - 24 20 13   45 45 45 
-1 1 1    6 -5 8 
 A  adj A   6 - 5 8  
A 45   45 45 45 

 15 - 5 - 10   15 -5 - 10 
 
 45 45 45 
Result: If A and B are invertible, then (AB) 1 B  1A  1.

Ex: Find the inverse of the following matrices, if exists

 2 3   1 0 1 4
i)   ii)   iii)  
 4 5  0 2 2 8
2 7 4   1 2 3
   
iv)  3 1 6  v)  4 1 5
5 0 8   6  4 2
  
Solving a system of linear equations using
matrix inverse.
eg. 2 x  5 y 1
x  3 y 4
 2 5  x   1 
       (matrix representa tion of the system)
 1 3  y   4 
This is of the type Ax b, where
 2 5  x  1
A   , x   , b  
 1 3  y  4
Solving a system using matrix inverse ctd…

Ax b
multiply both sides by A  1
A  1Ax A  1 b
(A  1A)x A  1b
I x A  1b
x A  1b
Then, the solution of the system can be obtained by A  1b
 3  5   1    17 
Then, x      
  1 2  4   7 
 x   17 
i.e.    
 y  7 
x  17 , y 7.
Ex: Solve the following systems using matrix inverse.

i) 2 x  3 y  8 ii) x  2 y  z 4
3 x  4 y 5 3 x  4 y  2 z 2
5 x  3 y  5 z  1
iii) 2 x1  x2  3 x3 2
x1  3 x2  x3 11
2 x1  2 x2  5 x3 3
Eigenvalues and Eigenvectors
Equation of the form Ax = λx, (where A is a square matrix, x
is a column matrix and λ is a number) can be seen in many
technological applications involving oscillation, vibration,
chemical bonds etc.

For Ax = λx, x = 0 is obviously a solution (trivial solution),


which is not practically useful. For non-trivial (i.e. x≠0)
solution, the values of λ are called eigenvalues of matrix A.

Here, corresponding solution for x are called eigenvectors.


Finding the eigenvalues
Ax = λx  (A- λI)x = 0

see the incorporation of I (identity matrix) and 0 (null matrix) with


suitable orders.

Now, we want the following result to go ahead.

Result : For the above set of homogeneous linear equation (i.e. right-hand
constants all zero) to have a non-trivial solution, |A- λI| must be zero.

|A- λI | ― characteristic polynomial of A.


|A- λI | = 0 ― characteristic equation of A.

Solutions of |A- λI | = 0 are the eigenvalues of A.


Finding the eigenvalues ctd…
4  1
e.g. Find the eigenvalues of A  
2 1 

Characteristic equation: | A  I | 0

4  1  1 0  4    1 
A  I        
2 1   0 1  2 1 
4  1
A  I 0  0
2 1 
(4   )(1   )  2 0
2  5  6 0
 2 or  3

Then, eigenvalues are 2 & 3.


Finding eigenvectors
Each eigenvalue has a corresponding solution of x which is called
eigenvector.
 4  1
eg. Find the eigenvectors of A  
2 1
Here, eigenvalues are 2 & 3. (earlier example)
For the eigenvector corresponding to λ=2,

 4  1  x1   x1 
Ax x      2  
 
 2 1   x2   x2 
 4 x1  x2 2 x1 (consideri ng the 1st row)
2 x1  x2 0

 2 x1  x2 2 x2 (consideri ng the 2 nd row)


2 x1  x2 0
Finding eigenvectors ctd…
So, x2 is twice of x1 , whatever the value of x1 .
 k 
Then,  2k  is the general form of the eigenvector corresponding
 
to λ=2, where k be any number.

Try to show that the general form of eigenvector corresponding


to λ=3 is  k  .
k
 
Ex: Find the eigenvalues and the corresponding eigenvectors of the
following matrices.
 4 1  1 3
i)   ii)  
 3 2  4 5
 1  1 0   2 0 1 
   
iii)  1 2 1  iv)   1 4  1
 2 1  1  1 2 0 
 

You might also like