Lecture 1 Special Matrix Operation
Lecture 1 Special Matrix Operation
INTRODUCTION
1. REFERENCE
a. Problems in Matrix Structural Analysis, Bhatt
2. SYLLABUS
a. Introduction
20 -4 3 0 x1 -200
-4 10 2 0 x2 0
* =
3 2 10 -3 x3 100
0 0 -3 20 x4 300
Multiplication
[A] [B] [C] [D] = [E]
(m x n) (n x o) (o x p) (p x q) = (m x q)
Example:
4 3 4 3 8 6
1 0 2 0
[ 0 1] [ ] = [0 1 0 2]
0 1 0 2
−4 1 −4 1 −8 2
(3 x 2)(2 x 4) = (3 x 4)
Division
Vector – single matrix
[ A ] {x} = {y}
(n x n) (n x 1) = (n x 1)
A(nxn) x(n) = b(n) Given: A & b, solve for x(n)
Gaussian Elimination or Cramer’s Rule
MATRIX PROPERTIES: [A]
1. Square: nxn
Number of rows = no. of equations & no. of columns = no. of unknowns.
To have a unique solution, the number of independent equations = no. of
unknowns.
30 -5 4 -2
-5 20 -3 6
4 -3 25 -7
-2 6 -7 40
3. Positive Definite:
Main diagonal of original is the main diagonal of the sub-matrices
All matrices and sub-matrices formed whose main diagonal elements are part of
the main diagonal of matrix A will have determinants that are positive.
30 -5 4 -2
-5 20 -3 6
4 -3 25 -7
-2 6 -7 40
Simultaneous linear equations are best solved using matrix operations if the sizes of the
matrices are large.
CHOLESKY PROCEDURE:
Given: A, b
Unknown: x
[ A ]{x} = {b }
[ A ]= [ L ] x [ U ]
Therefore: [ L ] x [ U ] {x} = {b }
Let: [ U ] {x} = {y }
[ L ] {y} = {b }
1. Decomposition of Matrix A
Starts with 1st row and 1st column, then from main diagonal
a. [ A ] = [L] x [U]
Where:
L Lower triangular matrix:
x 0 0 0
x x 0 0
x x x 0
x x x x
[L ] = [ U ]T Unique pair
Lij =Uji
Cholesky Procedure involves 3 steps.
o Step 1. Decomposition, [A] = [L][U]
o But [A]{x} = {b} ==> [L][U]{x} = {b}
o Let [U]{x} = {y}, then [L]{y} = {b}
o Step 2. Forward Substitution, [L]{y} = {b}
o Step 3. Backward Substitution, [U]{x} = {y}
c. Decomposition Procedure
a22 = [l21*u12 +l22* u22] a22 = [u122 + u222] u22 = [a22 – (u122)]0.5
a23 = [l21*u13 +l22* u23] a23 =u12*u13 + u22*u23u23 = (a23 – [u12*u13]) / u22
a24 = [l21*u14 +l22* u24] a24 =u12*u14 + u22*u24u24 = (a24 – [u12*u14]) / u22
a33= [l31*u13 +l32* u23+l33* u33] a33= a22 u132 + u232 + u332
a34 = [l31*u14 + l32* u24+ l33* u34] a34 = u13*u14 + u23*u24 + u33*u34
a44 = [l41*u14 + l42* u24+ l43* u34+ l44* u44] a44 = u142 + u242 + u342 + u442
General Formula:
for i = j:
𝑖−1
for i< j:
𝑎𝑖𝑗 − ∑𝑖−1
𝑘=1 𝑢𝑘𝑖 𝑢𝑘𝑗
𝑢𝑖𝑗 =
𝑢𝑖𝑖
Example:
20 -4 3 0 a11 a12 a13 a14
-4 10 2 0 a21 a22 a23 a24
=
3 2 10 -3 a31 a32 a33 a34
0 0 -3 20 a41 a42 a43 a44
−4
u12 = a12 / u11 = = -0.894
4.4721
3
u13 = a13 / u11 = = 0.671
4.4721
0
u14 = a14 / u11 = =0
4.4721
2nd row:
u22 = [a22 – (u122)]0.5 = √10 − (−0.8944)2 = 3.033
2−(−0.8944)(0.6708)
u23 = (a23 – [u12*u13]) / u22= = 0.857
3.0331
0−(−0.8944)(0)
u24 = (a24 – [u12*u14]) / u22= =0
3.0331
3rdrow:
u33 = [a33 – (u132 + u232)]0.5=√10 − [(0.6708)2 + (0.8571)2 ] = 2.969
−3−(−0.6708∗0+0.8571∗0)
u34 = (a34 – [u13*u14 + u23*u24]) / u33= = -1.010
2.9691
2. Forward Elimination
[ L ] {y} = {b }
u11 0 0 0 y1 b1
u12 u22 0 0 y2 b2
* =
u13 u23 u33 0 y3 b3
u14 u24 u34 u44 y4 b4
b1 = u11*y1 y1 = b1 /u11
b2 = u12*y1+ u22*y2 y2 = [b2 - (u12*y1)] / u22
b3 = u13*y1 + u23*y2 +u33*y3 y3 = [b3 - (u13*y1 +u23*y2)] / u33
b4 =u14y1 + u24y2 + u34y3 + u44y4 y4 = [b4 – (u14y1 + u24y2 + u34y3)] / u44
General Formula:
𝑏𝑖 − ∑𝑖−1
𝑘=1 𝑢𝑘𝑖 𝑦𝑘
𝑦𝑖 =
𝑢𝑖𝑖
from Step 1, on decomposition we get:
4.472 0 0 0
-0.894 3.033 0 0
0.671 0.857 2.969 0
0 0 -1.010 4.356
u11 0 0 0 y1 -200
u12 u22 0 0 y2 0
* =
u13 u23 u33 0 y3 100
u14 u24 u34 u44 y4 300
−200
y1 = b1 /u11 = 4.472 = -44.722
0−(−0.894∗(−44.722))
y2 = (b2 - u12*y1) / u22= = -13.182
3.033
100−(0.671∗(−44.722)+0.857∗(−13.182))
y3 = (b3 - u13*y1 +u23*y2) / u33= = 47.594
2.969
300−(0∗(−44.722)+0∗(−13.182)+(−1.010)∗47.594)
y4 = [b4 – (u14y1 + u24y2 + u34y3)] / u44= =
4.356
y4 = 79.906
3. Backward Substitution
[ u ] {x} = {y }
𝑦𝑖 − ∑𝑛𝑘=𝑖+1 𝑢𝑖𝑘 ∗ 𝑥𝑘
𝑥𝑖 =
𝑢𝑖𝑖
from Step1. decomposition and Step 2. forward substitution, we get:
4.472 -0.894 0.671 0
0 3.033 0.857 0
0 0 2.969 -1.01
0 0 0 4.356
80.308
x4 = y4/u44 = = 18.436
4.356
47.594−(−1.01∗18.436)
x3 = (y3 – u34*x4) / u33 = = 22.302
2.969
−13.182−(0.857∗22.302+0∗18.436)
x2 = [y2 – (u23*x3 +u24*x4) / u22= = -10.648
3.033
x1 = [y1 – (u12*x2 +u13*x3 +u14*x4) / u11
−44.722−(−0.894∗(−10.648)+0.671∗22.302+0∗18.436)
= = -15.475
4.472
20 -4 3 0 -15.475 -200
-4 10 2 0 -10.648 0
* =
3 2 10 -3 22.302 100
0 0 -3 20 18.436 300
From calculator:
20 -4 3 0 -15.475 -200
-4 10 2 0 -10.648 0.006
* =
3 2 10 -3 22.302 100.01
0 0 -3 20 18.436 303.55
for J = 1 to N
INPUT A(I,J)
next J
INPUT B(I)
next I
for I = 1 to N
for J = 1 to N
if I = J
then
Sum = 0
for K = 1 to I - 1
next K
else
Sum = 0
for K = 1 to I - 1
next K
next J
next I
REM FORWARD ELIMINATION Forward elimination
for I = 1 to N
Sum = 0
for K = 1 to I - 1
next K
next I
for I = N to 1 STEP -1
Sum = 0
for K = I+1 to N
next K
next I
To save on memory requirements which accordingly will also speed up the process,
softwares use “block” operations. The size of the block is equal to HBW x HBW.
1,000 rows =
A x = b
With block operations, we convert Matrix A into a “banded” matrix. A banded matrix
looks like what is shown below.
1,000 columns
Band Width
1 10
zeroes
10
Band width = 10 + 1 + 10 = 21
HBW
Banded A x b
The band width can be minimized by adopting a numbering of the joints such that the
difference of the joint numbers of the two ends of a member is likewise minimized. This is
achieved by numbering the joints in a “wave-like” fashion in the direction of the “longer”
dimension.