You are on page 1of 57

I MATRIX ALGEBRA

INTRODUCTION TO MATRICES
R f
Reference : Croft
C ft & Davison,
D i Ch
Chapter
t 1212, Bl
Blocks
k 11,2
2

A matrix
t i is
i a rectangular
t l array or bl
block
k off numbers
b usually
ll
enclosed in brackets.

A m x n matrix has m rows and n columns.

Matrix Algebra Page 1


If the matrix A has m rows and n columns we can write:

 a11 a12  a1n 


a a22  a2n 
A  21

     
a  amn 
 m1 am2

where aij represents the number or element in the ith row and
jth column.

Matrix Algebra Page 2


Special Matrices
A square matrix has the same number of rows as columns.

The main diagonal of a square matrix is the diagonal


running from ‘top
top left’
left to ‘bottom
bottom right
right’.

An identity matrix,
matrix denoted by I,
I is a square matrix with
ones on the main diagonal and zeros elsewhere.
 1 0 0
 
I   0 1 0
 0 0 1
 
The transpose of A is obtained by writing rows as columns
and
d columns
l as rows, andd iis d t d AT.
denoted
Matrix Algebra Page 3
Equality of Matrices
If A = (aij) and B = (bij), A = B if and only if aij= bij.

Addition and Subtraction of Matrices


Matrices of the same size may be added to and subtracted
from one another. To do this, the corresponding elements
are added or subtracted
subtracted.

Matrix Algebra Page 4


3 5  7 6
 2 1 4 2 1, C3 9
e.g. 1 If A , B 
    
 3 0 2 4 2  1 5

find A + B, B + C and B - C.

A + B is not defined as A and B are not the same size.

3 5  7 6 10 11
B + C = 2 1  3 9  5 8
     
4 2  1 5  5 7

B–C=

Matrix Algebra Page 5


Multiplication of a Matrix by a Number
Any matrix can be multiplied by a number. To do this, each
element of the matrix is multiplied by that number.
 7 13 5 
 
e.g.2 If A   9 8 2  , find 2A, -A.
 4 11 8 
 
 2 * 7 2 * 13 2 * 5  14 26 10 
   
2A =  2 * 9 2 * 8 2 * 2   18 16 4 
 2 * 4 2 * 11 2 * 8   8 22 16 
   

-A =

Matrix Algebra Page 6


=
Multiplication of Matrices
If A is a m x n matrix and B is a p x q matrix. For the product
AB to exist we must have n = p, i.e.

BC
A  
mn pq mq

n p

Note that matrix


matri multiplication
m ltiplication is :
i. not commutative (i.e. AB  BA).
ii associative
ii. i ti [i[i.e. ABC = (AB)C = A(BC)]
A(BC)].
iii. If C = AB, the element cij is found from row i of A and
column
l j off B,
B as follows:
f ll
n
cijj   a ik bkjj
k 1

Matrix Algebra Page 7


4 7 6 1 2 37 33
AB  8 2 6  3 1  26 36
    
4 5 5 2 3 29 28
3
i.e. c21  a2k bk1  8 *1  2 * 3  6 * 2  26
k 1

Matrix Algebra Page 8


3 5 
 2 1 4 2 1 , find AB.
e g 3 If A  
e.g.  & B  AB
3 0 2  
4 2 

AB=

Note that when a square matrix is post- or pre-multiplied


by an identity matrix of the appropriate size the matrix is
unchanged, i.e.
AI = IA = A
Matrix Algebra Page 9
DETERMINANTS, INVERSE OF A MATRIX
Reference : Croft & Davison, Chapter 12, Blocks 3,4

Determinant
D t i t
All square matrices, A, possess a determinant denoted by :
d t(A) |A|.
det(A), |A|

Determinant of a 2 x 2 matrix

a b  a b
If A    , then det(A) = |A| = = ad - bc
c d  c d

A matrix which has a zero determinant is called singular.

Matrix Algebra Page 10


Minors and Cofactors of a 3 x 3 Matrix
Let aij be an element of a matrix A
A.

