Sei sulla pagina 1di 7

Gaussian Elimination of a 4x5 Matrix A

A=
20
6
10
12

5
15
7
5

12
9
23
4

8
7
42
3

9
52
8
21

First we divide the first row by 20 to get a pivot of 1 at the


A (1,1) spot:
A=
1 0.25
6
15
10 7
12 5

0.6
9
23
4

0.4
7
42
3

0.45
52
8
21

Then we need to get a 0 just below the first pivot. To do


this we must multiply the first row by -6 and add it to the
second row.
A=
1
0
10
12

0.25
13.5
7
5

0.6
5.4
23
4

0.4
4.6
42
3

0.45
49.3
8
21

Then we must get a 0 in the 3rd row of the first column


underneath the first pivot. To do this we must multiply the
first row by -10 and add it to the third row.

A=
1
0
0
12

0.25
13.5
4.5
5

0.6
5.4
17
4

0.4
4.6
38
3

0.45
49.3
3.5
21

Then we must get a 0 in the 4th row of the first column. To


do this we must multiply the first row by -12 and add it to
the 4th row.
A=
1
0
0
0

0.25
13.5
4.5
2

0.6
5.4
17
-3.2

0.4
4.6
38
-1.8

0.45
49.3
3.5
15.6

Now we have to get a pivot in the second column at the A


(2,2) spot to do this we must divide the second row by
13.5.
A=
1
0
0
0

0.25
1
4.5
2

0.6
0.4
17
-3.2

0.4
46/135
38
-1.8

0.45
493/135
3.5
15.6

Then we have to get a 0 underneath the second pivot to do


this we must multiply the 2nd row by -4.5 and add it to the
3rd row.

A=
1
0
0
0

0.25
1
0
2

0.6
0.4
15.2
-3.2

0.4
46/135
547/15
-1.8

0.45
493/135
-194/15
15.6

Then we must get a 0 underneath the second column in the


forth row. To do this we must multiply the second row by -2
and add it to the 4th row.
A=
1
0
0
0

0.25
1
0
0

0.6
0.4
15.2
-4

0.4
46/135
547/15
-67/27

0.45
493/135
-194/15
218/27

Now we must get a pivot point of 1 at the A(3,3) spot of the


matrix. We must divide the 3rd row by 15.2.
A=
1
0
0
0

0.25
1
0
0

0.6
0.4
1
-4

0.4
46/135
547/228
-67/27

0.45
493/135
-97/114
218/27

Then we have to get a 0 under the 3rd pivot point. To do


this we must multiply the 3rd row by 4 and add it to the 4th
row.

A=
1
0
0
0

0.25
1
0
0

0.6
0.4
1
0

0.4
46/135
547/228
3650/513

0.45
493/135
-97/114
2396/513

Now we must get a pivot point of 1 in the 4th column of the


4th row. To do this we must multiply the fourth row by the
reciprocal of 3650/513 which is 513/3650.
A=
1
0
0
0

0.25
1
0
0

0.6
0.4
1
0

0.4
46/135
547/228
1

0.45
493/135
-97/114
1198/1825

To make this into a Row Echelon form matrix we must get


0's above the pivot as well. To do this we must divide the
2nd row by -4 and add it to the first row.
A=
1
0
0
0

0
1
0
0

0.5
0.4
1
0

17/54
46/135
547/228
1

-25/54
493/135
-97/114
1198/1825

Now we must get a 0 in the 3rd column of the first row to


do this we must divide the 3rd row by -2 and add it to the
first row.

A=
1
0
0
0

0
1
0
0

0
0.4
1
0

-3370/3809
46/135
547/228
1

-77/2052
493/135
-97/114
1198/1825

Now we must get a 0 in the 4th column of the first row. To


do this we must multiply the 4th row by 3370/3809 and add
it to the first row.
A=
1
0
0
0

0
1
0
0

0
0.4
1
0

0
46/135
547/228
1

427/786
493/135
-97/114
1198/1825

Now we must get a 0 in the third colum of the second row.


To do this we must multiply the third row by -2/5 and add it
to the second row.
A=
1
0
0
0

0
1
0
0

0
0
1
0

0
-635/1026
547/228
1

427/786
2048/513
-97/114
1198/1825

Now we must get a zero in the third column of the second


row. To do this we must multiply the 4th row by 635/1026
and add it to the second row .

A=
1
0
0
0

0
1
0
0

0
0
1
0

0
0
547/228
1

427/786
14449/3285
-97/114
1198/1825

Now We must get a zero in the 4th column of the third row
for this matrix to be in row echelon form to do this we must
multiply the 4th row by -547/228 and add that to the 3rd
row.
A=
1
0
0
0

0
1
0
0

0
0
1
0

0
0
0
1

X1
X2
X3

X4

427/786
14449/3285
-4427/1825
1198/1825

=
=
=
=

427/786
14449/3285
-4427/1825
1198/1825

clc
clear all
a=[20 5 12 8 9;6 15 9 7 52;10 7 23 42 8;12 5
4 3 21]
for i=1:4
for j=5:-1:1
a(i,j)=a(i,j)/a(i,i);
end
for k=1:4
for m=5:-1:1
if k ~= i
a(k,m)=a(k,m)(a(k,i)*a(i,m));
end
end
end
end
disp('x1='),a(1,5)
disp('x2='),a(2,5)
disp('x3='),a(3,5)
disp('x4='),a(4,5)

Potrebbero piacerti anche