You are on page 1of 21

MATRIX INVERSE

x
A

y
-3
11
-9

1
6
8

A-1

- 3/ 5
1/ 7
71/140

X=(A-1)*b
x
y
z

Use mmult
3 3/5
- 8/9
-2 1/3

0/ 1
1/ 14
3/ 56

z
4
4
12
1/ 5
- 1/ 14
- 29/280

b
-3
2
9

=
=
=
use minverse

- 3/ 5
1/ 7
71/140

Note: The method is applicable when A is non singular (det(A) not 0)


~ 18/5
det(A)=

-280

not 0 --> A is non singular

~ -7/3

Gauss- Jordan
[A:b]

x1
1
6
8

x2
-3
11
-9

x3
4
4
12

b
-3
2
9

R2-6*R1
1
0
0

R3-8*R1
-3
29
15

4
-20
-20

-3
20
33

4
- 2/3
-20

-3
2/3
33

1 8/9
- 2/3
-9 2/3

- 8/9
2/3
22 2/3

0
1
0

1 8/9
- 2/3
1

- 8/9
2/3
-2 1/3

0
1
0

R2+.68966*R3
0
0
1

3 3/5
- 8/9
-2 1/3

R2/29
1
0
0
R1+3*R2
1
0
0

-3
1
15
R3-15*R2
0
1
0

1
0
0
R1-1.93103*R3
1
0
0
GAUSSIAN ELIMINATION

x1=18/5
x2=-1
x3=-7/3

2.33

[A:b]

R3
R2

x1
1
6
8

x2
-3
11
-9

x3
4
4
12

b
-3
2
9

R2-6*R1
1
0
0

R3-8*R1
-3
29
15

4
-20
-20

-3
20
33

29*R3-15*R2
1
0
0
x1

-3
29
0
x2

4
-20
-280
x3

-3
20
657
B

<--upper triangular form


<-- -280x3=657

By back substituion,
x3
-2 1/3
x2
-0.93
x1
3.6

LU-Decomposition
A

L11=
U11=
L22=
L32=
U23 =
L33=
L

3
1
2
3
3/3 = 1

-1
2
-2

2
3
-1

L21=
U12=

1
- 1/3

j1

ij=aij i
L31=
U13=

a22-L21*U12 = 2-(1)(-1/3) = 7/3


a32-L31*U12=(-2)-(2)(-1/3)=-4/3
(a23-L21*U13)/L22=(3-(1)(2/3))/(7/3)=1
a33 -(L31*U13+L32*U23)=(-1)-((2)(2/3)+(-4/3)(1)=-1
3

2 1/3

-1 1/3

-1

1
0
0

- 1/3
1
0

2/3
1
1

A=L*U

3
1
2

[A:b]

-1
2
-2
y
-1

2
3
-1
z
2

k =1

2
2/3

i1

aij
k =1

uij=

ii

iii) For j=1,


. =a
i1

i1

u1 j=
b
12

a1 j
11

[U:b']

b'1=
b'2=
b'3=

1
2

2
-2

3
-1

1
0
0

- 1/3
1
0

2/3
1
1

11
2
b'
4
3
2

b1/L11=12/3=4
(b2-L21*b'1)/L22=(11-(1)(4))/(7/3) = 3
(b3-L31*b'1-L32*b'2)/L33 = (2-2*4-(-4/3)*3)/-1 = 2

back substitution
z
2
y
1
x
3

ans

ITERATIVE METHOD (JACOBI)


solving each equation for one of the variables, choosing, when possible,
the variable with the largest coefficient . Each equation is simultaneously changed by using the most recent set of values of x.
x1
x2
x3
k
6
-2
1
11
1
2
-5
-1
1/6
-2
7
2
5
0
x1
x2
x3
K
0
x1=
0/ 1
1/ 3
- 1/ 6
11/ 6
x2=
2/ 7
0/ 1
- 2/ 7
5/ 7
x3=
1/ 5
2/ 5
0/ 1
1/ 5
1
2
3
4
1
0
0
0

x1
x2
x3

2
1.8333333
0.7142857
1/ 5

3
4
2.03809524
1.18095238
0.85238095

etc

9
2
1
1

Gauss-Seidel Method
1. solve each equation for one of the variables in terms of the others as in the Jacobi method.
2. Use the most recent approximations to the values of the variables.

x1
x2
x3

x1

x1
x2
x3
k
6
-2
1
-11
1
2
-5
1
-2
7
2
5
x1
x2
x3
K
0
0.3333333 -0.1666667 1.8333333
0.2857143
0
-0.2857143 0.7142857
0.2
0.4
0
0.2
1
2
3
4
1
0

2
3
4
1.8333333 2.06904762

5
1.99999

6
2

T
1.999990

x2
x3

0
0

1.2380952 1.00204082
1.0619048 1.01462585

1.00000
1.00000

1
1

1.000000
1.000000

0/ 1
1/ 14
3/ 56

s non singular (det(A) not 0)


3 3/5
- 8/9
-2 1/3

1/ 5
- 1/ 14
- 29/280

j1

ij=aij ik ukj ,

j i ,

i =1,2, .. . , n

k =1

i1

aij ik ukj
k =1

uij=

ii

iii) For j=1,

i 1 =ai 1
iv) For i=1,

