Question 1179804
<br>
x = # of luxury units
y = # of superior units
z = # of deluxe units<br>
{{{x+y+z=24}}}  the total number of units is 24
{{{8x+7y+5z=160}}}  the total number of residents is 160<br>
This is two equations with three variables, in which the values of the variables are non-negative integers.  That is a system of Diophantine equations; there are standard processes for solving them.<br>
We first need to eliminate one variable to get a single equation with two variables.  Let's eliminate z using elimination.<br>
{{{5x+5y+5z=120}}}
{{{8x+7y+5z=160}}}
{{{3x+2y=40}}}<br>
Next we solve this single equation for one variable and use the requirement that the solutions be non-negative integers to find the solution(s) to the problem.<br>
{{{y=(40-3x)/2}}}<br>
We could at this point choose non-negative integers values for x and find the ones that give non-negative integer values for y.  But we can make finding the solutions easier by going one step further with our algebra before we do that.<br>
Perform the indicated division, expressing the result as a quotient and a remainder:<br>
{{{y=(40-3x)/2 = (40-2x-x)/2 = (20-x)-x/2}}}<br>
From this we see that y has to be an integer and 20-x is an integer, so x/2 has to be an integer.  That tells us x has to be even.<br>
Now we are ready to find the solutions to the problem.<br><pre>
  x  y=(20-x)-x/2 z=24-(x+y)
 ----------------------------
  0   20-0=20      24-20=4
  2   18-1=17      24-19=5
  4   16-2=14      24-18=6
  6   14-3=11      24-17=7
  8   12-4=8       24-16=8
 10   10-5=5       24-15=9
 12    8-6=2       24-14=10</pre>
Larger values for x would produce negative values for y, so the list of solutions is complete.<br>