Elimination is a good idea. I think the details are not done correctly. In any case, I would rather eliminate $p$, the arithmetic is easier. We get
$24q+9d=399$, or equivalently
$$8q+3d=133.$$
We can use general techniques to solve this Diophantine equation, but the numbers are so small that it does not seem worthwhile. Note that when $q=2$, then $133-8q$ is a multiple of $3$, and we get $q=2$, $d=39$, and therefore $p=59$.
Now we have found one solution. We need others.
Go back to the equation $8q+3d=133$. We have found one solution, $q=2$, $d=39$.
For any integer $k$, we therefore have
$$8(2+3k)+3(39-8k)=133.$$
(Note the cancellation.)
Substitute various values of $k$. With $k=1$, for example, we get the solution $q=5$, $d=31$. That gives $p=64$.
Continue, using $k=2$, $3$, and so on. For the sake of reality, we will have to make sure that our values of $q$, $d$, $p$ are all $\ge 0$. We cannot use $k\gt 4$, for that would give negative $d$.
An extended description of the modular argument I gave above to reduce the case work. As per your request, consider the amount of money in terms of cents, not in terms of dollars.
Before properly defining what we mean by modular numbers, I will remind you of what we mean by an even number and an odd number. An even number is a whole number that you can divide by 2 and get another whole number back. (examples include 2,4,6,8,...). An odd number is one that if you divide by 2 you do not get a whole number back, but instead you get a remainder of one. (examples include 1,3,5,7,9,...).
Let me define a similar concept, which I will dub three-even, three-odd and three-other numbers. I call a number threeeven if when I divide by three, I get another whole number back (in tandem to how I define an even number. examples include 3,6,9,12,...). I call a number threeodd if when I divide by three, I get a remainder of one (like how I defined odd numbers. examples include 1,4,7,10,...). Finally, I define a new category, threeother where if I divide by 3 I get back a remainder of 2 (examples include 2,5,8,11,...).
This way of thinking of "even and odd", or "threeven, throdd, and throther", or even extending it further to "fourven, fodd, fother, fothing" or higher can be phrased mathematically as follows using modular notation:
A number $x$ is congruent to $y$ "modulo" $n$ (written as $x\equiv y\mod n$) when $x = y + kn$ for some integer $k$.
For example, $7 \equiv 1\mod 2$, since you have $7 = 1 + 3\cdot 2$. We can also say that $7\equiv 9\mod 2$ since you have $7=9+(-1)\cdot 2$. Often times, however, we prefer to have $0\leq y< n$ to make calculations easier.
Notice a few things:
- if $x_1\equiv y_1\mod n$ and $x_2\equiv y_2\mod n$, then you have that $x_1+x_2\equiv y_1+y_2\mod n$
- if $x_1\equiv y_1\mod n$ and $x_2\equiv y_2\mod n$, then you have that $x_1\cdot x_2\equiv y_1\cdot y_2\mod n$
- if $x_1 = x_2$ then $x_1\equiv x_2\mod n$
- $x+kn\equiv x\mod n$ for any $k$
The first property explains why an even number plus an odd number is always odd (since 0+1=1), just like how a throdd number plus a throdd number is always throther(since 1+1=2). The second property explains why an odd number times an odd number is always odd (since $1\cdot 1=1$), and why an even number times anything is even (since $0\cdot y = 0$)
Now with the definitions out of the way. Notice that $487\equiv 2\mod 5$ (since $487 = 485+2 = 5\cdot k + 2$ for some integer $k$ I am too lazy to compute). Notice also that $35 \equiv 0\mod 5$ (since $35 = 0+7\cdot 5$), and that $6\equiv 1\mod 5$.
Letting $p$ be the number of pennies (and therefore also the number of nickels), and $d$ be the number of dimes (and therefore also the number of quarters), you are given the equation:
$$6\cdot p + 35\cdot d = 487$$
We may now apply the third property from above and consider the equation above modulo 5.
$$6\cdot p + 35\cdot d \equiv 1\cdot p + 0\cdot d \equiv p \equiv 2\mod 5$$
Therefore, we know that $p$ will have a remainder of 2 when divided by 5. So, $p$ can only be one of the following numbers: 2,7,12,17,22,etc... (note: we chose mod5 because we got to completely cancel out the term where $d$ appears and replace it with zero. We could also have chosen to approach it via mod7, but division by 7 is not as quick and easy)
Continuing from the note above, and exploring the same with modulo 7: after some calculations you get: $6\equiv 6\mod 7$, $35\equiv 0\mod7$ and $487\equiv 4\mod 7$. (note, $6\equiv -1\mod 7$ from the fourth property above and is a bit easier to work with)
$$6p+35d\equiv 6p+0d\equiv 6p \equiv -1p\equiv 4\mod 7$$
so: $-1p\equiv 4\mod 7$ and $p\equiv -4\equiv 3\mod 7$, so $p$ is 3 more than a multiple of 7, $p$ has to be one of the numbers: 3,10,17,24,etc... Comparing with our list from above, $p$ has to be one of the numbers 17,52,87,122,etc...
We could figure out what the numbers have to be from there, but I will go through the process one more time from the other side. Consider each modulo 6. $6\equiv 0\mod 6$, $35\equiv 5\equiv -1\mod 6$, and $487\equiv 1\mod 6$.
$$6p+35d\equiv 0p+(-1)d\equiv -1d\equiv 1\mod 6$$
So, $d\equiv -1\equiv 5\mod 6$, and we know that $d$ has to be one of 5,11,17,23,etc...
Combining this information, we have then only a few cases to check in our range of numbers. 17 is too big for $d$, since already $17\cdot 35 = 595>487$. So, for $d=11$ we check and find that 17 works for $p$. So, noting finally that to use the fewest coins total implies we'll use the most possible dimes and quarters, the final answer is $p=n=17$ and $d=q=11$.
(final note, it does also show that you can get an amount of \$4.87 using 5 dimes and 5 quarters and 52 pennies and 52 nickels)
Best Answer
One point of view is, once you have abstracted the "real-world" quantities (number of coins, number of cents) into equations with named variables, you can go at it with algebra and never mind what the next equation "means" in "reality."
You may have to take this view some day for some problem. For this problem, in the equation $9d+24q=400,$ you know that every coin contributes at least one cent to the total value; the $9$ represents the number of extra cents that each dime contributes, and the $24$ represents the number of extra cents that each quarter contributes.
If the $100$ coins were all pennies we would be $400$ cents short of five dollars, so the $d$ dimes and $q$ quarters need to contribute a total of $400$ "extra" cents: $$9d+24q=400.$$