For the word problem below, there are 4 variables to solve for, but I can only identify 3 equations given the data. Through trial and error, you can easily figure out the answer, but I am wondering if there is an implied equation I'm not seeing. In other words, how can this problem be solved using algebra rather than a bit of trial and error?


Ian has been saving money for his summer trip to his grandparents' house. He has saved 18 bills of varying denominations, including \$20s, \$10s, \$5s, \$1s. He's saved a total of \$126. He has the same number of \$10s as he has \$1s. How many of each bill does Ian have?


w + x + y + z = 18
w + 5x + 10y + 20z = 126
w = y

[legend // w: number $1s, x: number of $5s, y: number of $10s, z: number of $20s]


$1s: 6
$5s: 4
$10s: 6
$20s: 2
  • $\begingroup$ There's no need of a fourth equation, knowing that each of the variables is a non-negative integer suffices to determine the values. $\endgroup$
    – lulu
    Commented Apr 29, 2020 at 13:29
  • 1
    $\begingroup$ Note: there's very little trial and error involved here. using $y=w$ to eliminate $y$ and then using the top two equations to eliminate $x$ we get $w+15z=36$. Thus $z\in \{0,1,2\}$. Easy to see that $0,1$ are impossible, so we are essentially done. $\endgroup$
    – lulu
    Commented Apr 29, 2020 at 13:34
  • $\begingroup$ Many thanks for the quick response! I get that the problem is easy to solve without a 4th equation, but that's not my question. I'm looking for how to solve it exactly without trial & error. Is there not way to do this? $\endgroup$
    – Burton
    Commented Apr 29, 2020 at 13:37
  • 1
    $\begingroup$ The point here is that the system is underdetermined as a system of real variables. That is, there are infinitely many quadruples $(w,x,y,z)$ of real numbers that work. The extra information comes not from an extra equation but from integrality. So, yes, there's a search involved. If you wanted, you could just remark that all the variables must lie in $\{0, 1, \cdots, 18\}$ so there are only $19^4$ quadruples to test. As I pointed out, and as you seem to be aware, it is easy to reduce the search dramatically . I think eliminating the search entirely is more trouble than it's worth. $\endgroup$
    – lulu
    Commented Apr 29, 2020 at 13:42
  • $\begingroup$ I don't see a way to a fourth equation. Problems with whole number solutions often depend on the granularity of the naturals to reduce the possibilities. If the total were larger, like 1260, there would be many solutions. Sometimes you can avoid all trial and error by using divisibility, but three cases is not many. $\endgroup$ Commented Apr 29, 2020 at 13:42

1 Answer 1


$$w+x+y+z=18;\;w+5 x+10 y+20 z=126;\;y=w$$ then $$11w+5x+20z=126;\;2w+x+z=18$$ multiply the second equation by $-5$ and add to the first $$-10w-5x-5z=-90;\;w+15z=36$$ so $$z=\frac{36-w}{15}$$

As the numbers are positive integers, $36-w$ must be a multiple of $15$. Furthermore all unknowns are less than $18$

$36 - w=15$ leads to $w=21$ which is greater than $18$

$36-w=30$ leads to $w=6;\;y=6;\;x=4;\;z=2$

$36-w=45$ leads to a negative w.

Thus the solution found above is unique.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .