Systems of linear equations in three variables

Some problems have three unknowns. Then we need three equations. This page shows how to solve such a system by elimination. The same idea works for any number of unknowns.

Equations in three variables

A linear equation in three variables has the form ${ax+by+cz=d}$. A solution of a system of such equations is an ordered triple ${(x,y,z)}$ that makes every equation true.

The graph of one such equation is a flat surface in space, called a plane. Three planes can meet at one point, along a whole line, or not at all. So, as with two variables, a system has one solution, no solution, or infinitely many solutions.

Triangular form

Some systems are easy to solve, because each equation has one fewer variable than the one above it:

$\begin{cases}x+y+z=6\\\phantom{x+{}}y-2z=-4\\\phantom{x+y-2{}}z=3\end{cases}$

This is called triangular form. Solve it from the bottom up. This is called back-substitution.

Example 1: Solve the system above.

Solution:

The last equation gives ${z=3}$.

Put it into the middle equation:

$\begin{align*}y-2(3)&=-4\\y&=2\end{align*}$

Put both into the first equation:

$\begin{align*}x+2+3&=6\\x&=1\end{align*}$

The solution is ${(1,2,3)}$.

Elimination

To solve any system, change it into triangular form. These three operations do not change the solutions:

1. Add a multiple of one equation to another equation.

2. Multiply an equation by a nonzero number.

3. Swap the order of two equations.

First use the first equation to eliminate ${x}$ from the other two. Then use the new second equation to eliminate ${y}$ from the third. Then back-substitute.

Example 2: Solve the system.

$\begin{cases}x+y+z=4\\2x-y+z=8\\x+2y-z=-3\end{cases}$

Solution:

Eliminate ${x}$ from the second equation. Subtract ${2}$ times the first equation from the second:

$\begin{align*}&(2x-y+z)-2(x+y+z)\\&=8-2(4)\end{align*}$

This gives ${-3y-z=0}$.

Eliminate ${x}$ from the third equation. Subtract the first equation from the third:

$\begin{align*}&(x+2y-z)-(x+y+z)\\&=-3-4\end{align*}$

This gives ${y-2z=-7}$.

The system is now (with the last two equations swapped):

$\begin{cases}x+y+z=4\\y-2z=-7\\-3y-z=0\end{cases}$

Eliminate ${y}$ from the third equation. Add ${3}$ times the second equation to the third:

$\begin{align*}&(-3y-z)+3(y-2z)\\&=0+3(-7)\end{align*}$

This gives ${-7z=-21}$. Now the system is in triangular form:

$\begin{cases}x+y+z=4\\y-2z=-7\\-7z=-21\end{cases}$

Back-substitute. From the last equation, ${z=3}$. Then

${y=-7+2(3)=-1}$,

${x=4-(-1)-3=2}$.

The solution is ${(2,-1,3)}$.

Check: In the second equation, ${2(2)-(-1)+3=8}$. In the third, ${2+2(-1)-3=-3}$.

Tip: Always check the answer in all the original equations. One small sign error in the elimination gives a wrong answer that still fits some of the equations.

Systems with no solution or infinitely many

As in two variables, an equation ${0=c}$ with ${c\ne 0}$ means there is no solution. An equation ${0=0}$ means one equation was not needed, and there are infinitely many solutions.

Example 3: Solve the system.

$\begin{cases}x+y+z=2\\x+2y-z=1\\2x+3y=4\end{cases}$

Solution:

Subtract the first equation from the second. Subtract ${2}$ times the first from the third:

$\begin{cases}x+y+z=2\\y-2z=-1\\y-2z=0\end{cases}$

Subtract the second equation from the third:

${0=1}$

This is false, so the system has no solution. It is inconsistent.

Example 4: Solve the system.

$\begin{cases}x+y+z=2\\x+2y-z=1\\2x+3y=3\end{cases}$

Solution:

The same steps as in Example 3 give

$\begin{cases}x+y+z=2\\y-2z=-1\\0=0\end{cases}$

The last equation is always true. So only two equations are left, for three unknowns. One unknown can be any number. Let ${z=t}$, where ${t}$ is any real number. Then back-substitute:

${y=-1+2t}$

$\begin{align*}x&=2-y-z\\&=2-(-1+2t)-t\\&=3-3t\end{align*}$

The solutions are all triples ${(3-3t,\ -1+2t,\ t)}$. For example, ${t=0}$ gives ${(3,-1,0)}$, and ${t=1}$ gives ${(0,1,1)}$.

An application

Example 5: An investor puts ${\$50{,}000}$ into three funds. They pay ${3\%}$, ${5\%}$, and ${7\%}$ interest per year. The same amount goes into the ${5\%}$ fund as into the ${7\%}$ fund. The total interest for one year is ${\$2700}$. How much goes into each fund?

Solution:

Let ${x}$, ${y}$, and ${z}$ be the amounts in the ${3\%}$, ${5\%}$, and ${7\%}$ funds. The three facts give three equations:

$\begin{cases}x+y+z=50{,}000\\0.03x+0.05y+0.07z=2700\\y=z\end{cases}$

Put ${z=y}$ into the first two equations. Multiply the second by ${100}$ to clear the decimals:

$\begin{cases}x+2y=50{,}000\\3x+12y=270{,}000\end{cases}$

Subtract ${3}$ times the first equation from the second:

$\begin{align*}6y&=120{,}000\\y&=20{,}000\end{align*}$

So ${z=20{,}000}$, and ${x=50{,}000-2(20{,}000)=10{,}000}$.

So ${\$10{,}000}$ goes into the ${3\%}$ fund, and ${\$20{,}000}$ into each of the others.

Check: The interest is ${300+1000+1400=2700}$ dollars.

Summary