Solving systems of linear equations using matrix method.

Let's consider a system of $n$ linear equations with $n$ unknowns of the general form.

$$ \left\{\begin{array}{lcl}a_{11}x_1+a_{12}x_2+...+a_{1n}x_n=b_1\\a_{21}x_1+a_{22}x_2+...+a_{2n}x_n=b_2\\..............................\\a_{n1}x_1+a_{n2}x_2+...+a_{nn}x_n=b_n\end{array}\right. ,\quad\quad (1)$$

or, in matrix form, $AX=B$, where

$A=\begin{pmatrix}a_{11}&a_{12}&...&a_{1n}\\a_{21}&a_{22}&...&a_{2n}\\...&...&...&...\\a_{n1}&a_{n2}&...&a_{nn}\end{pmatrix};$

$X=\begin{pmatrix}x_1\\x_2\\...\\x_n\end{pmatrix};$ $B=\begin{pmatrix}b_1\\b_2\\...\\b_n\end{pmatrix}.$

If $\det A \neq 0$, meaning the matrix $A$ has an inverse, then system (1) has a unique solution given by $X=A^{-1}B$.

Examples:

Solve the following systems using the matrix method:

1. $$\left\{\begin{array}{lcl}3x-5y=13\\2x+7y=81\end{array}\right.$$ Solution.

The matrix $A=\begin{pmatrix}3&-5\\2&7\end{pmatrix}$ is non-singular because

$\det A=\begin{vmatrix}3&-5\\2&7\end{vmatrix}=21+10=31\neq 0.$ Therefore, the system has a unique solution $X=A^{-1}B.$ Let's find the inverse matrix $A^{-1}:$

Let's find the cofactors of the corresponding elements of matrix $A:$

$A_{11}=(-1)^{1+1}\cdot7=7;$

$A_{12}=(-1)^{1+2}\cdot2=-2;$

$A_{21}=(-1)^{2+1}\cdot(-5)=5;$

$A_{22}=(-1)^{2+2}\cdot3=3.$

From here, we find the adjugate matrix:

$A^*=\begin{pmatrix}7&5\\-2&3\end{pmatrix}.$

$A^{-1}=\frac{1}{\det A}A^*=\frac{1}{31}\begin{pmatrix}7&5\\-2&3\end{pmatrix}=\begin{pmatrix}\frac{7}{31}&\frac{5}{31}\\-\frac{2}{31}&\frac{3}{31}\end{pmatrix}. $

$\begin{pmatrix}x\\y\end{pmatrix}=A^{-1}B=\begin{pmatrix}\frac{7}{31}&\frac{5}{31}\\-\frac{2}{31}&\frac{3}{31}\end{pmatrix}\begin{pmatrix}13\\81\end{pmatrix}=\begin{pmatrix}\frac{7}{31}*13+\frac{5}{31}*81\\-\frac{2}{31}*13+\frac{3}{31}*81\end{pmatrix}=$

$=\begin{pmatrix}\frac{91+405}{31}\\\frac{-26+243}{31}\end{pmatrix}=\begin{pmatrix}16\\7\end{pmatrix}.$

Answer: $x=16;$ $y=7.$

2. $$\left\{\begin{array}{lcl}7x+2y+3z=15\\ 5x-3y+2z=15\\10x-11y+5z=36\end{array}\right.$$

Solution.

The matrix $A=\begin{pmatrix}7&2&3\\5&-3&2\\10&-11&5\end{pmatrix}$ is non-singular because

$\det A=\begin{vmatrix}7&2&3\\5&-3&2\\10&-11&5\end{vmatrix}=-105-165+40+90+154-50=-36\neq 0.$ Therefore, the system has a unique solution given by

$X=A^{-1}B.$ Let's find the inverse matrix $A^{-1}:$

Let's find the cofactors of the corresponding elements of matrix $A:$

$A_{11}=(-1)^{1+1}\cdot\begin{vmatrix}-3&2\\-11&5\end{vmatrix}=-15+22=7;$

$A_{12}=(-1)^{1+2}\cdot\begin{vmatrix}5&2\\10&5\end{vmatrix}=-(25-20)=-5;$

$A_{13}=(-1)^{1+3}\cdot\begin{vmatrix}5&-3\\10&-11\end{vmatrix}=-55+30=-25;$

$A_{21}=(-1)^{2+1}\cdot\begin{vmatrix}2&3\\-11&5\end{vmatrix}=-(10+33)=-43;$

$A_{22}=(-1)^{2+2}\cdot\begin{vmatrix}7&3\\10&5\end{vmatrix}=35-30=5;$

$A_{23}=(-1)^{2+3}\cdot\begin{vmatrix}7&2\\10&-11\end{vmatrix}=-(-77-20)=97;$

$A_{31}=(-1)^{3+1}\cdot\begin{vmatrix}2&3\\-3&2\end{vmatrix}=4+9=13;$

$A_{32}=(-1)^{3+2}\cdot\begin{vmatrix}7&3\\5&2\end{vmatrix}=-(14-15)=1;$

$A_{33}=(-1)^{3+3}\cdot\begin{vmatrix}7&2\\5&-3\end{vmatrix}=-21-10=-31;$

From here, we find the adjugate matrix:

$A^*=\begin{pmatrix}7&-43&13\\-5&5&1\\-25&97&-31\end{pmatrix}.$

$A^{-1}=\frac{1}{\det A}A^*=\frac{1}{-36}\begin{pmatrix}7&-43&13\\-5&5&1\\-25&97&-31\end{pmatrix}=\begin{pmatrix}-\frac{7}{36}&\frac{43}{36}&-\frac{13}{36}\\\frac{5}{36}&-\frac{5}{36}&-\frac{1}{36}\\\frac{25}{36}&-\frac{97}{36}&\frac{31}{36}\end{pmatrix}. $

$\begin{pmatrix}x\\y\\z\end{pmatrix}=A^{-1}B=\begin{pmatrix}-\frac{7}{36}&\frac{43}{36}&-\frac{13}{36}\\\frac{5}{36}&-\frac{5}{36}&-\frac{1}{36}\\\frac{25}{36}&-\frac{97}{36}&\frac{31}{36}\end{pmatrix}\begin{pmatrix}15\\15\\36\end{pmatrix}=$

$=\begin{pmatrix}-\frac{7}{36}*15+\frac{43}{36}*15-\frac{13}{36}*36\\\frac{5}{36}*15-\frac{5}{36}*15-\frac{1}{36}*36\\\frac{25}{36}*15-\frac{97}{36}*15+\frac{31}{36}*36\end{pmatrix}=\begin{pmatrix}2\\-1\\1\end{pmatrix}.$

Answer: $x=2;$ $y=-1;$ $z=1.$

3. $$\left\{\begin{array}{lcl}x+y-2z=6\\ 2x+3y-7z=16\\5x+2y+z=16\end{array}\right.$$

Solution.

The matrix $A=\begin{pmatrix}1&1&-2\\2&3&-7\\5&2&1\end{pmatrix}$ is non-singular because

$\det A=\begin{vmatrix}1&1&-2\\2&3&-7\\5&2&1\end{vmatrix}=3-8-35+30+14-2=2\neq 0.$ Therefore, the system has a unique solution

$X=A^{-1}B.$ Let's find the inverse matrix $A^{-1}:$

Let's find the cofactors of the corresponding elements of the matrix $A:$

$A_{11}=(-1)^{1+1}\cdot\begin{vmatrix}3&-7\\2&1\end{vmatrix}=3+14=17;$

$A_{12}=(-1)^{1+2}\cdot\begin{vmatrix}2&-7\\5&1\end{vmatrix}=-(2+35)=-37;$

$A_{13}=(-1)^{1+3}\cdot\begin{vmatrix}2&3\\5&2\end{vmatrix}=4-15=-11;$

$A_{21}=(-1)^{2+1}\cdot\begin{vmatrix}1&-2\\2&1\end{vmatrix}=-(1+4)=-5;$

$A_{22}=(-1)^{2+2}\cdot\begin{vmatrix}1&-2\\5&1\end{vmatrix}=1+10=11;$

$A_{23}=(-1)^{2+3}\cdot\begin{vmatrix}1&1\\5&2\end{vmatrix}=-(2-5)=3;$

$A_{31}=(-1)^{3+1}\cdot\begin{vmatrix}1&-2\\3&-7\end{vmatrix}=-7+6=-1;$

$A_{32}=(-1)^{3+2}\cdot\begin{vmatrix}1&-2\\2&-7\end{vmatrix}=-(-7+4)=3;$

$A_{33}=(-1)^{3+3}\cdot\begin{vmatrix}1&1\\2&3\end{vmatrix}=3-2=1;$

From here, we find the adjugate matrix:

$A^*=\begin{pmatrix}17&-5&-1\\-37&11&3\\-11&3&1\end{pmatrix}.$

$A^{-1}=\frac{1}{\det A}A^*=\frac{1}{2}\begin{pmatrix}17&-5&-1\\-37&11&3\\-11&3&1\end{pmatrix}=\begin{pmatrix}\frac{17}{2}&-\frac{5}{2}&-\frac{1}{2}\\-\frac{37}{2}&\frac{11}{2}&\frac{3}{2}\\-\frac{11}{2}&\frac{3}{2}&\frac{1}{2}\end{pmatrix}. $

$\begin{pmatrix}x\\y\\z\end{pmatrix}=A^{-1}B=\begin{pmatrix}\frac{17}{2}&-\frac{5}{2}&-\frac{1}{2}\\-\frac{37}{2}&\frac{11}{2}&\frac{3}{2}\\-\frac{11}{2}&\frac{3}{2}&\frac{1}{2}\end{pmatrix}\begin{pmatrix}6\\16\\16\end{pmatrix}=$

$=\begin{pmatrix}\frac{17}{2}*6-\frac{5}{2}*16-\frac{1}{2}*16\\-\frac{37}{2}*6+\frac{11}{2}*16+\frac{3}{2}*16\\-\frac{11}{2}*6+\frac{3}{2}*16+\frac{1}{2}*16\end{pmatrix}=\begin{pmatrix}3\\1\\-1\end{pmatrix}.$

Answer: $x=3;$ $y=1;$ $z=-1.$

Homework:

Solve the systems of equations using the matrix method.

1. $\left\{\begin{array}{lcl}3x-4y=-6\\3x+4y=18.\end{array}\right. $

Answer: $x=2; y=3.$

2. $\left\{\begin{array}{lcl}2x+y=5\\x+3z=16\\5y-z=10.\end{array}\right. $

Answer: $x=1; y=3; z=5.$

3. $\left\{\begin{array}{lcl}4x_1+4x_2+5x_3+5x_4=0\\ 2x_1+3x_3-x_4=10\\x_1+x_2-5x_3=-10\\3x_2+2x_3=1.\end{array}\right. $

Answer: $x_1=1; x_2=-1; x_3=2; x_4=-2.$

Tags: