Week 1

We’ve seen something like this before:

{xy=12x+3y=4\left\{ \begin{align*} x-y&=1 \\ 2x+3y&=4 \end{align*} \right.

To solve, we simply rewrite for one of the terms and substitute into the other equation.

xy=1    x=1+y2x+3=4    2(1+y)+3y=4    5y=2y=25\begin{align*} x-y=1 &\implies x=1+y \\ 2x+3=4 &\iff 2(1+y)+3y = 4 \\ &\iff 5y = 2 \end{align*} \\ \therefore y=\frac{2}{5}

And to solve for xx, simply plug it back into one of the equations.

xy=1x=1+25=75x-y=1 \\ \therefore x = 1 + \frac{2}{5} = \frac{7}{5}

Easy! Now, what about three equations?

{2x+y+z=34x+3y+z=2x+2y+3z=5\left\{ \begin{align*} 2x+y+z&=3 \\ 4x+3y+z &= 2 \\ x+2y+3z&=5 \end{align*} \right.

Or more generally:

{a11x+a12y+a13z=b1a21x+a22y+a23z=b2a31x+a32y+a33z=b3\left\{ \begin{align*} a_{11}x + a_{12}y + a_{13}z &= b_1 \\ a_{21}x + a_{22}y + a_{23}z &= b_2 \\ a_{31}x + a_{32}y + a_{33}z &= b_3 \\ \end{align*} \right.

“How do we develop an algorithm to solve systems of linear equations?”

Elementary row operations

First, consider something with a lot of zeros:

{a11x+a12y+a13z=b1a21x+a22y+a23z=b2a31x+a32y+a33z=b3\left\{ \begin{align*} a_{11}x \phantom{+ a_{12}y + a_{13}z} &= b_1 \\ \phantom{a_{21}x + }a_{22}y \phantom{+ a_{23}z} &= b_2 \\ \phantom{a_{31}x + a_{32}y + }a_{33}z &= b_3 \\ \end{align*} \right.
Then, it’s pretty easy!

x=b1a11,y=b2a22,z=b3a33\therefore x=\frac{b_1}{a_{11}},y=\frac{b_2}{a_{22}},z=\frac{b_3}{a_{33}}

Now, how about:

{2x=3    x=233y+z=23z=5    z=53\left\{ \begin{align*} 2x &= 3 &\implies x=\frac{2}{3} \\ 3y+z &= 2 \\ 3z &= 5 &\implies z=\frac{5}{3} \end{align*} \right.

Then, simply plug the value for zz to solve for yy in the section equation.

y=2533=19y=\frac{2-\frac{5}{3}}{3} = \frac{1}{9}

How about if we add another variable to the first equation:

{2x+z=33y+z=2    y=193z=5    z=53\left\{ \begin{align*} 2x+z &= 3 \\ 3y+z &= 2 &\implies y=\frac{1}{9}\\ 3z &= 5 &\implies z=\frac{5}{3} \end{align*} \right.

Same deal, we solve for yy by plugging in the known value for zz. From the last example, we alraedy know y=19\displaystyle y=\frac{1}{9}. So, we just need to solve for xx by plugging in the value for zz in the first equation:

x=3532=23x=\frac{3-\frac{5}{3}}{2}=\frac{2}{3}

And… one more variable:

{2x+y+z=33y+z=2    y=193z=5    z=53\left\{ \begin{align*} 2x+y+z &= 3 \\ 3y+z &= 2 &\implies y=\frac{1}{9}\\ 3z &= 5 &\implies z=\frac{5}{3} \end{align*} \right.

Again, the pattern here is to solve the smaller systems first (here, it is the last equation) and plug in the known values into another equation. So:

x=319532=1118x=\frac{3-\frac{1}{9}-\frac{5}{3}}{2}=\frac{11}{18}

Okay, now back to the same question. How do we solve something like this.

{2x+y+z=34x+3y+z=2x+2y+3z=5\left\{ \begin{align*} 2x+y+z&=3 \\ 4x+3y+z &= 2 \\ x+2y+3z&=5 \end{align*} \right.

First we double the first equation (R1R_1 herein).

4x+2y+2z=64x+3y+z=2x+2y+3z=5\begin{align*} 4x+2y+2z&=6 \\ 4x+3y+z &= 2 \\ x+2y+3z&=5 \end{align*}

Note that doubling the first equation does not change the solutions. They are still equivalent.

{2x+y+z=34x+3y+z=2x+2y+3z=5    {4x+2y+2z=64x+3y+z=2x+2y+3z=5\left\{ \begin{align*} 2x+y+z&=3 \\ 4x+3y+z &= 2 \\ x+2y+3z&=5 \end{align*} \right. \quad\iff\quad \left\{ \begin{align*} 4x+2y+2z&=6 \\ 4x+3y+z &= 2 \\ x+2y+3z&=5 \end{align*} \right.

We doubled R1R_1 to eliminate the xx. Now, we subtract R2R_2 from R1R_1.

{4x+2y+2z=64x+3y+z=2x+2y+3z=5R2R1{4x+2y+2z=6yz=4x+2y+3z=5\left\{ \begin{align*} 4x+2y+2z&=6 \\ 4x+3y+z &= 2 \\ x+2y+3z&=5 \end{align*} \right. \quad\xrightarrow{R_2-R_1}\quad \left\{ \begin{align*} 4x+2y+2z&=6 \\ y-z &= -4 \\ x+2y+3z&=5 \end{align*} \right.

Then, we do a similar thing to R3R_3 to get rid of xx.

{4x+2y+2z=6yz=4x+2y+3z=54×R3{4x+2y+2z=6yz=44x+8y+12z=20R3R1{4x+2y+2z=6yz=46y+10z=14\begin{array}{c} \left\{ \begin{align*} 4x+2y+2z&=6 \\ y-z &= -4 \\ x+2y+3z&=5 \end{align*} \right. &\xrightarrow{4\times R_3}& \left\{ \begin{align*} 4x+2y+2z&=6 \\ y-z &= -4 \\ 4x+8y+12z&=20 \end{align*} \right. \\ &\xrightarrow{R_3 - R_1}& \left\{ \begin{align*} 4x+2y+2z&=6 \\ y-z &= -4 \\ 6y+10z&=14 \end{align*} \right. \end{array}

Again, multiplying (or dividing) a row does not change the solutions. Nor does adding or subtracting one row from another.

Now, we see that R1R_1 and R2R_2 are both divisible by two, so we’ll simplify them.

{4x+2y+2z=6yz=46y+10z=1412×R312×R1{2x+y+z=3yz=43y+5z=7\left\{ \begin{align*} 4x+2y+2z&=6 \\ y-z &= -4 \\ 6y+10z&=14 \end{align*} \right. \quad\xrightarrow[\frac{1}{2}\times R_3] {\frac{1}{2}\times R_1}\quad \left\{ \begin{align*} 2x+y+z&=3 \\ y-z &= -4 \\ 3y+5z &= 7 \end{align*} \right.

Then, we multiply R2R_2 by three so that we can subtract R3R_3 to get rid of yy.

{2x+y+z=3yz=43y+5z=73×R2{2x+y+z=33y3z=123y+5z=7R3R2{2x+y+z=33y3z=128z=19\begin{array}{c} \left\{ \begin{align*} 2x+y+z&=3 \\ y-z &= -4 \\ 3y+5z &= 7 \end{align*} \right. &\xrightarrow{3\times R_2}& \left\{ \begin{align*} 2x+y+z&=3 \\ 3y-3z &= -12 \\ 3y+5z &= 7 \end{align*} \right. \\ &\xrightarrow{R_3 - R_2}& \left\{ \begin{align*} 2x+y+z&=3 \\ 3y-3z &= -12 \\ 8z &= 19 \end{align*} \right. \end{array}

Now, we can solve for zz in R3R_3, and then work backwards to solve for yy in the second, and then xx in the first.

Clearly from R3R_3:
z=198z = \frac{19}{8}

Then, from R2R_2:
3y3(198)=12y=1383y-3\(\frac{19}{8}\)= -12 \\ \therefore y = -\frac{13}{8}

Finally, plug yy and zz into R1R_1 to solve for xx:
2x+(138)+198=3x=982x + \(-\frac{13}{8}\) + \frac{19}{8} = 3 \\ \therefore x = \frac{9}{8}

And done! Again, the pattern here is to eliminate variables to solve smaller systems first. In general, for a system:

{a11x+a12y+a13z=b1a21x+a22y+a23z=b2a31x+a32y+a33z=b3\left\{ \begin{align*} a_{11}x + a_{12}y + a_{13}z &= b_1 \\ a_{21}x + a_{22}y + a_{23}z &= b_2 \\ a_{31}x + a_{32}y + a_{33}z &= b_3 \\ \end{align*} \right.

We do some operations to turn it into something like:

{a11x+a12y+a13z=b1cy+dz=b2ey+fz=b3some more operations{a11x+a12y+a13z=b1cy+dz=b2kz=b3\begin{array}{c} \left\{ \begin{align*} a_{11}x + a_{12}y + a_{13}z &= b_1 \\ cy + dz &= b_2' \\ ey + fz &= b_3' \\ \end{align*} \right. &\xrightarrow{\text{some more operations}}& \left\{ \begin{align*} a_{11}x + a_{12}y + a_{13}z &= b_1 \\ cy + dz &= b_2' \\ kz &= b_3'' \\ \end{align*} \right. \end{array}

Then finally, we can solve for zz and solve the rest of the system backwards i.e., back substitution. The goal here to to reduce the system to an upper traingle form.

These “some operations” are known as elementary row operations.

Elementary row operations

These operations will not change the solutions.

  1. Multiplying a non-zero constant to a row.
  2. Adding or subtracting a row to another.
  3. Swapping two rows.

Matrix form

Note that the important part of the systems are the numbers i.e., the coefficients — not the variables. We can write systems of equations in a more compact form using matrices.

For example:

{2x+y+z=33y+z=22y+3z=5    [211303120235]\left\{ \begin{align*} 2x + y + z &= 3 \\ 3y + z &= 2 \\ 2y + 3z &= 5 \end{align*} \right. \iff \left[ \begin{array}{ccc|c} 2 & 1 & 1 & 3 \\ 0 & 3 & 1 & 2 \\ 0 & 2 & 3 & 5 \end{array} \right]

Or more generally:

{a11x+a12y+a13z=b1a21x+a22y+a23z=b2a31x+a32y+a33z=b3    [a11a12a13b1a21a22a23b2a31a32a33b3]\left\{ \begin{align*} a_{11}x + a_{12}y + a_{13}z &= b_1 \\ a_{21}x + a_{22}y + a_{23}z &= b_2 \\ a_{31}x + a_{32}y + a_{33}z &= b_3 \\ \end{align*} \right. \iff \left[ \begin{array}{ccc|c} a_{11} & a_{12} & a_{13} & b_1 \\ a_{21} & a_{22} & a_{23} & b_2 \\ a_{31} & a_{32} & a_{33} & b_3 \end{array} \right]

Here’s a more specific example.

{x+2y+z=3x3y+2z=12x2y+3z=2    [121313212232]R32R1R2R1{x+2y+z=35y+z=26y+z=4    [121305120614]15R2{x+2y+z=3y15z=256y+z=4    [12130115250614]R3+6R2{x+2y+z=3y15z=2515z=85    [1213011525001585]\begin{array}{c} & &\left\{ \begin{align*} x + 2y + z &= 3 \\ x - 3y + 2z &= 1 \\ 2x -2y + 3z &= 2 \end{align*} \right. &\iff &\left[ \begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 1 & -3 & 2 & 1 \\ 2 & -2 & 3 & 2 \end{array} \right] \\ &\xrightarrow[R_3-2R_1]{R_2-R_1} &\left\{ \begin{align*} x + 2y + z &= 3 \\ -5y + z &= -2 \\ -6y + z &= -4 \end{align*} \right. &\iff &\left[ \begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 0 & -5 & 1 & -2 \\ 0 & -6 & 1 & -4 \end{array} \right] \\ &\xrightarrow{-\frac{1}{5}R_2} &\left\{ \begin{align*} x + 2y + z &= 3 \\ y - \frac{1}{5}z &= \frac{2}{5} \\ -6y + z &= -4 \end{align*} \right. &\iff &\left[ \begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 0 & 1 & - \frac{1}{5} & \frac{2}{5} \\ 0 & -6 & 1 & -4 \end{array} \right] \\ &\xrightarrow{R_3+6R_2} &\left\{ \begin{align*} x + 2y + z &= 3 \\ y - \frac{1}{5}z &= \frac{2}{5} \\ -\frac{1}{5}z &= -\frac{8}{5} \end{align*} \right. &\iff &\left[ \begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 0 & 1 & - \frac{1}{5} & \frac{2}{5} \\ 0 & 0 & -\frac{1}{5} & -\frac{8}{5} \end{array} \right] \end{array}

Echelon form

At this point, we got the upper row triangle and can just perform back substitution to solve for each variables. Alternatively, we can keep going to get the reduced row echelon form (RREF).

Row echelon form

A matrix is in row echelon form if:

  • All rows consisting of only zeroes are at the bottom.
  • The leading entry (that is the left-most nonzero entry) of every nonzero row is to the right of the leading entry of every row above.

A matrix in row echelon form may not be necessarily unique. Any matrix that is in echelon form can be put in an (equivalent) echelon form by adding a scalar multiple of a row to one of the above rows.

Reduced row echelon form

A matrix is in reduced row echelon form if:

  • It is in row echelon form.
  • The leading entry in each nonzero row is a 1 (called a leading 1).
  • Each column containing a leading 1 has zeros in all its other entries.

Every matrix has a unique reduced row echelon form.

Continuing from the last system to get the reduced row echelon form. (Again, doing back substitution will get you the same solutions)

{x+2y+z=3y15z=2515z=85    [1213011525001585]5R3R2R3{x+2y+z=3y=2z=8    [121301020018]R12R2{x+z=1y=2z=8    [101101020018]R1R3{x=9y=2z=8    [100901020018]\begin{array}{c} & &\left\{ \begin{align*} x + 2y + z &= 3 \\ y - \frac{1}{5}z &= \frac{2}{5} \\ -\frac{1}{5}z &= -\frac{8}{5} \end{align*} \right. &\iff &\left[ \begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 0 & 1 & - \frac{1}{5} & \frac{2}{5} \\ 0 & 0 & -\frac{1}{5} & -\frac{8}{5} \end{array} \right] \\ &\xrightarrow[-5R_3]{R_2-R_3} &\left\{ \begin{align*} x + 2y + z &= 3 \\ y &= 2 \\ z &= 8 \end{align*} \right. &\iff &\left[ \begin{array}{ccc|c} 1 & 2 & 1 & 3 \\ 0 & 1 & 0 & 2 \\ 0 & 0 & 1 & 8 \end{array} \right] \\ &\xrightarrow{R_1-2R_2} &\left\{ \begin{align*} x + z &= -1 \\ y &= 2 \\ z &= 8 \end{align*} \right. &\iff &\left[ \begin{array}{ccc|c} 1 & 0 & 1 & -1 \\ 0 & 1 & 0 & 2 \\ 0 & 0 & 1 & 8 \end{array} \right] \\ &\xrightarrow{R_1-R_3} &\left\{ \begin{align*} x &= -9 \\ y &= 2 \\ z &= 8 \end{align*} \right. &\iff &\left[ \begin{array}{ccc|c} 1 & 0 & 0 & -9 \\ 0 & 1 & 0 & 2 \\ 0 & 0 & 1 & 8 \end{array} \right] \end{array}

Geometric interpretation

Remember, we do this to find intersections. So far, the systems that we’ve dealt with provides us a unique solution. For example, the above question tells us that the planes intersects at a single point: (9,2,8)(-9,2,8) in a three-dimensional plane.

There are also cases where there are no solutions and infinitely many solutions.

Unique solution No solution Many solutions
uniquesolution nosolution manysolutions
Three planes in space, intersecting at a point. Three planes with no common intersection. Three planes having a line in common.

Week 1