How do you solve x - 2y + z = - 2, 2x - 3y + 2z = 2, and 4x - 8y + 5z = - 5 using matrices?
2 Answers
The solution is:
x=7, y=6, z=3
Explanation:
We have:
x - 2y + z = - 2
2x - 3y + 2z = 2
4x - 8y + 5z = - 5
Which we can write in vector matrix form:
( (1,-2,1), (2,-3,2), (4,-8,5) ) ( (x), (y), (z) ) = ( (-2), (2), (-5) )
Or:
bb(A) bb(ul x) = bb(ul b) => bb(ul x) = bb(A)^(-1) bb(ul b)
Where
bb(A) = ( (1,-2,1), (2,-3,2), (4,-8,5) ) ;bb(ul x) = ( (x), (y), (z) ) ;bb(ul b)= ( (-2), (2), (-5) )
We can find
Method 1 - Gaussian Elimination
Here we form an augmented matrix of the equation coefficients.
( (1, -2, 1, |, -2), (2, -3, 2, |, 2), (4, -8, 5, |, -5) )
We can now perform elementary row operations with the aim of getting leading zeros in progresisve rows:
( (1, -2, 1, |, -2), (2, -3, 2, |, 2), (4, -8, 5, |, -5) ) stackrel(R_2-2R_1 rarr R_2)(rarr) ( (1, -2, 1, |, -2), (0, 1, 0, |, 6), (4, -8, 5, |, -5) )
( (1, -2, 1, |, -2), (0, 1, 0, |, 6), (4, -8, 5, |, -5) ) stackrel(R_3-4R_1 rarr R_3)(rarr) ( (1, -2, 1, |, -2), (0, 1, 0, |, 6), (0, 0, 1, |, 3) )
We can now use back substitution to get the values of
Row
3 => z=3
Row2 => y = 6
Row1 => x-2y+z=-2
:. x-12+3=-2 => x= 7
Thus we have a unique solution:
x=7, y=6, z=3
Method 2 - Matrix Inversion
A matrix,
- Calculating the Matrix of Minors,
- Form the Matrix of Cofactors,
cof(bb(A)) - Form the adjoint matrix,
adj(bb(A)) - Multiply
adj(bb(A)) by1/abs(bb(A)) to form the inversebb(A)^-1
At some point we need to calculate
bb(A) = ( (1,-2,1), (2,-3,2), (4,-8,5) )
If we expand about the first row and "strike out" the row and column to form a smaller determinant and alternate signs we get;
abs(bb(A)) = +(1)|(-3, 2), (-8, 5)| -(-2) |(2, 2), (4, 5)| +(1)|(2, -3), (4, -8)|
\ \ \ \ \ = {(-3)(5)-(-8)(2)} +2{(2)(5)-(4)(2)} +{(2)(-8)-(4)(-3)}
\ \ \ \ \ = {-15+16} +{10-8}+{-16+12}
\ \ \ \ \ = 1 +4-4
\ \ \ \ \ = 1
As
"minors"(bb(A))=( ( |(-3, 2), (-8, 5)|, |(2, 2), (4, 5)|, |(2, -3), (4, -8)| ), ( |(-2, 1), (-8, 5)|, |(1, 1), (4, 5)|, |(1, -2), (4, -8)| ), ( |(-2, 1), (-3, 2)|, |(1, 1), (2, 2)|, |(1, -2), (2, -3)| ) )
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \= ( (-15+16, 10-8, -16+12), (-10+8, 5-4, -8+8), (-4+3, 2-2, -3+4) )
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \= ( (1, 2, -4), (-2, 1, 0), (-1, 0, 1) )
We now form the matrix of cofactors,
( (+, -, +), (-, +, -), (+, -, +) )
Where we change the sign of those elements with the minus sign to get;
cof(bbA) = ( (1, -2, -4), (2, 1, 0), (-1, 0, 1) )
Then we form the adjoint matrix by transposing the matrix of cofactors,
adj(A) = cof(A)^T
\ \ \ \ \ \ \ \ \ \ \ = ( (1, -2, -4), (2, 1, 0), (-1, 0, 1) )^T
\ \ \ \ \ \ \ \ \ \ \ = ( (1, 2, -1), (-2, 1, 0), (-4, 0, 1) )
And then finally we multiply by the reciprocal of the determinant to get:
bb(A)^-1 = 1/abs(bb A) adj(bb A)
\ \ \ \ \ \ \ = (1) ( (1, 2, -1), (-2, 1, 0), (-4, 0, 1) )
\ \ \ \ \ \ \ = ( (1, 2, -1), (-2, 1, 0), (-4, 0, 1) )
So then we get the solution the linear equations as:
bb(ul x) = bb(A)^(-1) bb(ul b) .....[star]
:. ( (x), (y), (z) ) = ( (1, 2, -1), (-2, 1, 0), (-4, 0, 1) ) ( (-2), (2), (-5) )
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ = ( ((1)(-2)+(2)(2)+(-1)(-5)), ((-2)(-2)+(1)(2)+(0)(2)), ((-4)(-2)+(0)(2)+(1)(-5)) )
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ = ( (-2+4+5), (4+2), (8-5) )
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ = ( (7), (6), (3) )
Thus we have a unique solution:
x=7, y=6, z=3
Method 3 - Cayley Hamilton Theorem
The CH-Theorem states that any square matrix satisfies its own characteristic equation. We can exploit this property to find a the inverse.
We have:
bb(A) = ( (1,-2,1), (2,-3,2), (4,-8,5) )
So, the characteristic equation is given by:
abs(bb(A) - lamdabb(I)) = 0 => abs( (1- lamda,-2,1), (2,-3- lamda,2), (4,-8,5- lamda) ) = 0
If we expand about row 1 then we get:
abs( (1- lamda,-2,1), (2,-3- lamda,2), (4,-8,5- lamda) ) = 0
(1-lamda)|(-3-lamda, 2), (-8, 5-lamda)| -(-2) |(2, 2), (4, 5-lamda)| +(1)|(2, -3-lamda), (4, -8)| = 0
:. (1-lamda){(-3-lamda)(5-lamda)-(-8)(2)}+2{(2)(5-lamda)-(4)(2)}+{(2)(-8)-(4)(-3-lamda) }= 0
:. (1-lamda){-15-2lamda+lamda^2+16} + 2{10-2lamda-8}+{-16+12+4lamda} = 0
:. (1-lamda){lamda^2-2lamda+1} + 2{2-2lamda}+{4lamda-4} = 0
:. lamda^2-2lamda+1 -lamda^3+2lamda^2-lamda + 4-4lamda +4lamda-4 = 0
:. -lamda^3+3lamda^2 -3lamda+1 = 0
:. lamda^3-3lamda^2 +3lamda-1 = 0
(Side Note - If we solve this characteristic equation we get
Then By CH-Theorem we have:
bb(A)^3-3bb(A)^2 +3bb(A)-bb(I) = 0 => bb(A)(bb(A)^2-3bb(A) +3bb(I))=bb(I)
:. bb(A)^(-1)bb(A)(bb(A)^2-3bb(A) +3bb(I)) = bb(A)^(-1)bb(I)
:. bb(A)^(-1) = bb(A)^2-3bb(A) +3bb(I)
And we can readily calculate this matrix product
bb(A)^2 = ( (1,-2,1), (2,-3,2), (4,-8,5) )( (1,-2,1), (2,-3,2), (4,-8,5) )
\ \ \ \ \ = ( (1-4+4,-2+6-8,1-4+5), (2-6+8,-4-9-16,2-6+10), (4-16+20,-8+24-40,4-16+25) )
\ \ \ \ \ = ( (1,-4,2), (4,-11,6), (8,-24,13) )
And so we have:
bb(A)^(-1) = bb(A)^2-3bb(A) +3bb(I)
\ \ \ \ \ \ \ \ = ( (1,-4,2), (4,-11,6), (8,-24,13) )-3( (1,-2,1), (2,-3,2), (4,-8,5) )+3( (1,0,0), (0,1,0), (0,0,1) )
\ \ \ \ \ \ \ \ = ( (1,-4,2), (4,-11,6), (8,-24,13) )-( (3,-6,3), (6,-9,6), (12,-24,15) )+( (3,0,0), (0,3,0), (0,0,3) )
\ \ \ \ \ \ \ \ = ( (1-3+3,-4+6,2-3), (4-6,-11+9+3,6-6), (8-12,-24+24,13-15+3) )
\ \ \ \ \ \ \ \ = ( (1,-2,-1), (-2,1,0), (-4,0,1) ) , as above and we proceed with[star] in Method 2.
I got
Explanation:
Have a look: