Matrices Part3

From StpmWiki

Jump to: navigation, search

Contents


System of Linear Equations

System of linear equations can be solved using matrix method.

Note that :

  • If the question IS a matrix question, we MUST use matrix method. Using other methods will result in ZERO marks, EVEN if it seems easier at times just to use simultaneous equations. Remember, STPM test your methods/concepts, not just answers (any scientific calculator can give answers anyway)
  • If it ISN'T a matrix question, using the normal simultaneous equations is much easier most of the time.

Let's see how it is done. First, we see that

  • \begin{pmatrix} a & b\\ c & d \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} k \\ l \end{pmatrix}

will mean

  • ax+by=k\, and
  • cx+dy=l\,

In other words, the matrix equation represent the two linear equations. Conversely, any system of linear equations can be transformed into a matrix equation. We will then solve the matrix equation to obtain the solution to the system of linear equations.

Writing the Matrix Equation

If needed, rewrite the equations to the "standard form" (refer below) before writing the matrix equation to minimize careless mistakes.

  • \begin{pmatrix} a & b\\ c & d \end{pmatrix}\begin{pmatrix} {\color{Red}x} \\ {\color{Blue}y} \end{pmatrix}=\begin{pmatrix} k \\ l \end{pmatrix} \iff \begin{align}
a{\color{Red}x}+b{\color{Blue}y} &= k \\ c{\color{Red}x}+d{\color{Blue}y} &= l
\end{align}
  • \begin{pmatrix} a & b & c \\ d & e & f \\ g & h & i \end{pmatrix}\begin{pmatrix} {\color{Red}x} \\ {\color{Blue}y} \\ {\color{Green}z} \end{pmatrix}=\begin{pmatrix} j \\ k \\ l \end{pmatrix} \iff \begin{align}
a{\color{Red}x}+b{\color{Blue}y}+c{\color{Green}z} &= j \\ d{\color{Red}x}+e{\color{Blue}y}+f{\color{Green}z} &= k \\
g{\color{Red}x}+h{\color{Blue}y}+i{\color{Green}z} &= l \\
\end{align}


Examples

Rewrite the following system of linear equations into a matrix equation

  • \begin{align}
2x+3y &= 6 \\
x+y &=1
\end{align} \begin{pmatrix} 2 & 3 \\ 1 & 1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} 6 \\ 1
\end{pmatrix}
    • Analyze :
      • It is already in the form we need. I prefer to write it part by part rather than line by line.
      • \begin{pmatrix} \quad & \quad \\ \quad & \quad \end{pmatrix}\begin{pmatrix} {\color{Red}x} \\ {\color{Red}y} \end{pmatrix}=\begin{pmatrix} \quad \\ \quad
\end{pmatrix}
      • \begin{pmatrix} {\color{Red}2} & {\color{Red}3} \\ {\color{Red}1} & {\color{Red}1} \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} \quad \\ \quad
\end{pmatrix}
      • \begin{pmatrix} 2 & 3 \\ 1 & 1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} {\color{Red}6} \\ {\color{Red}1}
\end{pmatrix}


  • \begin{align}
a-3b &= -7 \\
-2a-b &=5
\end{align} \begin{pmatrix} 1 & -3 \\ -2 & -1 \end{pmatrix}\begin{pmatrix} a \\ b \end{pmatrix}=\begin{pmatrix} -7 \\ 5
\end{pmatrix}
    • Analyze : Variables are a,b\,, be careful with the minus/negative signs


  • \begin{align}
x+y+1 = 0 \\
y =x-2
\end{align} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} -1 \\ 2
\end{pmatrix} or \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} -1 \\ -2
\end{pmatrix}
    • Analyze
      • This requires a bit of work, its best to take the time to rewrite it rather than risk making a careless mistake
      • x+y+1 = 0\, needs to be changed to x+y = -1 \,
      • As for y = x-2\,, remember we need x\, followed by y\, and then equals number, so it will be x-y=2\, or -x+y=-2\,
      • \begin{align}
x+y &=-1 \\
x-y & =2
\end{align} or \begin{align}
x+y &=-1 \\
-x+y &=-2
\end{align}


  • \begin{align}
2x &= y \\
y-x &= 7
\end{align} \begin{pmatrix} 2 & -1 \\ -1 & 1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} 0 \\ 7
\end{pmatrix}
    • \begin{align}
2x-y &=0 \\
-x+y &=7
\end{align}


  • \begin{align}
x+2y-z &= 7 \\
3x-2y+4z &= -8 \\
2x+5y-7z &= 1 
\end{align} \begin{pmatrix} 1 & 2 & -1 \\ 3 & -2 & 4 \\ 2 & 5 & -7\end{pmatrix}\begin{pmatrix} x \\ y \\z \end{pmatrix}=\begin{pmatrix} 7 \\ -8 \\ 1
\end{pmatrix}
    • Analyze : Three variables, but nicely arranged already


  • \begin{align}
