I have been looking at the following problem:
I initially tried using simultaneous equation, but with no real progress. I decide to give in and check the answer:
Now, I understand this solution, except for the line where it says:
’The only positive-integer solutions of this equation are $w=2, d=10$ and $w=5, d=3$’
This is surely where most of the challenge is with this problem, and yet they gloss over it in the answer. So my question is this: how are you meant to figure out these values without the use of trial and error, and if you do have to use trial and error, how can we be sure these are the only solutions?



$7w+3d=44 \implies d = \dfrac{44-7w}{3}=\dfrac{42-6w}{3}+\dfrac{2-w}{3} =14-2w+\dfrac{2-w}{3}$
The numbers that give integer solutions are of the form $w=3x+2$.
Letting $w=3x+2$, we get $d = 10-7x$
$x < 0$ makes $w$ negative. $x>1$ makes $d$ negative.
$x=0$ gives $(w,d)=(2,10)$ and $x=1$ gives $(w,d)=(5, 3)$.
Response to comment.
I chose $d = \dfrac{44-7w}{3}$ because you only have to try $w=0,1,2$ to find a value of $d$ that makes $w$ an integer. If you felt like writing
$$w=\dfrac{44-3d}{7}= 6 - \dfrac{3d-2}{7}$$ then $d=3$ gives us $w=5$.
For small numbers, this works just fine. If you have to, the best way is to use modular arithmetic.
For example, to search for an initial value of $d$,
\begin{align} 7w+3d=44 &\implies 3d \equiv 44 \pmod 7 \\ &\implies 3d \equiv 2 \pmod 7 \\ &\implies 5 \cdot 3d \equiv 5 \cdot 2 \pmod 7 \\ & \implies d \equiv 3 \pmod 7 \end{align}
You can then use $d=3+7t$ and you will get all integer values for $w$ and $d$.