1

I have 20 iron bars. Some are 3 kg, some are 8 kg and the rest are 14 kg. The total mass of all twenty is 183 kg. Determine the number of each bar.

Let number of 3kg bars = x, 8kg bars = y, 14kg bars = z

So,

$x + y + z = 20\\3x + 8y + 14z = 183$

To solve, "Intelligent trial and error" from here?

Try x=1,x=2,x=3,x=4,x=5 and solve simultaneously for y and z.

Yields x = 5, y = 7, z = 8

i.e. 5x3kg bars, 7x8kg bars, 8x14kg bars

Is it a case of trial and error or is there a "smart solution"?

2 Answers2

2

As a first step we can eliminate a variable

  • $x + y + z = 20 \iff 3x + 3y + 3z = 60$
  • $3x + 8y + 14z = 183$

and subtracting the first one from the other one we obtain

$$5y + 11z = 123$$

which by inspection leads to integer solutions for $z=3$ and $z=8$.

Finally from the first original equation we obtain $(x,y,z)=(5,7,8)$.

user
  • 154,566
2

Same starting point: $$\begin{cases} x+y+z=20\\ 3x+8y+14 z=183 \end{cases} \Longrightarrow \enspace 5y+11z=123 $$ Now, we have the Bézout relation $\;-2\cdot 5+1\cdot 11=1$, which implies $$-246\cdot5+123\cdot11 =123,$$ whence a solution $y_0=-246,\enspace z_0=123$. Now, it is known that all solutions of the diophantine equation $5y+11z=123$ have the form $$\begin{cases} y=y_0+11k,\\ z=z_0-5k. \end{cases} \quad(k\in\mathbf Z) $$ Furthermore, here we have the constraints $$\begin{cases}y=-246+11k>0 \\ z=123-5k>0,\end{cases} \iff \begin{cases}k>22 \\ k<24.\end{cases}$$ Hence there is a single possibility: $\;k=23$, which makes $y=7, z=8$, and consequently $x=5$.

Bernard
  • 175,478