Friday, 24 October 2025

Exercise (1.4).8

Each hotdog costs £0.24 and each bun costs £0.14. List the combination(s) of hotdogs and buns that can be purchased with exactly £5. 


We encode the problem as follows, with  $h$ the number of hotdogs, and $b$ the number of buns.

$$ 24h + 14b = 500 $$

The $\gcd(24,14)=2$, which divides 500, and so the equation has integer solutions.

By inspection, a solution is $h_0=8, b_0=22$. So a general solution is

$$ h = 8 + 7t \quad b = 22 - 12t $$

for any integer $t$.


However, the number of hotdogs and buns must be non-negative, so we have the following inequalities

$$ 8 + 7t \ge 0 $$

$$ 22 - 12t \ge 0 $$

Re-arranging,

$$ t \ge -\frac{8}{7} $$

$$ \frac{11}{6} \ge  t $$

Combining,

$$ -\frac{8}{7} \le t \le \frac{11}{6} $$

The values of $t$ which generate non-negative $b$ and $h$ are -1, 0 and 1.


And so the combinations of hotdogs and buns are as follows.

th=8+7tb=22-12t24h+14b








-1134500
0822500
11510500