If Ax + By = C and Dx + Ey = F, then what are x and y?

Often in physics (and algebra generally), we find that an equation contains multiple unknowns "x and y (and maybe z and others)" – these problems cannot be solved based on what we’ve talked about so far.

For example:

One day, I bought 3 gallons of milk and two cartons of eggs and it all cost me 7 dollars. The next day I bought 2 gallons of milk and 5 cartons of eggs and this time I spent 12 dollars – how much are milk and eggs individually?

So, we could attempt this with trial and error – and if you’re lucky, you’ll quickly find that milk is one dollar per gallon and eggs are 2 dollars per carton. But, in general problems the trial and error approach can take an impossibly long time! In order for us to learn from this example, let’s try to solve it in a way that is general and can be applied to more difficult problems.

So, in a way you will by now be familiar with, let’s rewrite this problem in algebra fashion:

3 * \$priceofmilk + 2 * \$priceofeggs = \$7 (1)

2 * \$priceofmilk + 5 * \$priceofeggs = \$12 (2)

As you can see, this problem gives us two equations to deal with – which is good, because you always need as many equations as you have unknowns.

Now, we spent a long time working out ways to solve equations with only one unknown – do we have to throw them away for simultaneous equations? No – we just need to find a way to turn these equations into equations with only one unknown so that we can make progress with this problem

For now, lets look at equation (1) and pretend that \$priceofeggs is just a constant – something we might have called B in earlier problems. Then, we can "solve" this equation for \$priceofmilk:

3 * \$priceofmilk + 2 * \$priceofeggs = \$7 (1)

3 * \$priceofmilk = \$7 - 2 * \$priceofeggs

\$priceofmilk = \$(7/3) - (2/3) * \$priceofeggs (3)

Now we have an "answer" for \$priceofmilk - but it still depends on \$priceofeggs, so we haven’t really found the answer to our question. But, we can use this relationship to find the price of eggs! If we perform this algebra essentially in reverse, by putting this "answer" for \$priceofmilk (called equation 3) into the other equation (Equation 2), we see that we now really have an equation with only one unknown - \$priceofeggs!

2 * \$priceofmilk + 5 * \$priceofeggs = \$12 (2)

2 * (\$(7/3) - (2/3) * \$priceofeggs) + 5 * \$priceofeggs = \$12

\$(14/3) – 4/3 * \$priceofeggs + 5 * priceofeggs = \$12

On rearranging this equation, we see that:
(5-4/3) * \$priceofeggs = \$12 - \$14/3

11/3 * \$priceofeggs = \$22/3

\$priceofeggs = \$2

Now that we have a value for the price of eggs, we can take this value back to equation 3 and find the price of milk:

\$priceofmilk = \$(7/3) - (2/3) * \$priceofeggs (3)

\$priceofmilk = \$(7/3) - (2/3) * \$2

\$priceofmilk = \$1

Thus we have solved for the prices of milk and eggs

This process works for any general problem:

Ax + By = C

Dx + Ey = F

If we take the first equation and rearrange it to give y as a function of x, we get:
y = (1/B) * (C – Ax)
Now, we can take this "value" for y and put it into our second equation:
Dx + (E/B)*(C-Ax) = F

(D-EA/B)x = F-EC/B

x = (F-EC/B)/(D-EA/B)

Now, we can take this expression for x and put it back into our expression for y, we get:
y = (1/B)* (C-A*(F-EC/B)/(D-EA/B))
So, we can generalize how to solve these equations:

1) Take one equation and rearrange it to give one variable in terms of the other.

2) Substitute this expression into the other equation – this gives you an equation with a single unknown.

3) Solve this equation in the fashion we learned earlier.

4) Take the solution for this variable and substitute it into the rearrangement we found in step one – this will then give you the value for the other variable.