Using MATLAB Solve the following system of equations using a
Using MATLAB:
Solve the following system of equations using (a) Gauss Elimination, (b) LU Decomposition. You may use the Matlab functions we\'ve discussed rather than performing the methods by hand. Explain any differences in the results. -5.x_1 + 12x_3 =60 4x_1 + x_2 - x_3 = -2 x_1 -2x_2 + 12x_3 =-86Solution
-5x1 + 0x2 + 12x3 = 60 ----> R1
4x1 + x2 - x3 = -2 ----> R2
x1 - 2x2 + 12x3 = -86 ----> R3
I see that the coeeficient of x2 as 0 in R1
So let\'s make coefficient of x2 as 0 in R2
R2\' -> 2*R2 + R3
-5x1 + 0x2 + 12x3 = 60 ----> R1
9x1 + 0x2 + 10x3 = -90 ----> R2\'
x1 - 2x2 + 12x3 = -86 ----> R3
Now let\'s make the magnitude of the co-efficient of x3 same in R1 and R2
R1\' -> 5*R1 and R2\'\' -> -6*R2\'
-25x1 + 0x2 + 60x3 = 300 ----> R1\'
-54x1 + 0x2 - 60x3 = 540 ----> R2\'\'
x1 - 2x2 + 12x3 = -86 ----> R3
Now, make the coefficient of x3 as 0 in R1
R1\'\' -> R1\' + R2\'\'
-79x1 + 0x2 + 0x3 = 840 ----> R1\'\'
-54x1 + 0x2 - 60x3 = 540 ----> R2\'\'
x1 - 2x2 + 12x3 = -86 ----> R3
Now R1\'\' only has coefficients of x2 and x3 eliminated, find x1 using R1\'\'
we get: x1 = -840/79
Substituting x1 in R2\'\'
we get: x3 = 45/79
Substituting x1 and x3 found above in R3 to find x2
we get: x2 = 3247/79
Hence,
x1 = -840/79
x2 = 3247/79
x3 = 45/79
