How to find the number of values for $x$ and $y$? I have come across numerous questions where I am asked for example, if $x$ and $y$ are non-negative integers and $3x + 4y = 96$, how many pairs of $(x,y)$ are there?
Usually, I just use trial and error and look at the multiples of $3$ and $4$. However, I was wondering whether there is a more efficient way to solve such problems.
Help would be appreciated.
Thank you :)
 A: Noth that $3x=4(24-y)$ implies that $x$ has to be a multiple of $4$, i.e. $x=4k$. Then, $3\cdot 4k=4(24-y)\Rightarrow 3k=24-y\Rightarrow y=24-3k$. Since $y$ is non-negative, one has $24-3k\ge 0\Rightarrow 0\le k\le8$. Note that the number of pairs $(x,y)$ is the same as the number of $k$, i.e. $\color{red}{9}$.
A: To solve your particular problem, you can see that what you need to find is all values of $x$ for which $96 - 3x$ is a positive multiple of $4$.
That means you want $96-3x$ to be divisible by $4$, and since $96$ is divisible by $4$, that means that $3x$ must be as well. Now, since $3$ and $4$ are coprime, $3x$ is divisible by $4$ if and only if $x$ is divisible by $4$, meaning that the possible values for $x$ are $0,4,8,12,\dots, 32$ (since, if $x>32$, then $3x>96$ meaning that $y<0$).
Now, for every $x$, simply find $y$ as $y=\frac{96-3x}{4}$ so that you get the pairs
$$x=0, y=24\\
x=4, y=21\\
x=8, y=18\\
x=12, y=15\\
x=16, y=12\\
x=20, y=9\\
x=24, y=6\\
x=28, y=3\\
x=32, y=0$$