x-2y &= -1\\
3z+2x &= 2 \\
5y-7z &= 3 
\end{align} \begin{pmatrix} 1 & -2 & 0 \\ 2 & 0 & 3 \\ 0 & 5 & 7\end{pmatrix}\begin{pmatrix} x \\ y \\z \end{pmatrix}=\begin{pmatrix} -1 \\ 2 \\ 3
\end{pmatrix}
    • Analyze
      • There are 3 variables, but the each equation have only 2, which means there are coefficients which are zero (important). It's best to rearrange them and align them nicely or we can even add the zeros
      • \begin{array}{llll}
x & -2y &     & = -1 \\
2x&     & +3z & = 2 \\
  & 5y  & -7z & = 3 \\
\end{array} or \begin{array}{llll}
x & -2y & +0z  & = -1 \\
2x& +0y & +3z & = 2 \\
0x& +5y  & -7z & = 3 \\
\end{array}

Solving

It's important to understand the steps

  • Change the system of linear equations to a matrix equation (refer to prior given matrices, if any)
  • Solve the matrix equation (method depends on question)
  • Obtain the solution of the system of linear equations
  • Check your answers!

Take note of the last two steps!

Example

Solve the following using matrix method

  • Important Note : This is a direct type of question, which is actually very rare in STPM. Most of the time, its the hence/deduce type which has a very different method to find the inverse.


  • \begin{align}
2x -3y &=-13  \\
x +5y &= 13 
\end{align}
  • x=-2, y=3\,
  • Rewrite as matrix equation. Don't need rearranging.
    • \begin{pmatrix} 2 & -3 \\ 1 & 5 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} -13 \\ 13 \end{pmatrix}
    • Naming the matrix makes it easier for us to write the working. Write out the full working even though it might not be fully required.
    • Let \mathbf{A}=\begin{pmatrix} 2 & -3 \\ 1 & 5 \end{pmatrix}
    • \therefore \mathbf{A}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} -13 \\ 13 \end{pmatrix}
    • \mathbf{A}^{-1}\mathbf{A}\begin{pmatrix} x \\ y \end{pmatrix}=\mathbf{A}^{-1}\begin{pmatrix} -13 \\ 13 \end{pmatrix}
    • No choice but to use formula to find inverse
    • \mathbf{I}\begin{pmatrix} x \\ y \end{pmatrix}=\frac{1}{10-\left(-3\right)}\begin{pmatrix} 5 & 3 \\ -1 & 2 \end{pmatrix}\begin{pmatrix} -13 \\ 13 \end{pmatrix}
    • As usual, multiply the matrices first, leave the scalar outside
    • \begin{pmatrix} x \\ y \end{pmatrix}=\frac{1}{13}\begin{pmatrix} -26 \\ 39 \end{pmatrix}
    • =\begin{pmatrix} -2 \\ 3 \end{pmatrix}
    • Done! Nope
    • \therefore x=-2, y=3
    • Done! Nope
    • Check. 2\left(-2\right)-3\left(3\right)=-13, \left(-2\right)+5\left(3\right)=13. No problem here.


  • \begin{align}
x +y +z &=1  \\
2x -y +3z &=-1 \\
-x+2y-z &=-1 
\end{align}
  • x=4,y=0,z=-3\,
  • Similar to above. Just that need more steps to find inverse.
    • \begin{pmatrix}
1 & 1 & 1 \\ 2 & -1 & 3 \\ -1 & 2 & -1
\end{pmatrix}\begin{pmatrix}x \\ y \\ x\end{pmatrix}=\begin{pmatrix}1 \\ -1 \\ -1\end{pmatrix}
    • Let \mathbf{A}=\begin{pmatrix}
1 & 1 & 1 \\ 2 & -1 & 3 \\ -1 & 2 & -1
\end{pmatrix}
    • Use the adjoin method to find inverse (lazy to type out full working here). It's NOT needed to multiply the scalar in (we are not asked to find the inverse)
    • \begin{align}
&.\\
&.\\
&.\\
\mathbf{A}^{-1}&=-\frac{1}{3}\begin{pmatrix}
-5 & 3 & 4 \\ -1 & 0 & -1 \\ 3 & -3 & -3
\end{pmatrix}\end{align}
    • \mathbf{A}\begin{pmatrix} x \\ y \\z \end{pmatrix}=\begin{pmatrix} 1 \\ -1 \\ -1 \end{pmatrix}
    • \mathbf{A}^{-1}\mathbf{A}\begin{pmatrix} x \\ y \\z \end{pmatrix}=\mathbf{A}^{-1}\begin{pmatrix} 1 \\ -1 \\ -1 \end{pmatrix}
    • \mathbf{I}\begin{pmatrix} x \\ y \\z \end{pmatrix}=-\frac{1}{3}\begin{pmatrix}
