Anda di halaman 1dari 42

FINITE ELEMENT METHOD

(BDA 31003)

Lecture Module 2: Matrix Algebra

Prof Madya Dr. Waluyo Adi Siswanto


Universiti Tun Hussein Onn Malaysia
Topics to Discuss
 Matrix definition and notation
 Definition
 Transpose
 Symmetric Matrix
 Unit Matrix
 Matrix Operations
 Addition
 Multiplication
 Inverse
 Orthogonal Matrix
 Solution of Simultaneous Equations
BDA 31003 Waluyo Adi Siswanto 2
Matrix Definition

A matrix is an m x n array of numbers arranged in


m rows and n columns.
Matrix is then described as being of order m x n.

[ ]
a11 a 12 ⋯ a 1n
a a 22 ⋯ a 2n
[a]= 21
⋮ ⋮ . ⋮
a m1 a m2 ⋯ a mn Row m

Column n

BDA 31003 Waluyo Adi Siswanto 3


Example Matrix Definition

Rectangular matrix
[ M ]= [ 5 3 −3 2
− 6 5 4 − 19 ] 2x4

[ ]
5 3 −3
Square matrix [C ]= 5 4 − 19 3x3
2 4 −3

Row matrix [B ]= [5 3 − 3 ] 1x3

[ ]{ }
Vector
5 5
Column matrix (Vector)
Vector [F ]= 3 = 3 3x1
−3 −3
BDA 31003 Waluyo Adi Siswanto 4
Transpose Matrix

The transpose matrix is obtained by


interchanging rows and columns.
columns

[a ij ] = [a ji ]
T

[ ] [ ]
5 3 −3 5 5 2
[C ]= 5 4 − 19 [C ] = 3
T
4 4
2 4 −3 − 3 − 19 − 3
Diagonal
unchanged

BDA 31003 Waluyo Adi Siswanto 5


Transpose Matrix
in OO/LO Calc Spreadsheet

Prepare data

Insert function
TRANSPOSE
Select the
array data
Prepare area for result
OK
To show
The result

BDA 31003 Waluyo Adi Siswanto 6


Transpose Matrix
in MS Excel

Prepare data

Insert function
TRANSPOSE PRESS F2
Select the
array data then

Ctrl + Shift + Enter

Prepare area for result


BDA 31003 Waluyo Adi Siswanto 7
Transpose Matrix
in FreeMat / Matlab

BDA 31003 Waluyo Adi Siswanto 8


Symmetric Matrix

If a square matrix is equal to its transpose,


transpose
It is called a symmetric matrix
[a ]= [a ]
T

[ ] [ ]
5 3 −3 5 3 −3
[C ]= 3 4 8 [C ] = 3 4 8
T

−3 8 −3 − 3 8 −3

[C ] is a symmetric matrix

BDA 31003 Waluyo Adi Siswanto 9


Unit Matrix

The unit (or Identity)


Identity matrix [I] is such that

[ a][ I ]= [ I ][ a ]= [a ]

The unit matrix is always a square matrix of any possible


order with each element of the main diagonal is one and
all other elements equal to zero.
zero

[ ]
1 0 0
For example, the 3 x 3 unit matrix is given by [I ]= 0 1 0
0 0 1

BDA 31003 Waluyo Adi Siswanto 10


Addition of Matrices

Matrices of the same order can be added together by


summing corresponding elements of the matrices.
matrices
Subtraction is performed in similar manner
Matrices of unlike order cannot be added or subtracted.

[cij ]= [ a ij ] [bij ]= [ bij ] [ a ij ]

[ ]
[ A]= − 1 2
−3 2 [ ]
[B ]= 1 2
3 1 [ ]
[C ]= [ A] [ B]= 0 4
0 3

BDA 31003 Waluyo Adi Siswanto 11


Addition of Matrices
in FreeMat / Matlab

BDA 31003 Waluyo Adi Siswanto 12


Multiplication of Matrices

