# Efficient method for solving simultaneous equation?

so I spent a surprising amount of time trying to solve something as trivial looking as that picture ^^, and while I got there in the end, I was wondering if there is a way to solve such simultaneous equations as painlessly as possible. Please do not suggest trial and error

• Just add first two equations... Then add the last two equations... Then you are done. – N. S. Apr 23 at 20:43
• yeah I completely overlooked elimination and substituted what looked like quantum physics into each equation lol – Ubaid Hassan Apr 23 at 22:46
• @N.S.: how does this generalize to other cases ? – Yves Daoust Apr 24 at 6:56

The three first equations are purely additive (i.e. only involve additions/subtractions of the unknows, possibly with a coefficient), so that the most efficient method is Gaussian elimination (lookup this term).

In your case, adding the first equation to the second and to the third will make the unkown $$f$$ disappear. This is a standard step of Gaussian elimination; but here, by chance, it also makes a second unknow disappear.

The new second equation gives $$-2s=6$$ and the new third $$-2o=-10$$.

Hence $$s=-3$$, $$o=5$$ and finally $$f=7$$.

Adding the first equation to the second gives you a simple equation that involves only the starfish. Adding the first to the third gives you an equation that only involves the octopus. You can then substitute into any of the first three equations to find the value of the striped fish.

• “Never overlook elimination” noted – Ubaid Hassan Apr 23 at 22:37

For general systems there are algorithms you learn in linear algebra. Whether that counts as "painless" is a matter of taste.

For small simple systems like this there are several kinds of starting places you learn with practice. Since all the coefficients (in the first three equations) are $$\pm 1$$ you should look for cancellation. Adding the first and third leaves only the octopus, so you know what that is. Adding the second and third tells you the fish.

Fish is "a", Octopus is "b", and Starfish is "c".

+1a - 1b - 1c = 5

-1a + 1b - 1c = 1

-1a - 1b + 1c = -15

The solution by row-reduction and back-substitution is (7,5,-3) .

The point of the problem is probably to add the first and second equations to get c = -3. Add the second and third equations to get a = 7. And add the first and third equation to get b = 5.

Try Assigning variables:

$$x$$=Octopus, $$y$$=Clown Fish, $$z$$=Star Fish,

Then using the picture we have:

$$y-x-z=5$$ and $$x-y-z=1$$ and $$z-x-y=-15$$

We can then solve this set of simultaneous equations by solving for $$y$$ for example. So $$y=5+x+z$$ and $$y=x-z-1$$ so putting them together is $$5+x+z=x-z-1$$.

So then this gives $$6+x-x+2z=0$$ so $$z=-3$$ then we can employ the same tactics to get $$x=5$$ and $$y=7$$.

So our final answer is $$xy-z$$ which is equal to $$38$$