-5 & 3 & 4 \\ -1 & 0 & -1 \\ 3 & -3 & -3
\end{pmatrix}\begin{pmatrix} 1 \\ -1 \\ -1 \end{pmatrix}
    • \begin{pmatrix} x \\ y \\z \end{pmatrix}=-\frac{1}{3}\begin{pmatrix} -12 \\ 0 \\ 9 \end{pmatrix}
    • =\begin{pmatrix} 4 \\ 0 \\ -3 \end{pmatrix}
    • x=4,y=0,z=-3\,
    • Getting round numbers as answers are always encouraging in these type of questions, (rarely will the answer be fractions), BUT we need to check anyway (check answer satisfies ALL 3 equations)


Using Inverses Already Found

Often, we are required to use the inverse found from earlier parts of the question to solve the system of linear equations (Or we will be asked to find/prove a matrix equation, from which we can find the inverse).

Sometimes though, it seems the matrix we get from the system of linear equations is not the same as the earlier given matrix. In this case, we must rearrange/rewrite the equations until it can give us the same matrix.

To do that, we can

  • rearrange the order of the equations (move up/down)
  • multiply/divide any equation with a scalar (remember to multiply/divide BOTH sides)

Important Note : By far, the most serious mistake is using the adjoin method, especially when students find their matrix is different from the earlier given matrix . It is serious because not only you lose all/almost all marks in the potentially easiest question in the entire paper, you also lose precious time. Note that even if they don't mention hence/deduce, the adjoin method is still unacceptable.

Example

\mathbf{P}=\begin{pmatrix} 1 & 1 & 0 \\ 2 & 0 & -1 \\ 0 & 2 & -3 \end{pmatrix} \mathbf{Q}=\begin{pmatrix} 2 & 3 & -1 \\ 6 & -3 & 1 \\ 4 & -2 & -2 \end{pmatrix}. Find \mathbf{PQ}. Hence, find \mathbf{P}^{-1} & \mathbf{Q}^{-1}. Solve the following system of linear equations


  • \begin{align}
2x+3y-z &=8 \\
6x-3y+z &=0 \\
4x-2y-2z &=2 \\
\end{align}


  • \begin{array}{l}
x+y=5 \\
2x=z \\
2y-3z =-12 \\
\end{array}


  • \begin{array}{l}
2x+2y =8 \\
2x-z =0 \\
4y =6z-8 \\
\end{array}


  • \begin{array}{l}
2x=y+z \\
2x+3y=z \\
6x+z=3y\\
\end{array}


Solving Problems

Exercise 4

1) Using matrix method, solve the following

  • a) \begin{align} x + 2y &= -7 \\ 3x &= y \end{align} x=-1,y=-3\,
    • \begin{align}
x + 2y &= -7 \\
3x - y & = 0 \end{align}
    • \begin{pmatrix} 1 & 2 \\ 3 & -1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}=\begin{pmatrix} -7 \\ 0 \end{pmatrix}
    • Let \mathbf{A}=\begin{pmatrix} 1 & 2 \\ 3 & -1 \end{pmatrix}
    • \begin{align}
\mathbf{A}\begin{pmatrix} x \\ y \end{pmatrix}&=\begin{pmatrix} -7 \\ 0 \end{pmatrix}\\
\mathbf{A}^{-1}\mathbf{A}\begin{pmatrix} x \\ y \end{pmatrix}&=\mathbf{A}^{-1}\begin{pmatrix} -7 \\ 0 \end{pmatrix}\\
\mathbf{I}\begin{pmatrix} x \\ y \end{pmatrix}&=\frac{1}{-1-6}\begin{pmatrix} -1 & -2 \\ -3 & 1 \end{pmatrix}\begin{pmatrix} -7 \\ 0 \end{pmatrix}\\
\begin{pmatrix} x \\ y \end{pmatrix}&=-\frac{1}{7}\begin{pmatrix} 7 \\ 21 \end{pmatrix}\\
&=\begin{pmatrix} -1 \\ -3 \end{pmatrix}
\end{align}
    • \therefore x=-1, y=-3

  • b) \begin{align} 2x -y +z &= 8 \\ x +3y -4z &= 13 \\ 3x + y &=5 \end{align} x=2,y=-1,z=3 \,
    • \begin{array}{llll} 2x &-y &+z &= 8 \\ x &+3y &-4z &= 13 \\ 3x &+y & &=5 \end{array}
    • \begin{pmatrix} 2 & -1 & 1 \\ 1 & 3 & -4 \\3 & 1 & 0 \end{pmatrix}\begin{pmatrix} x \\ y \\z \end{pmatrix}=\begin{pmatrix} 8 \\ -13 \\ 5 \end{pmatrix}
    • Let \mathbf{A}=\begin{pmatrix} 2 & -1 & 1 \\ 1 & 3 & -4 \\3 & 1 & 0 \end{pmatrix}
    • \begin{align}\left|\mathbf{A}\right| & =2\begin{vmatrix} 3 & -4 \\ 1 & 0 \\ \end{vmatrix}-\left(-1\right)\begin{vmatrix} 1 & -4 \\ 3 & 0 \\ \end{vmatrix}+1\begin{vmatrix} 1 & 3 \\ 3 & 1 \\ \end{vmatrix}\\ & = 2\left(4\right)+12-8\\ & = 12 \end{align}
    • \mathbf{A}^T= \begin{pmatrix} 2 & 1 & 3\\ -1 & 3 & 1 \\ 1 & -4 & 0 \end{pmatrix}
    • \begin{align} 