The minor of aij is the determinant formed by crossing out the ith
row and jth column of det(A).

The cofactor of aij = (-1)i+j x (minor of aij)

Note that the term (-1)i+j is called the place sign of the element
on the ith row and jth column.
column The following may help you to

  
memorize this.
 
  
  
 
Matrix Algebra Page 11
Determinant of a 3 x 3 Matrix
 a11 a12 a13 
 
Consider a general 3 x 3 matrix, A =  a21 a22 a23 
a a33 
 31 a32

det(A)
d t(A) can be
b calculated
l l t db by expanding
di along
l any row or
column. For example, expanding along the first row:

|A| = a11*(its cofactor) + a12*(its cofactor) + a13*(its cofactor)

Matrix Algebra Page 12


2 1 3 1 4 17
e g 1 Find the value of 1  1
e.g.1 1 and 11 24 5
1 4 2 6 31 15
2 1 3
1 1 1 1 1 1
1 1 1  2*  1*   3*
4 2 1 2 1 4
1 4 2
 2 * ( 2)  1 * 3  3 * 5  14

1 4 17
11 24 5 
6 31 15

Matrix Algebra Page 13


Alt
Alternatively,
ti l b by Rule
R l off Sarrus
S

Repeat the 1st and 2nd col


column
mn to right hand side of 3rd
column to form a 3 x 5 matrix.

det(A) = Add the product of SOLID diagonals from left top to


right bottom and subtract the products of DASH diagonals
from left bottom to right top.

Matrix Algebra Page 14


Hence
2 1 3 2 1 3 2 1
1 1 1  1 1 1 1 1
1 4 2 1 4 2 1 4
 2 * ( 1) * ( 2)  1 * 1 * 1  3 * 1 * 4
3 * ( 1) * 1  2 * 1 * 4  1 * 1 * ( 2)
 14

Matrix Algebra Page 15


Properties of Determinants
i. If every element of a given row (or column) of the square
matrix is multiplied by the same factor, the value of the
determinant is multiplied by that factor
ii If |B| is obtained by interchanged any 2 rows (or columns) of
ii.
|A|, then |B| = -|A|.
iii. Adding or subtracting a multiple of one row (or column) to
another row (or column) leaves the determinant
unchanged.
iv. If A a
and
dBaare
e 2 squa
square
e matrices
a ces a and
d that
a AB e exists,
s s, then
e
det(AB) = det(A)det(B).
v. If 2 rows or 2 columns of a square
q matrix are equal,
q , the
determinant of the matrix is zero.
Matrix Algebra Page 16
Inverse of a Matrix
The inverse matrix of a square matrix A, usually denoted by A-1,
has the property :
AA-1 = A-1A = I

|A| = 0, A does not have an inverse.


Note that if
|A|  0, A has an inverse

Matrix Algebra Page 17


Finding the Inverse of a Matrix
The followings are steps to find the inverse of a matrix A when
|A|  0,
i. Find the transpose of A, denoted AT.
ii Replace each element of AT by its cofactor
ii. cofactor. The resulting
matrix is called the adjoint of A, denoted adj(A).
iii
iii. 1adj
dj ( A)
A 
A

Matrix Algebra Page 18


2 1 3  3 1 0 
   
e g 2 Find the inverse of A   1  1 1  & B   5 2  1 
e.g.
1 4  2  1 6  3
   
det(A) =14
T
 1 1 1 1 1 1 
  
 4 2 1 2 1 4 
 2 14 4 
 1 3 
2 3 2 1  
adj ( A)       3 7 1 
 4 2 1 2 1 4  5  7  3
 1 3 2 3 2 1   
  
 1 1 1 1 1 1 
  2 14 4 
1 
A   3 7 1 
1

14  
 5  7  3 
Matrix Algebra Page 19
TYPES OF SOLUTIONS TO SYSTEM OF LINEAR EQUATIONS

When a system of linear equations is solved, there are 3


possible outcomes:
i. a unique solution
ii. an infinite number of solutions
iii. no solution

 2 x  3 y  3  2 3 3   x  3
i.    
  (unique
q solution)
0 x  y  1  0 1  1  y  1

Matrix Algebra Page 20



ii.  2 x  3 y  3   2 3 3   (infinite number of solutions)

4 x  6 y  6  0 0 0 

iii.  2 x  3 y  3   2 3 3   (no solution)


  0 0  1
0 x  0 y   1  

Matrix Algebra Page 21


CRAMER’S RULE
Reference : Croft & Davison, Chapter 13, Blocks 1, 2

Cramer’s rule is a method that uses determinants to solve a


system
t off linear
li equations.
ti

i. Two equations
q in 2 unknowns
 a1 x  b1 y  k1

If a2 x  b2 y  k 2
k1 b1 a1 k1
k 2 b2 a2 k 2 a1 b1
then x  a b , y  a b , provided d d that
h
a2 b2
0
1 1 1 1

a2 b2 a2 b2
Matrix Algebra Page 22
ii. 3 equations in 3 unknowns

 a1 x  b1 y  c1 z  k1 a1 b1 c1

If a2 x  b2 y  c2 z  k 2 where a2 b2 c2  0
a x  b y  c z  k
 3 3 3 3 a3 b3 c3

then
k1 b1 c1 a1 k1 c1 a1 b1 k1
k2 b2 c2 a2 k 2 c2 a2 b2 k2
k3 b3 c3 a3 k3 c3 a3 b3 k3
x , y , z
a1 b1 c1 a1 b1 c1 a1 b1 c1
a2 b2 c2 a2 b2 c2 a2 b2 c2
a3 b3 c3 a3 b3 c3 a3 b3 c3

Matrix Algebra Page 23


e.g.1
g Using
g Cramer’s rule,, solve for x,, yy.
 2x  5 y  3

7 x  2 y  9

Matrix Algebra Page 24


e.g.2 Using Cramer’s rule, solve for x, y and z.
 5 x  3 y  4 z  35

 2 x  5 y  3 z  12
 3 x  2 y  2 z  10

Matrix Algebra Page 25


INVERSE MATRIX METHOD

Writing System of Equations in Matrix Form

 a1 x  b1 y  k1
Note that 
a2 x  b2 y  k 2

 a1 b1  x   k1 
can be written as      
 a2 b 2  y   k 2 

This is called the matrix form of the simultaneous equations.


q

Matrix Algebra Page 26


 a1 x  b1 y  c1 z  k1

Similarly, a2 x  b2 y  c2 z  k 2
a x  b y  c z  k
 3 3 3 3

 a1 b1 c1  x   k1 
    
can also be written as  a2 b2 c2  y    k 2 
a c3  z   k3 
 3 b3

i
i.e. th generall matrix
the t i fform off a system
t off equations:
ti

AX = B

where A, X and B are matrices.

Matrix Algebra Page 27


Solving Equations Using the Inverse Matrix Method

Consider the matrix form: AX = B

A-1AX = A-1 B

I X = A-1 B

X = A-1 B

i.e. X can be found if A-1 exists.

Matrix Algebra Page 28


e.g.3 Redo example 1 and example 2 using the inverse
matrix method.

Matrix Algebra Page 29


GAUSSIAN ELIMINATION
Reference : Croft & Davison, Chapter 13, Block 3

Introduction
Gaussian Elimination is a systematic way of simplifying a
system of equations.
A matrix,, called an augmented
g matrix,, which captures
p all the
properties of the equations, is used.
A sequence of elementary row operations on this matrix
eventually brings it into a form known as echelon form (to be
discussed in Page 32)
32).
From this, the solution to the original equations is easily found.

Matrix Algebra Page 30


Augmented Matrix

Consider the system of equations,

 a1 x  b1 y  k1

a2 x  b2 y  k 2

it can be represented
p by
y an augmented
g matrix:

 a1 b1 k1 
 
a b k2 
 2
 2

coefficients constants
this vertical line can be
omitted as in your textbook

Matrix Algebra Page 31


Similarly, the following system of equations:

 a1 x  b1 y  c1 z  k1

a2 x  b2 y  c2 z  k 2
a x  b y  c z  k
 3 3 3 3

can also be written as an augmented matrix:

 a1 b1 c1 k1 
 
 a2 b2 c2 k 2 
a c3 k3 
 3 b3

Matrix Algebra Page 32


e.g.1 Write down the augmented matrices for the followings
 3x  9 y  7
a. 
7 x  12 y  23

 9 x  7 y  65 z  15

b.  5 x  12 y  2 z  64
 4 x  22 y  3 z  7

 17 x  3 y 6
c.  4 x  8 y  3 z  12
  3 y  5z  7

Matrix Algebra Page 33


e.g.2 Solve the system with the augmented matrix:

a.  1  7 15 
0 1  2
 

 1  2 1 5
 
b.  0 1 3 1
0 0 
 1 1 

Matrix Algebra Page 34


Row-Echelon Form of an Augmented Matrix
For a matrix to be in row-echelon form:
i Any rows that consist entirely of zeros are the last rows of
i.
the matrix.
ii. For a row that is not all zeros, the first non-zero element is a
one, called a leading 1.
iii. While moving down the rows of the matrix, the leading 1s
move progressively to the right
right.

Matrix Algebra Page 35


e.g.1 Determine which of the following matrices are in row-
echelon form.

 1 2 5 78  1 4 1 5 
   
a.  0 1 8 14  b.  0 0 1 2 
 0 0 1 22   0 1 1 27 
   

Matrix Algebra Page 36


Elementary Row Operations

The elementary operations that change a system but leave


the solution unaltered are:

i. Interchange the order of the equations.

ii. Multiply or divide an equation by a non-zero


non zero constant.

iii. Add, or subtract, a multiple of one equation to, or from,


another
th equation.
ti

Matrix Algebra Page 37


N t that
Note th t a row off an augmented
t d matrix
t i corresponds
d to
t an
equation of the system of equations.

When the above elementary operations are applied to the


rows of such a matrix
matrix, they do not change the solution of the
system.

They are called elementary row operations.

Matrix Algebra Page 38


Gaussian Elimination to Solve a System of Equations
i. write down the augmented matrix.
ii. apply elementary row operations to get row-echelon form.
iii solve the system
iii. system.

Matrix Algebra Page 39


 2x  y  2z  8
e g 2 Use Gaussian Elimination to solve  x  3 y  3 z  4
e.g.2
 4x  2 y  z  1

2 1 2 8 
 
The augmented matrix is 1  3 3  4
 4 2 1 1 
 
1  3 3  4
  Interchange row 1 and row 2
2 1 2 8 
 4 2 1 1 
 
 1  3 3  4  row 2 – 2*row 1
 
 0 7  4 16  row 3 – 4*row 1
 0 14  13 17 
 

Matrix Algebra Page 40


1  3 3  4 
  row 3 – 2*row
2* 2
 0 7  4 16 
 0 0  5  15 
 

1  3 3 4 
  row 2 / 7
0 1  7
4 16
7
0 0  row 3 / -5
 1 3 
Hence z 3
4 16
y z  or y  4
7 7
x  3 y  3z  4 or x  1

l ti iis x z   1 4 3
T T
Th solution
The y
Matrix Algebra Page 41
 4 x  3 y  5
e g 3 Use Gaussian elimination to solve 
e.g.3
 3 x  2 y  3

Matrix Algebra Page 42


 2 x  4 y  z  12

e.g.4 Use Gaussian elimination to solve 2 z  3 x  5 y  8
 x  3y  2z  2

Matrix Algebra Page 43


Gaussian Elimination to find the Inverse of a Matrix
i. write down in a form of [ A I ] .
ii apply a sequence of elementary row operations to
ii.
reduce A to I.
iii Performing
iii. P f i this
thi same sequence off elementary
l t row
operations on I, we obtain A-1.

Matrix Algebra Page 44


 1  2 2
 
