Linear algebra is especially suited for solving linear systems with multiple variables.

Solving Linear Systems with Multiple Variables

Let's say for example, that a restaurant held a special special breakfast to help raise money for the local food bank. Each meal cost $8.50 for adults and $4.50 for children 10 and under. The restaurant wants to donate $1.00 per adult meal and $0.50 for each child's meal sold, but somehow the numbers got mixed up. All they know is that they sold a total of 519 meals, for a total amount of $2743.50. How much money should the restaurant donate?

Lucky for us, this problem isn't really that difficult to solve using linear algebra, as long as there is a unique solution. Not all such problems have a unique solution, so we must test for solvency first, using a determinant (see Determinants of Matrices). We start by setting up a matrix to perform the determinant:

\(A= \begin{bmatrix} 1&1\\ 8.5&4.5\\ \end{bmatrix} \)

The determinant of the matrix is then:

\(|A|= \begin{vmatrix} 1&1\\ 8.5&4.5\\ \end{vmatrix} = 4.5-8.5 = -4\)

Since the determinant is non-zero, then there is a unique solution available. Now we must decide which method to use to solve the actual problem. I will show two methods, one fast and simple, the other complex and tedious if done by hand (but more useful for computers).

Elimination Method

The elimination method is a fairly straight-forward algebraic approach that is quick and easy for a person to do by hand. We start by setting up the equation with what is known. We'll let \(x\) be the number of adult meals sold and \(y\) be the number of child meals sold, so our setup looks like this:


We must select one of the constant coeficients in the bottom row to eliminate from the equation (we'll pick 4.5). We then multiply all terms of the top row by that value. Now subtract the bottom row from the top:

\(\small\begin{array}{cccccc} & 4.5x & + & 4.5y & = & 2335.5\\ - & 8.5x & + & 4.5y & = & 2743.5\\\hline & -4x & + & 0 & = & -408\\ \end{array}\normalsize\)

Now we can solve for \(x\):

\(-4x=-408\)  →  \(x=102\)

Since a total of 519 meals were sold, \(y\) must be 417. The restaurant therefore sold 102 adult meals and 417 child meals. The total amount that they will donate is then \(102\times $1+417\times $0.5= $310.50\).

Inverse Matrix Method

Due to the complexity of this method, calculation is a chore best left to computers. The advantage is that it works well for solving problems with many variables. Since we already tested for solvency, we simply calculate an inverse matrix and then multiply:

We start with the same matrix we used for the determinant above:

\(A= \begin{bmatrix} 1&1\\ 8.5&4.5\\ \end{bmatrix} \)

Now to generate the inverse matrix, we'll use the upward-downward elimination method (the upward-downward elimination method is fairly complex and will be explained elsewhere.)

\(\left[\begin{array}{r|r} A & I_2\\ \end{array}\right] =\) \(\left[\begin{array}{rr|rr} 1 & 1 & 1 & 0 \\ 8.5 & 4.5 & 0 & 1 \\ \end{array}\right]\)

\(\scriptsize(R_2-8.5R_1)→R_1\small\) \(\left[\begin{array}{rr|rr} 1 & 1 & 1 & 0 \\ 0 & -4 & -8.5 & 1 \\ \end{array}\right]\normalsize\)

\(\scriptsize(R_2/-4)→R_2\small\) \(\left[\begin{array}{rr|rr} 1 & 1 & 1 & 0 \\ 0 & 1 & 2.125 & -0.25 \\ \end{array}\right]\normalsize\)

\(\scriptsize(R_1-R_2)→R_1\small\) \(\left[\begin{array}{rr|rr} 1 & 0 & -1.125 & 0.25 \\ 0 & 1 & 2.125 & -0.25 \\ \end{array}\right]\normalsize\)

Our inverse matrix is now contained on the right-hand side of the augmented matrix:

\(A^{-1}= \begin{bmatrix} -1.125&0.25\\ 2.125&-0.25\\ \end{bmatrix} \)

Now we perform a matrix multiply in order to obtain or result:

\(\small\left[\begin{array}{r} x\\ y\\ \end{array}\right] =\normalsize\) \(\small\left[\begin{array}{rr} -1.125 & 0.25\\ 2.125 & -0.25\\ \end{array}\right]\normalsize\) \(\small\left[\begin{array}{r} 519\\ 2743.5\\ \end{array}\right] =\normalsize\) \(\small\left[\begin{array}{r} (-1.125)(519)+(0.25)(2743.5)\\ (2.125)(519)+(-0.125)(2743.5)\\ \end{array}\right] =\normalsize\) \(\small\left[\begin{array}{r} 102\\ 417\\ \end{array}\right]\normalsize\)

And viola! We get the answer \(x=102\) and \(y=417\).

Don't get too hung up on the complexity of the inverse matrix process. Unless you're going for a Master's degree in mathematics, it's unlikely that anyone will ever expect you to do it manually. Graphing calculators or computers are generally used when dealing with matrices.

Linear Algebra: Determinants of Matrices