adj \mathbf{A}&=\begin{pmatrix} \begin{vmatrix} 3 & 1 \\ -4 & 0 \\ \end{vmatrix} & -\begin{vmatrix} -1 & 1 \\ 1 & 0 \\ \end{vmatrix} & \begin{vmatrix} -1 & 3 \\ 1 & -4 \\ \end{vmatrix} \\ -\begin{vmatrix} 1 & 3 \\ -4 & 0 \\ \end{vmatrix} & \begin{vmatrix} 2 & 3 \\ 1 & 0 \\ \end{vmatrix} & -\begin{vmatrix} 2 & 1 \\ 1 & -4 \\ \end{vmatrix} \\ \begin{vmatrix} 1 & 3 \\ 3 & 1 \\ \end{vmatrix} & -\begin{vmatrix} 2 & 3 \\ -1 & 1 \\ \end{vmatrix} & \begin{vmatrix} 2 & 1 \\ -1 & 3 \\ \end{vmatrix} \end{pmatrix}\\
&=\begin{pmatrix} 4 & 1 & 1\\ -12 & -3 & 9 \\ -8 & -5 & 7 \end{pmatrix}
\end{align}
    • \begin{align}
\mathbf{A}^{-1} & = \frac{1}{\left|\mathbf{A}\right|}adj \mathbf{A}\\
& = \frac{1}{12}\begin{pmatrix} 4 & 1 & 1\\ -12 & -3 & 9 \\ -8 & -5 & 7 \end{pmatrix}
\end{align}
    • \begin{align}
\therefore \mathbf{A}\begin{pmatrix} x \\ y \\z \end{pmatrix}&=\begin{pmatrix} 8 \\ -13 \\ 5 \end{pmatrix}\\
\mathbf{A}^{-1}\mathbf{A}\begin{pmatrix} x \\ y \\z \end{pmatrix}&=
\mathbf{A}^{-1}\begin{pmatrix} 8 \\ -13 \\ 5 \end{pmatrix}\\
\mathbf{I}\begin{pmatrix} x \\ y \\z \end{pmatrix}&=\frac{1}{\left|\mathbf{A}\right|}adj \mathbf{A}\\
& = \frac{1}{12}\begin{pmatrix} 4 & 1 & 1\\ -12 & -3 & 9 \\ -8 & -5 & 7 \end{pmatrix}
\begin{pmatrix} 8 \\ -13 \\ 5 \end{pmatrix}\\
& = \frac{1}{12}\begin{pmatrix} 24 \\ -12 \\ 36 \end{pmatrix}\\
& = \begin{pmatrix} 2 \\ -1 \\ 3 \end{pmatrix}\\
\end{align}
    • \therefore x=2,y=-1,z=3


2) \mathbf{P}=\begin{pmatrix} 2 & 1 & -1 \\ 0 & -2 & 3 \\ -2 & 2 & -2 \end{pmatrix} \mathbf{Q}=\begin{pmatrix} 2 & 0 & -1 \\ 6 & 6 & 6 \\ 4 & 6 & 4 \end{pmatrix}. Find \mathbf{PQ}. Hence, find \mathbf{P}^{-1} & \mathbf{Q}^{-1}. Solve the following system of linear equations

  • a) \begin{array}{l}
2x+y-z=3\\
2y=3z\\
y=x+z
\end{array} x=1,y=3,z=2\,

  • b) \begin{array}{l}
a+b+c=3\\
2a=c+4\\
2a+3b+2c=4
\end{array} a=3,b=-2,c=2\,

Personal tools