S
Suppose A   2  3 6
1 1 7
 
 1  2 2 1 0 0  1  2 2 1 0 0
   
 2  3 6 0 1 0   0 1 2  2 1 0
 1 1 7 0 0 1  0 3 5  1 0 1
   
 1  2 2 1 0 0   1  2 0 11  6 2 
   
 0 1 2  2 1 0   0 1 0 8  5 2 
 0 0 1  5 3  1  0 0 1  5 3  1
   
 1 0 0 27  16 6   27  16 6 
   
 0 1 0 8  5 2  Hence A   8
1
5 2 
0 0 1  5 3    5 3  
 1   1 
Matrix Algebra Page 45
EIGENVALUES AND EIGENVECTORS
Reference: Croft & Davison Chapter 13 Block 4

Consider the system

 a b  x   0  or simply, AX  0
     
 c d  y   0 

If A  0 the system has non-trivial solutions.


If A  0 the system has only the trivial solution
solution.

Matrix Algebra Page 46


Characteristic Equation and Eigenvalues

Consider the system


y

 a b  x   x AX  X
       or
 c d  y   y

We seek values of  so that the system has non-trivial

solutions.
The system can be written as  A  I X  0
The system has non-trivial solutions if A  I  0

Matrix Algebra Page 47


A  I  0 , a polynomial equation in  , is called the
characteristic equation.

The values of  which cause the system AX  X to have


non trivial solutions are called eigenvalues.
non-trivial eigenvalues

Matrix Algebra Page 48


If A is an n  n matrix and X is a vector ((n  1 matrix)) then
there is usually no geometric relationship between the vector
X and the vector AX ((figure
g below).
)

AX

Matrix Algebra Page 49


But if X is an eigenvector of A then
AX =  X
i
i.e. AX is
i a scalar
l multiple
lti l off X.

AX

Matrix Algebra Page 50


Such vectors arise in the studyy of free vibrations, electrical
systems , chemical reactions and mechanical stress, etc.

m1 m2

x1 x2

Matrix Algebra Page 51


Eigenvectors
g
Suppose that  , an eigenvalue, satisfies the system

AX  X .

For each eigenvalue there is a non-trival solution (unique up to


a non-zero scalar multiple) of the system
system. This solution is called
an eigenvector.

Matrix Algebra Page 52


e.g.1 Find the eigenvalues and eigenvectors of the matrix
5 4
A   
1 2
5 4
det ((A-I)) =  2  7  6  0
1 2
Hence   6 or   1

5  6 4   1 4 
When   6 , ( A  I )      
 1 2  6  1  4
i.e. x  4 y  0 or x  4 y . In general, x  4t
4t , y  t
 x   4
The eigenvector is    t  
 y 1
Matrix Algebra Page 53
 1 ,  5 1 4   4 4
When ( A  I )      
 1 2  1  1 1 
i.e. x  y  0 or x   y . In general, x  t , y   t

 x  1 
The eigenvector
g is    t  
 y    1

Matrix Algebra Page 54


e.g.5 Find the eigenvalues and eigenvectors of A.

 3 1
A 
 1 5

e.g.6 Find the eigenvalues and eigenvectors of A.

1 2 0 
 
A   1 1 1 
 3 2  2
 

Matrix Algebra Page 55


APPLICATION
Stiff
Stiffness method
th d is
i commonlyl usedd tto analyse
l a structure
t t as
matrix analysis can be used to solve the problem.

For a typical beam element, the relationship between the


member end moments and member end rotations is given by
 i, q i  j, qj

i j

4 EI 2 EI
qi  i   j  4 EI 2 EI 
L L
  qi   L L    i   2 EI  2 1    i   k    
q    2 EI 4 EI   j  1 2  
2 EI 4 EI  j   L   j 
qj  i   j  L L 
L L

Matrix Algebra Page 56


 i 
where [ ]    - displacement matrix
 j 
 kii kij 
[k]]    - stiffness matrix
k
 ji k jj 

 qi 
[q]]    - force
f matrix
ti
q j 

By assembly the stiffness of the whole structure, it will


become a veryy Structure Stiffness Matrix.
By imposing appropriate boundary conditions and end
moments the displacement of the whole structure can be
moments,
solved, i.e.
[ ]  [ K ] [Q]
1

Matrix Algebra Page 57

You might also like