# Simple Elementry school problem made difficult.

This topic is 5190 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

My girlfriend is getting her degree in education, and has to take elementry math so she can be able to teach it. When I heard she had to take elementry math and she complained to me the problems were hard I made fun of her. Though, the jokes on me because I can't figure it out either. The series of problems generalized is you have n amount of coins and M amount of money. How many nickels, dimes, quaters, and pennies do you need to get M. So an example of a question was if you had 25c and 3 coins how many n,d,q, and p's would you have? I tried solving a general form of an equation but my system of equations are always under-determined. That is.
25x + 10y + 5z + 1w = 25
x + y + z + w = 3
or
[25 10 5  1 ]  [x] [25]
[1  1  1  1 ]  [y] [3]
[a1 a2 a3 a4]* [z]=[u1]
[b1 b2 b3 b4]  [w] [u2]


There are 2 equations and four unkowns so the system is underdetermined. The constraint that you have so many coins to add up to so much money leads me to believe there is only one answer and since there is only one answer to the problem there must be a way to solve the problem mathematically not algorithmically. And it bothers me very much that I can't figure it out. -Dave

##### Share on other sites
[EDIT: just realized i missed the constraint of 3 coins... oops :)]

you don't solve this with a system of equations, that's why it's "elementary math". there are many possible answers. you can have all pennies, or just pennies and nickles, etc. you solve it by iterative modulus operations. maybe someone can come up with some equations to solve, but this is the easy way (and how you'd teach 6yr olds to do it, albeit not in code :))

//amount passed as amount of centsvoid howMany( int amount ){    int numQuarters = 0, numDimes = 0;    int numNickles = 0, numPennies = 0;    numQuarters = amount % 25;    amount -= numQuarters * 25;    if ( amount > 0 )    {        numDimes = amount % 10;        amount -= numDimes * 10;        if ( amount > 0 )        {             numNickles = amount % 5;             amount -= numNickles * 5;             if ( amount > 0 )                 numPennies = amount;        }    }}

##### Share on other sites
This reminds me of that study where phd students from an ivy league school scored worse than highschool feshman on the same test.

the moral was that the phd guys tried answering the questions using calculus, and the freshmen jsut used formulas they learned in geometery. the phd students made more mistakes.

the constraints you're forgetting are that x,y,z,w are all integers and always positive or zero.

this is implicit in the question. the elementary students pick up on it right away. you tried to apply linear algebra to the problem without first checking to see if linear algebra will work in this case.

##### Share on other sites
Quote:
 Original post by Palidineyou don't solve this with a system of equations, that's why it's "elementary math". there are many possible answers. you can have all pennies, or just pennies and nickles, etc. you solve it by iterative modulus operations. maybe someone can come up with some equations to solve, but this is the easy way. *** Source Snippet Removed ***

No, there is only one answer because their is a restraint on the problem. The restraint is you have so many coins that add up to a certain amount of money.

Example: You have 3 coins and 25 cents, how many nickels, dimes, pennies, and quaters do you have. Only one possible solution to the problem..

-Dave

##### Share on other sites
The problem doesn't even have to have a solution which is a problem =p

ie 27 cents with 4 coins

The solution is unique if there is one though.

Basically you take the set A = {x,y,z,w in N such that 25x + 10y + 5z + 1w = 25}

Then you take the set B = {x,y,z,w in N such that x + y + z + w = 3}

Then your result is A intersection B.

It would be simple to write an algorithm to do exactly that but you could make optimizations to make it run faster.

##### Share on other sites
Quote:
 Original post by ph33rNo, there is only one answer because their is a restraint on the problem. The restraint is you have so many coins that add up to a certain amount of money.

Quote:
 Original post by O_oThe solution is unique if there is one though.

No, there can be more than one answer as well as there can be less. For instance, you can get 30c with 6 coins in two ways (25+1+1+1+1+1 or 5+5+5+5+5+5).

##### Share on other sites
I'd be able to tell you if it were in pounds, shillings and old pence ;)

Er, a dime's 5c isn't it and I'd guess a quarter's 25c.

Anyway, the solution's a simple box fitting solution in three steps (because you've got three coins).

1) find the largest coin that is less than 25c
2) find the largest coin that is less than the remainder
3) the remainder of that is the value of the last coin

The "less than" contraints aren't "less than or equal" because you know there's three coins.

##### Share on other sites
It's so because many "positive integer" problems are not very generalizable, and in many cases can not be solved without doing some iterations. Even simple ones. Intersection of several sets it's general solution to all problems.

With that problem, you can just calculate it as minimal amount of coins, and then do several replacement,like, 10=2*5 or 20=2*10
(for some really weird money systems(something like.... 1,2,3,4,5,6,7,8,9,10,20,25,30,50,100) that might not work in some cases. I don't know your system exactly, probably it's provable that any such problem can be solved by that method).

as about story about PHD students, i'd say, it must mean something is very wrong with education system.

p.s.
Good example of integer problem:
xn+yn=zn
n is integer
n>2
prove that there's no that integers x,y,z so equality is true.
[grin]

##### Share on other sites
Quote:
 Original post by teamonkeyI'd be able to tell you if it were in pounds, shillings and old pence ;)Er, a dime's 5c isn't it and I'd guess a quarter's 25c.Anyway, the solution's a simple box fitting solution in three steps (because you've got three coins).1) find the largest coin that is less than 25c2) find the largest coin that is less than the remainder3) the remainder of that is the value of the last coinThe "less than" contraints aren't "less than or equal" because you know there's three coins.

depends.
what if it's 31 and you need to do that in 7 steps, and there's 25c,5c,and 1c?,

(solution is not unique,25+6*1 or 5*6+1)

largest less than 31: 25
largest less than 6: 5
largest less than 1: none.

So you'll need to traverse a tree.

##### Share on other sites
As I can't find my password at the moment, and my email's broken, I post this as an AP.

If you're looking for a simple equation to solve it, you won't find one. As you said, there's too many unknowns to solve for. It's a multi-step question.

If anyone's still looking/wanting an answer for this, it's 2 dimes and a nickel.

-overflowed

1. 1
2. 2
3. 3
Rutin
19
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633659
• Total Posts
3013207
×