The number of the columns of the first matrix must be equal to the number of
rows of the second matrix.

Matrix multiplication is not cumulative [A][B]≠[B][A]

n
[ cij ]= ∑ a ie bej
e= 1

[ ]
[ A]= 2 1
3 2 [ ]
[ B ]= 1 − 1
2 0 [ ]
[C ]= [ A][B]= 4 − 2
7 −3

BDA 31003 Waluyo Adi Siswanto 13


Multiplication of Matrices
in OO/LO Calc Spreadsheet

Prepare data
[A] and [B]

Prepare area for result Insert function MMULT


Select the array data [A] and [B]

OK
To show
The result

BDA 31003 Waluyo Adi Siswanto 14


Multiplication of Matrices
in FreeMat

BDA 31003 Waluyo Adi Siswanto 15


Inverse of a Matrix
The inverse of a matrix is a matrix such that
−1 −1
[ A] [ A]= [ A] [ A] = [ I ]

−1 [ C ]T
adj[ A]
[ A] = =
∣ A∣ ∣ A∣

[C ] : Cofactor of matrix [ A]

∣ A∣ : Determinant of matrix [ A]

BDA 31003 Waluyo Adi Siswanto 16


Cofactor Matrix

[ −1 3 − 2
[ A ]= 2 − 4 2
]

[ ]
0 4 1

| | | | | |
−4 2 2 2 2 −4

[ ]
+ − +
4 1 0 1 0 4

| | | | | |
−12 −22 8
[C ]= − 3 −2 +
−1 − 2

−1 3 = −11 −1 4
4 1 0 1 0 4 −2 −2 − 2

| | | | | |
+ 3 −2
−4 2
− −1 − 2
2 2
+ −1 3
2 −4

BDA 31003 Waluyo Adi Siswanto 17


Adjoint and Determinant Matrix

Continuing the previous result

[
−12 −11 −2
adj [ A ]=[C ] = −2 −1 −2
T

8 4 −2
]
| | | | | |
det [ A]=| A|=−1( +1) − 4 2 + 3 (−1) 2 2 − 2 (+1) 2 − 4 = −10
4 1 0 1 0 4

BDA 31003 Waluyo Adi Siswanto 18


Determinant of a Matrix
in OO Calc Spreadsheet
Insert function MDETERM Select the array data [A]

Prepare data [A]


and place for result

OK
To show
The result

BDA 31003 Waluyo Adi Siswanto 19


Determinant of a Matrix
in FreeMat

BDA 31003 Waluyo Adi Siswanto 20


Inverse of a Matrix
in OO Calc Spreadsheet
Insert function MINVERSE Select the array data [A]

Prepare data [A]

Prepare area for result

OK
To show
The result

BDA 31003 Waluyo Adi Siswanto 21


Inverse of a Matrix
in FreeMat

BDA 31003 Waluyo Adi Siswanto 22


Orthogonal Matrix

A matrix [A] is an orthogonal matrix if


[ A]− 1 = [ A]T

[ A]= [ cos ( 60 deg ) sin (60 deg )


−sin (60 deg ) cos( 60 deg )
= ][
0.5 0.87
−0.87 0.5 ]
[ A] =
T
[ 0.5 − 0.87
0.87 0.5 ] −1
[ A] = [ 0.5 − 0.87
0.87 0.5 ]
Matrix [A] is an orthogonal matrix

BDA 31003 Waluyo Adi Siswanto 23


Solution Methods
of Simultaneous Linear Equations

 Representation of linear equations in Matrix


 Matrix Inversion Method
 Classical Methods
 Cramer's Rule Method
 Gaussian Elimination Method
 Gauss-Siedel Iteration Method

BDA 31003 Waluyo Adi Siswanto 24


Linear Equations in Matrix
a11 x 1+ a 12 x 2 +⋯+a 1 n x n =c 1
a 21 x1 + a 22 x 2 +⋯+a 2 n x n = c 2

a n 1 x 1+ a n 2 x 2 +⋯+a nn x n =c n

[ ]{ } { }
The equation can be written in Matrix

a 11 a 12 ⋯ a 1 n x1 c1
a 21 a 22 ⋯ a 2 n x2 = c2
⋮ ⋮ . ⋮ ⋮ ⋮
an 1 a n 2 ⋯ a nn xn cn

or [K ]{ x }= { F } then
−1
{ x }= [K ] { F }

BDA 31003 Waluyo Adi Siswanto 25


Example Problem 2.1
− x 1 +3 x 2 −2 x 3 =2
2 x 1 −4 x 2+ 2 x 3 =1
4 x 2 + x 3 =3
a. Write the simultaneous equation in Matrix
b. Find the unknown variables x1, x2 and x3 from the
following equations

[ −1 3 −2
2 −4 2
0 4 1
]{ } { }
x1 2
x2 = 1
x3 3

or [K ]{ x }= { F } then
−1
{ x }= [K ] { F }

BDA 31003 Waluyo Adi Siswanto 26


Solving Simultaneous Equation
in OO Calc Spreadsheet

The result:
{ }{ }
x1 4.1
x 2 = 1.1
x3 −1.4

BDA 31003 Waluyo Adi Siswanto 27


Solving Simultaneous Equation
in FreeMat

BDA 31003 Waluyo Adi Siswanto 28


Cramer's Rule Method

[ −1 3 −2
2 −4 2
0 4 1
]{ } { }
x1 2
x2 = 1
x3 3

2 3 −2
1 −4 2
3 4 1

∣ ∣
x 1= = 4.1
−1 3 2
2 −4 2
0 4 1


−1 2 − 2
2 1 2
0 3 1 ∣ ∣
−1 3 2

0

2 −4 1
4 3

∣ ∣ ∣ ∣
x 2= = 1.1 x 3= = 1.4
−1 3 2 −1 3 2
2 −4 2 2 −4 2
0 4 1 0 4 1

BDA 31003 Waluyo Adi Siswanto 29


Gauss Elimination
Gauss Elimination is based on triangularisation of the coefficient matrix
and evaluation of the unknowns by back-substitution starting from the last
equation

The form can be summarised in general form by

aik k =1,2,⋯ , n−1


a ij = aij − a kj i = k +1,⋯ , n
akk j = k ,⋯ , n+1

( )
n
1
xi = a i , n +1− ∑ a ir x r
a ii r=i +1

BDA 31003 Waluyo Adi Siswanto 30


Example Problem 2.2
2 x 1 +2 x 2 +1 x 3 =9
2 x1 +1 x 2 = 4
1 x 1 +1 x 2+ 1 x3 =6

a. Find the unknown variables x1, x2 and x3 from the


following equations, using Gauss Elimination Method
b. Verify the result in Speadsheet

Since the order of matrix is n=3, n= 3


the index for solving this problem k = 1,2
i= 2,3
j= 1,2,3,4

BDA 31003 Waluyo Adi Siswanto 31


k =1,2,⋯ , n−1 The running index will be (for n=3)
i = k +1,⋯ , n k=1
j = k ,⋯ , n+1 i=2
j = 1 to 4
Calculate aij
i.e. a21 a22 a23 a24

i=3
j = 1 to 4
Calculate aij
i.e. a31 a32 a33 a34

k=2
i=3
j = 2 to 4
Calculate aij
i.e. a32 a33 a34

BDA 31003 Waluyo Adi Siswanto 32


[ ]
The running index will be (for n=3)
2 2 1 k=1
[a]= 2 1 0 i=2
1 1 1 j = 1 to 4
Calculate aij
i.e. a21 a22 a23 a24

aik a 21 2
a ij = aij − a kj a 21 =a 21 −a 11 = 2−2 ( )=0
akk a 11 2
a 21 2
a 22 =a 22 −a 12 =1− 2( )=−1
a 11 2
a 21 2
a 23 =a 23 −a 13 = 0−1( ) =−1
a 11 2
a 21 2
a 24 =a 24 −a 14 = 4−9 ( )=−5
a 11 2
BDA 31003 Waluyo Adi Siswanto 33
[ ]
2 2 1 i=3
[a]= 2 1 0 j = 1 to 4
1 1 1 Calculate aij
i.e. a31 a32 a33 a34

