REVIEW OPERASI MATRIKS
TEKNIK LINGKUNGAN ITB
MENGHITUNG INVERS MATRIKS
c11 c12 a11 a12 c 21 c22 a21 a22
1 0 0 1
c11a11 c12a21 c a c a 12 22 11 12 c21a11 c22a21 c21a12 c22a22
1 0 0 1
DETERMINAN
Hanya untuk square matrices
a det c
b a d c
b ad bc d
a1 a2 a3 det b1 b2 b3 c1 c2 c3 a1b 2 c3 a1b 3 c2 a2b 3 c1 a2b1 c3 a3b1 c2 a3b 2 c1 Jika determinan = 0 matriks singular, tidak punya invers
CARI INVERS NYA…
2 4 2 5 1 2 2 4
SISTEM PERSAMAAN LINEAR
SIMULTANEOUS LINEAR EQUATIONS
METODE PENYELESAIAN • • • • •
Metode grafik Eliminasi Gauss Metode Gauss – Jourdan Metode Gauss – Seidel LU decomposition
METODE GRAFIK 1 2 x1 4 1 1 x 2 2
Det{A} 0 A is nonsingular so invertible Unique solution
2
-2
SISTEM PERSAMAAN YANG TAK TERSELESAIKAN
No solution Det [A] = 0, but system is inconsistent Then this system of equations is not solvable
1 2 x1 4 2 4 x 5 2
SISTEM DENGAN SOLUSI TAK TERBATAS Det{A} = 0 A is singular infinite number of solutions
1 2 x1 4 2 4 x 8 2 Consistent so solvable
ILL-CONDITIONED SYSTEM OF EQUATIONS A linear system of equations is
said to be “illconditioned” if
the coefficient matrix tends to
be singular
ILL-CONDITIONED SYSTEM OF EQUATIONS • A small deviation in the entries of A matrix, causes a large deviation in the solution.
2 x1 3 x1 1 1 0.48 0.99 x 1.47 x 1 2 2
x1 3 2 x1 3 1 0.49 0.99 x 1.47 x 0 2 2
GAUSSIAN ELIMINATION Merupakan salah satu teknik paling populer dalam menyelesaikan sistem persamaan linear dalam bentuk:
AX C Terdiri dari dua step 1. Forward Elimination of Unknowns. 2. Back Substitution
FORWARD ELIMINATION Tujuan Forward Elimination adalah untuk membentuk matriks koefisien menjadi Upper Triangular Matrix
5 1 25 5 1 25 64 8 1 0 4.8 1.56 144 12 1 0 0 0.7
FORWARD ELIMINATION Persamaan linear n persamaan dengan n variabel yang tak diketahui
a11x1 a12x2 a13x3 ... a1n xn b1
a21x1 a22x2 a23x3 ... a2n xn b2 . . .
. . .
an1x1 an 2 x2 an3 x3 ... ann xn bn
CONTOH 2 x1 3x2 2 x3 x4 2 2 x1 5 x2 3x3 x4 7
matriks input
2 x1 x2 3x3 2 x4 1 5 x1 2 x2 x3 3x4 8
2 2 2 5
3 2 5 3 1 2
3 1
1 2 1 7 2 1 3 8
FORWARD ELIMINATION 2 2 2 5
3 2 5 3 1 2
3 1
1 2 1 7 2 1 3 8
1 3 1 1 1 2 2 1 2 9 0 2 0 4 1 3 1 19 6 1 3 0 2 2
R1'
R1
2 R2' R2 2 R1' R3' R3 2 R1' R4' R4 5 R1'
R1' R1 R2'
R2
2 R3' R3 4 R2' R4' R4 19 R1' 2
1 3 1 1 1 2 2 1 2 9 0 2 0 4 1 3 1 3 0 19 2 6 1 2 1 3 1 1 1 2 2 9 1 1 0 1 2 2 0 0 3 7 19 0 0 5 9 159 4 4
FORWARD ELIMINATION 1 3 1 1 1 2 2 9 1 1 0 1 2 2 0 0 3 7 19 0 0 5 9 159 4 4
R1' R1 R2' R2 R3'
R3
3
R4' R4 5 R3' 4
1 3 1 1 1 2 2 9 1 1 0 1 2 2 7 19 1 0 0 3 3 143 572 0 0 0 12 12
R1' R1 R2' R2 R3' R3 R4'
R4
143 12
1 3 1 1 1 2 2 9 1 1 0 1 2 2 7 19 1 0 0 3 3 143 572 0 0 0 12 12
1 3 1 1 1 2 2 9 1 1 0 1 2 2 7 19 0 0 1 3 3 572 0 0 0 1 143
BACK SUBSTITUTION
x1
x4 4
3 x 2 2 x2
x3 1 x3 2 x3
1 x4 2 x4 7 x4 3 x4
1 9 2 19 3 572 143
GAUSS - JOURDAN 1 3 2 15 2 4 3 22 3 4 7 39 2 15 1 3 0 2 1 8 0 5 1 6
1 0 1 2 15 0 1 1 2 4 0 0 7 2 14
R1' R1 R2' R2 2 R1' R3' R3 3R1' R1' R1 3R2' R2' R2 2 R3' R3 5 R2'
R1' R1 1 R3' 2 R2' R2 1 R3' 2 R R3' 3 7 2
2 15 1 3 0 2 1 8 0 5 1 6 1 0 1 2 15 0 1 1 2 4 0 0 7 2 14 1 0 0 1 0 1 0 2 0 0 1 4
WARNING..
Dua kemungkinan kesalahan -Pembagian dengan nol mungkin terjadi pada langkah forward elimination. Misalkan:
10 x1 7 x2 7 6 x3 2.099 x2 3x1 3.901 5 x1 x2 5 x3 6 - Kemungkinan error karena round-off (kesalahan pembulatan)
CONTOH Dari sistem persamaan linear 7 0 x1 7 10 3 2.099 6 3 . 901 x = 2 5 1 5 x3 6
7 0 7 10 3 2.099 6 3.901 5 1 5 6
Akhir dari Forward Elimination 7 0 10 0 0.001 6 0 0 15005
x1 7 x = 6.001 2 x3 15004
7 0 7 10 0 0.001 6 6 . 001 0 0 15005 15004
KESALAHAN YANG MUNGKIN TERJADI Back Substitution 7 0 x1 7 10 0 0.001 x 6.001 6 2 0 0 15005 x3 15004
x3
15004 0.99993 15005
6.001 6 x3 x2 1.5 0.001
7 7 x 2 0 x3 x1 0.3500 10
CONTOH KESALAHAN Bandung-kan solusi exact dengan hasil perhitungan
X exact X calculated
x1 0 x 2 1 x3 1 x1 0.35 x 2 1.5 x3 0.99993
IMPROVEMENTS Menambah jumlah angka penting Mengurangi round-off error (kesalahan pembulatan)
Tidak menghindarkan pembagian dengan nol
Gaussian Elimination with Partial Pivoting Menghindarkan pembagian dengan nol Mengurangi round-off error
PIVOTING Eliminasi Gauss dengan partial pivoting mengubah tata urutan baris untuk bisa mengaplikasikan Eliminasi Gauss secara Normal How? Di awal sebelum langkah ke-k pada forward elimination, temukan angka maksimum dari: a pk
akk , ak 1,k ,................, ank
Jika nilai maksimumnya Maka tukar baris p dan k.
k p n,
Pada baris ke p,
PARTIAL PIVOTING What does it Mean? Gaussian Elimination with Partial Pivoting ensures that each step of Forward Elimination is performed with the pivoting element |akk| having the largest absolute value. Jadi, Kita mengecek pada setiap langkah apakah angka mutlak yang dipakai untuk forward elimination (pivoting element) adalah selalu paling besar
PARTIAL PIVOTING: EXAMPLE Consider the system of equations
10 x1 7 x2 7 3x1 2.099 x2 6 x3 3.901 5 x1 x2 5 x3 6 In matrix form
7 0 x1 7 10 3.901 3 2.099 6 x 2 = 6 5 1 5 x 3 Solve using Gaussian Elimination with Partial Pivoting using five significant digits with chopping
PARTIAL PIVOTING: EXAMPLE Forward Elimination: Step 1 Examining the values of the first column |10|, |-3|, and |5| or 10, 3, and 5
The largest absolute value is 10, which means, to follow the rules of Partial Pivoting, we don’t need to switch the rows Performing Forward Elimination
7 0 x1 7 10 3 2.099 6 x 3.901 2 5 1 5 x3 6
7 0 x1 7 10 0 0.001 6 x 6.001 2 0 2.5 5 x3 2.5
PARTIAL PIVOTING: EXAMPLE Forward Elimination: Step 2 Examining the values of the first column |-0.001| and |2.5| or 0.0001 and 2.5
The largest absolute value is 2.5, so row 2 is switched with row 3 10 7 0 x 7 0 0
1 2.5 5 x2 2.5 0.001 6 x3 6.001
Performing the row swap
7 0 x1 7 10 0 0.001 6 x 6.001 2 0 2.5 5 x3 2.5
PARTIAL PIVOTING: EXAMPLE Forward Elimination: Step 2
Performing the Forward Elimination results in:
0 x1 7 10 7 0 2.5 x 2.5 5 2 0 0 6.002 x3 6.002
PARTIAL PIVOTING: EXAMPLE Back Substitution Solving the equations through back substitution
0 x1 7 10 7 0 2.5 x 2.5 5 2 0 0 6.002 x3 6.002
6.002 x3 1 6.002
2.5 5 x2 x2 1 2.5 7 7 x 2 0 x3 x1 0 10
PARTIAL PIVOTING: EXAMPLE Compare the calculated and exact solution The fact that they are equal is coincidence, but it does illustrate the advantage of Partial Pivoting
x1 0 X calculated x2 1 x3 1
X exact
x1 0 x 2 1 x3 1
SUMMARY
-Forward Elimination -Back Substitution -Pitfalls -Improvements -Partial Pivoting