Solvability
The equation has integer solutions if and only if:
If it’s solvable, the extended Euclidean algorithm produces one particular solution, and every other solution is generated by shifting along the line:
Applied problems: non-negativity
Many AMC Diophantine problems (coin combinations, ticket counts) restrict solutions to nonnegative integers. After parameterizing the general solution, translate and into a bounded range for the parameter , then count the integers in that range.
Worked example
Problem: A store sells pens for \$4 and notebooks for \$7. In how many ways can a customer spend exactly \$51, buying at least one of each?
Solution: We need with . Since , solutions exist. Find one by inspection: try small values until is divisible by 4:
So is one solution. The general solution shifts by (since ):
Need , and . So — exactly 2 ways.
Practice problems
1.Does have integer solutions? Explain.
2.Find one integer solution to .
3.How many pairs of nonnegative integers satisfy ?
4.A vending machine accepts only \$2 and \$3 items and a customer spends exactly \$23 buying at least one of each. How many (quantity-of-\$2, quantity-of-\$3) combinations work?