aik a 31 1
a ij = aij − a kj a 31 =a 31 − a 11 =1−2 ( )=0
akk a 11 2
a 31 1
a 32 =a 32 − a 12 =1−2 ( )=0
a 11 2
a 31 1
a 33 =a 33− a 13 =1−1( )=0.5
a 11 2
a 31 1
a 34 =a 34− a 14 =6−9 ( )=1.5
a 11 2
BDA 31003 Waluyo Adi Siswanto 34
[ ]
2 2 1 k=2
[a]= 2 1 0 i=3
1 1 1 j = 2 to 4
Calculate aij
i.e. a32 a33 a34

aik a 32 0
a ij = aij − a kj a 32 =a 32− a 22 = 0−(−1) ( )= 0
akk a 22 −1
a 32 0
a 33 =a 33 − a 23 =( 0.5)−(−1) ( )=0.5
a 22 −1
a 32 0
a 34 =a 34− a 24 =1.5−( −5)( )=1.5
a 22 −1

BDA 31003 Waluyo Adi Siswanto 35


( )
n
1
xi = a i , n +1− ∑ a ir x r
a ii r=i +1

1 1
x 3 = ( a 34 −0 ) =( ) (1.5) =3
a 33 0.5

1 1
x2=
a 22
( a 24 − a 23 3 )
x =(
−1
)[−5−(−1) ( 3)]=2

1 1
x 1 = ( a 14− a12 x 2 −a 13 x3 ) =( )[9− 2( 2)−1 (3) ]=1
a11 2

BDA 31003 Waluyo Adi Siswanto 36


Verification using inverse matrix in OO Spreadsheet

BDA 31003 Waluyo Adi Siswanto 37


Gauss Siedel Iteration Method

Gauss-Siedel method is based on iterative approach

1
x 1= ( c1 −a 12 x 2− a 13 x 3 −⋯−a 1 n x n )
a 11
1
x2 = ( c2 − a 21 x 1 −a 23 x 3−⋯− a 2 n x n )
a 22

1
xn= ( c n −a n 1 x 1− a n 2 x 2 −⋯−a n ,n −1 x n−1 )
a nn

ci
A good initial guess x i=
a ii

BDA 31003 Waluyo Adi Siswanto 38


Example Problem 2.3
4 x 1 − x 2 =2
− x 1 + 4 x 2− x 3 =5
− x 2 + 4 x 3− x 4 =6
− x 3+ 2 x 4 =−2

a. Find the unknown variables x1, x2 and x3 from the


following equations, using Gauss-Siedel Iteration approach
b. Verify the result in Speadsheet

BDA 31003 Waluyo Adi Siswanto 39


[ ] {}
ci
4 −1 0 0 2 A good initial guess x i=
−1 4 −1 0 a ii
[a]= {c }= 5
0 −1 4 −1 6
−2 x 1= 0.5 x 2= 1 x 3= 1 x 4= − 1
0 0 −1 2

First trial Second trial


1 1
x1 = (2+ x 2 )=0.75 x1 = ( 2+ 1.68)=0.992
4 4
1 1
x 2 = (5+ x1 + x3 )=1.68 x 2 = (5+0.992+1.672)=1.899
4 4
1 1
x 3 = ( 6+ x 2 + x 4 )=1.672 x 3 = ( 6+1.899±0.16)= 1.944
4 4
1 1
x 4= (−2+ x 3 )=−0.16 x 4= (−2+1.944 )=−0.028
2 2

BDA 31003 Waluyo Adi Siswanto 40


BDA 31003 Waluyo Adi Siswanto 41
BDA 31003 Waluyo Adi Siswanto 42

Anda mungkin juga menyukai