u1 j=

a1 j
11

a1 j
a11

i j ,

j=2,3, . .. , n

x=Tx+C
x1=0-x2-x3+k
x1=0-x2-x3+k
1
x1
x2
x3

the most recent set of values of x.

0
1/9
- 1/6

2
0
0
0

1 5/6
5/7
1/5

0
1/7
1/9

2
1
1
0.1703056769 0.048034934 0.034934498
0.0349344978 0.061135371 0.135371179
0.0480349345 -0.16593886 0.061135371

T
0.00001

2
1
1

2
2.084920635
1 1/6 1.053061224
6/7
1.08

0.00000
0.00000

2.004353741 1.994100529 1.996536875 2.000143163 2.000406144 2.00012443 1.999973272


1.001405896 0.990327178 0.997904978 1.000453114 1.000478228 1.000056076 0.999957689
1.038208617 1.001433107 0.994950977 0.998469366 1.000209878 1.00027252 1.000047316

1.99997801
0.999978844
0.99997773

1.99999666 2.00000217 2.000001013 2.000000014 1.999999864 1.999999961


1.00000008 1.00000272 1.000000802 0.999999854 0.999999854 0.999999977
0.99998714 0.999999364 1.000001522 1.000000523 0.999999945 0.999999915

x
A

y
-3
11
-9

1
6
8

z
4
4
12

=
=
=

B
-3
2
9

Use matrix inverse.


AX = B

A is the coefficient matrix, X is the column of variables


B is the column of constants

Let inv(A) = inverse of A

inv(A)=

1
6
8

A=

x
X= y
z
-3
2
9

B=

-0.6
0
0.2
0.142857 0.07142857 -0.07143
0.507143 0.05357143 -0.10357

Inverse Solution: X = inv(A)*B


(mmult)
X
x=
3.6
y=
-0.92857143
z=
-2.34642857

(minverse)

fraction
18/ 5
18/5
- 13/ 14
- 657/280 -657/280

Gauss- Jordan Reduction Method


x1
x2
x3
B
R2-6R1 R3-8R1
[A:B]
1
-3
4
-3
1
-3
4
6
11
4
2
0
29
-20
8
-9
12
9
0
15
-20
[A:B] = augmented matrix
The Gauss- Jordan Reduction Method transforms the augmented matrix to the reduced echelon form
by applying elementary row operations.
R2 /29
1
0
0

-3
1
15

R3/-9.65517
1
0
-0

x1=
x2=
x3=

#3:

1
6
8

4
- 2/3
-20

-3
2/3
33

0 1.931034 -0.9310345
1 -0.68966 0.68965517
-0
1
-2 1/3

3.6
ANS.
-0.92858316
-2.34642916

-3
11
-9

4
4
12

-3
2
9

R1+3R2
1

R3-15R2
0
1 8/9
0
1 -0.68966
0
0 -9.65517

R1-1.931034*R3
1
0
0
1
0
0
x1
x2

R2+.68966*R3
0
0
1
x3

GAUSSIAN ELIMINATION - transforms the augmented matrix into an upper triangular matrix.
R2-6R1

R3-8R1
1
0
0

R3-15*R2
1
0
0

R2 /29
-3
29
15

-3
20
33

1
0
0

-3
4
1 -0.68966
15
-20

-3
4
-3
1 -0.68966 0.68965517
0 -9.65517 22.6551724

1
0
0

-3
4
1 -0.68966
0
1

Solve by back substitution.


x3
-2.34642916
x2
-0.92857183
x1
3.60000113 ANS

4
-20
-20

-3
11
-9

4
4
12

-3
20
33

- 8/9
0.689655
22.65517
R2+.68966*R3
3 3/5
- 8/9
-2 1/3

-3
0.689655
33

-3
0.689655
-2.34643

EXERCISE #1
PART I
x
A
1
6
8

z
-3
11
-9

k
4
4
12

=
=
=

PART 2 (Homewrork)
Solve the system by the following methods.
x
y
z
A
0.20000 -1.80000 2.10000
=
1.30000 -0.45000 1.70000
=
2.50000 1.13000 0.48000
=
#1: LU decomposition method.
#2: Jacobi Method
#3: Gauss-Seidel Method

-3
2
9

k
1.50000
2.50000
0.50000

#1: Matrix inverse method.


#2: Gauss-Jordan
#3: Gaussian-Elimination.

You might also like