eciv 520 structural analysis ii review of matrix algebra
Post on 21-Dec-2015
257 Views
Preview:
TRANSCRIPT
ECIV 520
Structural Analysis II
Review of Matrix Algebra
Linear Equations in Matrix Form
10z8y3x5
6z3yx12
24z23y6x10
Linear Equations in Matrix Form
10z8y3x5
10
z
y
x
835
Linear Equations in Matrix Form
6
z
y
x
3112
6z3yx12
Linear Equations in Matrix Form
24
z
y
x
23610
24z23y6x10
23610
3112
835
z
y
x
24
6
10
10
z
y
x
835
6
z
y
x
3112
24
z
y
x
23610
Matrix Algebra
nm3n2n1n
m3333231
m2232221
m1131211
aaaa
aaaa
aaaa
aaaa
A
Rectangular Array of Elements Represented by a single symbol [A]
Matrix Algebra
nm3n2n1n
m3333231
m2232221
m1131211
aaaa
aaaa
aaaa
aaaa
A
Row 1
Row 3
Column 2 Column m
n x m Matrix
nm3n2n1n
m3333231
m2232221
m1131211
aaaa
aaaa
aaaa
aaaa
A
Matrix Algebra
32a
3rd Row
2nd Column
Matrix Algebra
m321 bbbbB
1 Row, m Columns
Row Vector
B
Matrix Algebra
n
3
2
1
c
c
c
c
C
n Rows, 1 Column
Column Vector
C
Matrix Algebra
5554535251
4544434241
3534333231
2524232221
1514131211
aaaaa
aaaaa
aaaaa
aaaaa
aaaaa
A
If n = m Square Matrix
e.g. n=m=5e.g. n=m=5Main Diagonal
Matrix Algebra
9264
2732
6381
4215
A
Special Types of Square Matrices
Symmetric: aSymmetric: aijij = a = ajiji
Matrix Algebra
9000
0700
0080
0005
A
Diagonal: aDiagonal: aijij = 0, i = 0, ijj
Special Types of Square Matrices
Matrix Algebra
1000
0100
0010
0001
I
Identity: aIdentity: aiiii=1.0 a=1.0 aijij = 0, i = 0, ijj
Special Types of Square Matrices
nm
m333
m22322
m1131211
a000
aa00
aaa0
aaaa
A
Matrix Algebra
Upper TriangularUpper Triangular
Special Types of Square Matrices
nm3n2n1n
333231
2221
11
aaaa
0aaa
00aa
000a
A
Matrix Algebra
Lower TriangularLower Triangular
Special Types of Square Matrices
nm
3332
232221
1211
a000
0aa0
0aaa
00aa
A
Matrix Algebra
BandedBanded
Special Types of Square Matrices
Matrix Operating Rules - Equality
nm3n2n1n
m3333231
m2232221
m1131211
aaaa
aaaa
aaaa
aaaa
A
pq3p2p1p
q3333231
q2232221
q1131211
bbbb
bbab
bbbb
bbbb
B
[A]mxn=[B]pxq
n=p m=q aij=bij
Matrix Operating Rules - Addition
nm3n2n1n
m3333231
m2232221
m1131211
aaaa
aaaa
aaaa
aaaa
A
pq3p2p1p
q3333231
q2232221
q1131211
bbbb
bbab
bbbb
bbbb
B
[C]mxn= [A]mxn+[B]pxq
n=p
m=qcij = aij+bij
Matrix Operating Rules - Addition
Properties
[A]+[B] = [B]+[A]
[A]+([B]+[C]) = ([A]+[B])+[C]
Multiplication by Scalar
nm3n2n1n
m3333231
m2232221
m1131211
gagagaga
gagagaga
gagagaga
gagagaga
AgD
Matrix Multiplication
nm3n2n1n
m3333231
m2232221
m1131211
aaaa
aaaa
aaaa
aaaa
A
pq3p2p1p
q3333231
q2232221
q1131211
bbbb
bbab
bbbb
bbbb
B
[A] n x m . [B] p x q = [C] n x q
m=p
n
1kkjikij bac
Matrix Multiplication
nm3n2n1n
m3333231
m2232221
m1131211
aaaa
aaaa
aaaa
aaaa
A
pq3p2p1p
q3333231
q2232221
q1131211
bbbb
bbab
bbbb
bbbb
B
1nn13113
2112111111
baba
babac
11c
C
nm3n2n1n
m3333231
m2232221
m1131211
aaaa
aaaa
aaaa
aaaa
A
Matrix Multiplication
pq3p2p1p
q3333231
q2232221
q1131211
bbbb
bbab
bbbb
bbbb
B
3nn23323
2322132123
baba
babac
23c
C
Matrix Multiplication - Properties
Associative: [A]([B][C]) = ([A][B])[C]
If dimensions suitable
Distributive: [A]([B]+[C]) = [A][B]+[A] [C]
Attention: [A][B] [B][A]
nmm3m2m1
3n332313
2n322212
1n312111
T
aaaa
aaaa
aaaa
aaaa
A
nm3n2n1n
m3333231
m2232221
m1131211
aaaa
aaaa
aaaa
aaaa
A
Operations - Transpose
Operations - Trace
5554535251
4544434241
3534333231
2524232221
1514131211
aaaaa
aaaaa
aaaaa
aaaaa
aaaaa
A
Square Matrix
tr[A] = tr[A] = aaiiii
Determinants
nnn2n1
2n2221
1n1211
aaa
aaa
aaa
A
nnn2n1
2n2221
1n1211
aaa
aaa
aaa
det
AA
Are composed of same elements
Completely Different Mathematical Concept
Determinants
2221
1211
aa
aaA
Defined in a recursive form
2x2 matrix
122122112221
1211det aaaaaa
aaA
Determinants
nnnjnn
inijii
nj
nj
aaaa
aaaa
aaaa
aaaa
21
21
222221
111211
A
ijAMinor
Determinants
ijji
ij AACofactor minor1
n
kikik AaA
1
]det[
DeterminantsDefined in a recursive form
3x3 matrix
3231
222113
3331
232112
3332
232211
det
aa
aaa
aa
aaa
aa
aaa
A
333231
232221
131211
aaa
aaa
aaa
333231
232221
131211
aaa
aaa
aaa
Determinants
3332
232211 aa
aaa
3231
222113
3331
232112 aa
aaa
aa
aaa
3332
2322
aa
aaMinor a11
333231
232221
131211
aaa
aaa
aaa
Determinants
3331
2321
aa
aaMinor a12
3332
232211 aa
aaa
3331
232112 aa
aaa
3231
222113 aa
aaa
333231
232221
131211
aaa
aaa
aaa
Determinants
3231
2221
aa
aaMinor a13
3332
232211 aa
aaa
3331
232112 aa
aaa
3231
222113 aa
aaa
DeterminantsProperties1) If two rows or two columns of matrix [A] are equal then det[A]=0
2) Interchanging any two rows or columns will change the sign of the det
3) If a row or a column of a matrix is {0} then det[A]=0
4)
5) If we multiply any row or column by a scalar s then
6) If any row or column is replaced by a linear combination of any of the other rows or columns the value of det[A] remains unchanged
AsAs n
AsA
Operations - Inverse
[A] [A]-1
[A] [A]-1=[I]
If [A]-1 does not exist[A] is singular
Operations - Inverse
Calculation of [A]-1
AadjA
A11
TijAAadj
Solution of Linear Equations
23610
3112
835
z
y
x
24
6
10
bxA
bAxAA 11
bAxI 1 bAx 1
Numerical Solution of Linear Equations
Solution of Linear Equations
9835 zyx
7310 zyx
10500 zyx
Consider the system
Solution of Linear Equations
9835 zyx
730 zyx
10500 zyx
25
10 z
Solution of Linear Equations
9835 zyx
730 zyx
2z
7230 yx
167 y
Solution of Linear Equations9835 zyx
2z
1y
928135 x
25
1639
x 2x
Solution of Linear Equations
10
7
9
500
310
835
z
y
x
Express In Matrix Form
Upper Triangular
What is the characteristic?
Solution by Back Substitution
Solution of Linear EquationsObjective
Can we express any system of equations in a form
nnnn
n
n
n
b
b
b
b
x
x
x
x
a
aa
aaa
aaaa
3
2
1
3
2
1
333
22322
1131211
000
00
0
0
BackgroundConsider
1035 yx(Eq 1)
5810 yx(Eq 2)
Solution
5.7
5.6
y
x
20610 yx2*(Eq 1)
5810 yx(Eq 2)
Solution
5.7
5.6
y
x!!!!!!
Scaling Does Not Change the SolutionScaling Does Not Change the Solution
BackgroundConsider
20610 yx(Eq 1)
152 y(Eq 2)-(Eq 1)
Solution
5.7
5.6
y
x!!!!!!
20610 yx(Eq 1)
5810 yx(Eq 2)
Solution
5.7
5.6
y
x
Operations Do Not Change the SolutionOperations Do Not Change the Solution
Gauss Elimination
10835 zyx
2423610 zyx
6312 zyx
Example
Forward Elimination
Gauss Elimination
10835 zyx
24z23y6x10
zyx 835
5
1210
5
12
6312 zyx
-
305
81
5
310 zyx 302.162.60 zyx
Gauss Elimination
10835 zyx
24z23y6x10
6312 zyx 302.162.60 zyx
Substitute 2nd eq with new
Gauss Elimination
10835 zyx
24z23y6x10
302.162.60 zyx
zyx 835
5
1010
5
10-
439120 zyx
Gauss Elimination
10835 zyx
24z23y6x10
302.162.60 zyx
Substitute 3rd eq with new
439120 zyx
Gauss Elimination
10835 zyx
302.162.60 zyx
439120 zyx
zy 2.162.6
2.6
12 30
2.6
12-
064.62645.700 zyx
Gauss Elimination
10835 zyx
30970 zyx
Substitute 3rd eq with new
439120 zyx 064.62645.700 zyx
Gauss Elimination
064.62
30
10
645.700
2.162.60
835
z
y
x
Gauss Elimination
118.8645.7/064.62 z
0502.26
2.6
118.82.1630
y
6413.0
5
118.880502.26310
x
064.62
30
10
645.700
2.162.60
835
z
y
x
Gauss Elimination – Potential Problem
10830 zyx
2423610 zyx
6312 zyx
Forward Elimination
Gauss Elimination – Potential Problem
10830 zyx
2423610 zyx
6312 zyx
0
12 Division By Zero!!Operation Failed
Gauss Elimination – Potential Problem
10830 zyx
2423610 zyx
6312 zyx
12
0OK!!
Gauss Elimination – Potential Problem
10830 zyx
2423610 zyx
6312 zyx
Pivoting
6312 zyx
10830 zyx
Partial Pivoting
nn
nnnnn
lll
n
n
n
b
b
b
b
x
x
x
x
aaaa
aaaa
aaaaaaaa
aaaa
3
2
1
3
2
1
321
ln321
3333231
2232221
1131211
a32>a22
al2>a22
NO
YES
Partial Pivoting
nn
nnnnn
n
n
lll
n
b
b
b
b
x
x
x
x
aaaa
aaaa
aaaaaaaa
aaaa
3
2
1
3
2
1
321
2232221
3333231
ln321
1131211
Full Pivoting
• In addition to row swaping
• Search columns for max elements
• Swap Columns
• Change the order of xi
• Most cases not necessary
EXAMPLE
4.71
3.19
85.7
102.03.0
3.071.0
2.01.03
3
2
1
x
x
x
Eliminate Column 1
3
1.0
PIVOTS
4.71
3.19
85.7
102.03.0
3.071.0
2.01.03
3
3.0
1,11
11 ia
apivot i
i
njapivotaa jiijij ,,2,1,11
Eliminate Column 1
6150.70
5617.19
85.7
0200.1019000.00
29333.000333.70
2.01.03
Eliminate Column 2
00333.7
19000.0
PIVOTS
6150.70
5617.19
85.7
0200.1019000.00
29333.000333.70
2.01.03
2,22
22 ia
apivot i
i
njapivotaa jiijij ,,2,1,22
Eliminate Column 2
0843.70
5617.19
85.7
01200.1000
29333.000333.70
2.01.03
UpperTriangular
Matrix[ U ]
ModifiedRHS
{ b }
01200.1000
29333.000333.70
2.01.03
LU DecompositionPIVOTS
Column 1PIVOTS
Column 2
03333.0
1.0 02713.0
LU Decomposition
As many as, and in the location of, zeros
UpperTriangular
MatrixU
01200.1000
29333.000333.70
2.01.03
LU DecompositionPIVOTS
Column 1
PIVOTSColumn 2
LowerTriangular
Matrix
1
1
1
0
0
0
L
03333.0
1.0 02713.0
LU Decomposition
102713.01.0
0103333.0
001
=
This is the original matrix!!!!!!!!!!
01200.1000
29333.000333.70
2.01.03
102.03.0
3.071.0
2.01.03
LU Decomposition
4.71
3.19
85.7
102713.01.0
0103333.0
001
3
2
1
y
y
y
4.71
3.19
85.7
102.03.0
3.071.0
2.01.03
3
2
1
x
x
x
[ L ] { y } { b }
[ A ] { x } { b }
LU Decomposition
4.71
3.19
85.7
102713.01.0
0103333.0
001
3
2
1
y
y
y
L y b
85.71 y
5617.190333.03.19 12 yy
0843.70)02713.0(1.04.71 213 yyy
LU Decomposition85.71 y
5617.190333.03.19 12 yy
0843.70)02713.0(1.04.71 213 yyy
0843.70
5617.19
85.7
01200.1000
29333.000333.70
2.01.03
ModifiedRHS
{ b }
LU Decomposition
• Ax=b
• A=LU - LU Decomposition
• Ly=b- Solve for y
• Ux=y - Solve for x
Matrix Inversion
4.71
3.19
85.7
102.03.0
3.071.0
2.01.03
3
2
1
x
x
x
bxA
Matrix Inversion
[A] [A]-1
[A] [A]-1=[I]
If [A]-1 does not exist[A] is singular
Matrix Inversion
b xA bxA 1A 1A
I
Matrix Inversion
bAx 1
Solution
Matrix Inversion
[A] [A]-1=[I]
100
010
001
aaa
aaa
aaa
aaa
aaa
aaa
nnn2n1
2n2221
1n1211
nnn2n1
2n2221
1n1211
Matrix Inversion
100
010
001
aaa
aaa
aaa
aaa
aaa
aaa
nnn2n1
2n2221
1n1211
nnn2n1
2n2221
1n1211
Matrix Inversion
100
010
001
aaa
aaa
aaa
aaa
aaa
aaa
nnn2n1
2n2221
1n1211
nnn2n1
2n2221
1n1211
Matrix Inversion
100
010
001
aaa
aaa
aaa
aaa
aaa
aaa
nnn2n1
2n2221
1n1211
nnn2n1
2n2221
1n1211
Matrix Inversion
• To calculate the invert of a nxn matrix solve n times :
nj
2j
1j
nj
2j
1j
nnn2n1
2n2221
1n1211
a
a
a
aaa
aaa
aaa
nj ,,2,1
otherwise
ji if
0
1ij
Matrix Inversion
• For example in order to calculate the inverse of:
102.03.0
3.071.0
2.01.03
Matrix Inversion
• First Column of Inverse is solution of
0
0
1
a
a
a
102.03.0
3.071.0
2.01.03
31
21
11
Matrix Inversion
0
1
0
a
a
a
102.03.0
3.071.0
2.01.03
32
22
12
• Second Column of Inverse is solution of
Matrix Inversion
• Third Column of Inverse is solution of:
1
0
0
a
a
a
102.03.0
3.071.0
2.01.03
33
23
13
Use LU Decomposition
102713.01.0
0103333.0
001
01200.1000
29333.000333.70
2.01.03
102.03.0
3.071.0
2.01.03
A
Use LU Decomposition – 1st column
• Forward SUBSTITUTION
0
0
1
y
y
y
102713.01.0
0103333.0
001
31
21
11
111 y
03333.00333.00 1121 yy
1009.002713.01.00 211131 yyy
Use LU Decomposition – 1st column
• Back SUBSTITUTION
1009.0
0333.0
1
a
a
a
01200.1000
29333.000333.70
2.01.03
31
21
11
010078.0012.10/1009.0a31
00518.000333.7/a2933.00333.0a 3121
332489.03/a2.0a1.01a 312111
Use LU Decomposition – 2nd Column
• Forward SUBSTITUTION
0
1
0
y
y
y
102713.01.0
0103333.0
001
32
22
12
012 y
122 y
02713.002713.01.00 221232 yyy
Use LU Decomposition – 2nd Column
• Back SUBSTITUTION
02713.0
1
0
a
a
a
01200.1000
29333.000333.70
2.01.03
32
22
12
002709.0012.10/02713.0a32
1429.000333.7/a2933.01a 3222
004944.03/a2.0a1.00a 322212
Use LU Decomposition – 3rd Column
• Forward SUBSTITUTION
1
0
0
y
y
y
102713.01.0
0103333.0
001
33
23
13
013 y
023 y
102713.01.01 231333 yyy
Use LU Decomposition – 3rd Column
• Back SUBSTITUTION
1
0
0
a
a
a
01200.1000
29333.000333.70
2.01.03
33
23
13
09988.0012.10/1a33
004183.000333.7/a2933.00a 3323
006798.03/a2.0a1.00a 332313
Result
102.03.0
3.071.0
2.01.03
A
09988.000271.001008.0
004183.0142903.000518.0
006798.0004944.0332489.0
A 1
Test It
09988.000271.001008.0
004183.0142903.000518.0
006798.0004944.0332489.0
102.03.0
3.071.0
2.01.03
11046.30
1047.31106736.8
0108.11
18
1818
18
Iterative Methods
Recall Techniques for Root finding of Single Equations
Initial Guess
New Estimate
Error Calculation
Repeat until Convergence
Gauss Seidel
3
2
1
3
2
1
333231
232221
131211
b
b
b
x
x
x
aaa
aaa
aaa
11
31321211 a
xaxabx
22
32312122 a
xaxabx
33
23213133 a
xaxabx
Gauss Seidel
11
1
11
1312111
00
a
b
a
aabx
22
23112121
2
0
a
axabx
33
1232
113131
3 a
xaxabx
First Iteration: 0,0,0 321 xxx
Better Estimate
Better Estimate
Better Estimate
Gauss Seidel
11
1313
121212
1 a
xaxabx
22
1323
212122
2 a
xaxabx
33
2232
213132
3 a
xaxabx
Second Iteration: 13
12
11 ,, xxx
Better Estimate
Better Estimate
Better Estimate
Gauss SeidelIteration Error:
%1001
, ji
ji
ji
ia x
xx
s
Convergence Criterion:
n
jij
ijii aa1
nnn2n1
2n2221
1n1211
aaa
aaa
aaa
Jacobi Iteration
3
2
1
3
2
1
333231
232221
131211
b
b
b
x
x
x
aaa
aaa
aaa
11
31321211 a
xaxabx
22
32312122 a
xaxabx
33
23213133 a
xaxabx
Jacobi Iteration
11
1
11
1312111
00
a
b
a
aabx
22
2321212
00
a
aabx
33
3231313
00
a
aabx
First Iteration: 0,0,0 321 xxx
Better Estimate
Better Estimate
Better Estimate
Jacobi Iteration
11
1313
121212
1 a
xaxabx
22
1323
112122
2 a
xaxabx
33
1232
113132
3 a
xaxabx
Second Iteration: 13
12
11 ,, xxx
Better Estimate
Better Estimate
Better Estimate
Jacobi Iteration
Iteration Error:
%1001
, ji
ji
ji
ia x
xx
s
top related