[Math] Simpler Way to Solve This Diophantine Equation

diophantine equations

In a pet shop, rats cost $5$ dollars each, guppies cost $3$ dollars each, and crickets cost $10 $ cents each. $100$ animals are sold, and the total cost is $100$. How many rats, guppies, and crickets were sold?

Our math team coach has shown us the solution already, but her solution requires $7$ different variables and takes at least $10$ minutes for me to solve. The math team contest has $6$ diophantine equations problems of increasing difficulty. I only have $40$ minutes to complete these $6$ questions and I am not allowed to use a calculator.

What is the fastest or simplest way to solve this problem without a calculator?

Best Answer

HINT

$$50r + 30g + c = 1000\tag{1}$$ $$r+g+c = 100\tag{2}$$

Eliminating one variable gives you a linear diophantine equation in two variables whose solution is straightforward. $$49r + 29g = 900 \tag{3}$$


Another approach which works well for this specific problem is :

$$r = \dfrac{900 - 29g}{7\times 7}$$

Since $900$ leaves a remainder of $4$ when divided by $7$,
$29g$ must also leave the remainder $4$ for $r$ to be an integer : $$29g \equiv 4 \pmod 7 \implies g \equiv 4 \pmod 7 $$

Plugging in $g=4$ gives you $r=16$. This is one solution.

Related Question