Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I saw the following riddle:

You've been giving $\$$100 dollars to buy 100 items. Item A costs $\$$0.56, Item B costs $\$$2.26, and item C costs $\$$0.92. How can you spend all of the money on the 100 items?

Now I know to do the following:

.56A + 2.26B + .92C = 100
A + B + C = 100

Now doing the following:

  .56A + 2.26B + .92C = 100
- .56A -  .56B - .56C = -56
-----------------------------
         1.70B + .36C = 44 // Thanks Arturo Magidin

Now that leaves us with 2 unknowns but I need another equation to solve this. I also know that A B and C are all integers. How do I factor that in?

share|improve this question
2  
This is called a diophantine equation. –  Arturo Magidin Dec 30 '11 at 20:52
    
Note that your last equations are incorrect: multiplying the second equation by $.56$ gives $.56A + .56 B + .56 C = 56$. Subtracting it from the first equation would give you $44$ on the right hand side, not $.54$. –  Arturo Magidin Dec 30 '11 at 21:15
add comment

3 Answers

up vote 3 down vote accepted

As Arturo mentioned in his comment, this type of equations is called linear Diophantine equations, nice explanation how they can be solved is given in answers to this this question.

In your case, you want to find integers $b$ and $c$ such that $170b+36c=4400$, i.e. $$85b+18c=2200.$$

As you can check at wolframalpha (and if you learn how to solve linear Diophantine equations, you can try to get the result yourself), all integer solutions are $$\begin{align*} b&=18n+10;\\ c&=-85n+75. \end{align*} $$ Since you want $b,c\ge 0$, the only possible value is $n=0$. Thus you get $b=10$, $c=75$ and $a=100-b-c=15$.

share|improve this answer
    
Where on wolframalpha did you see b=18n+10;c=−85n+75? The link you gave didn't have it. –  qwertymk Dec 31 '11 at 23:22
    
Wolframalpha writes in the part integer solutions $x=2(9n+5)$, $y=-5(17n-15)$, $n\in\mathbb Z$. After multiplying these you get the above results. –  Martin Sleziak Jan 1 '12 at 5:14
add comment

HINT $\rm\ \ \ 170\ b + 36\ c\ =\ 4400\ \iff\ 85\ b + 18\ c\ =\ 2200\:,\ $ therefore

$$\rm mod\ 18\!:\ \ b\ \equiv\ \frac{2200}{85}\ \equiv\ \frac{440}{17}\ \equiv\ \frac{8}{-1}\ \equiv\ -8\ \equiv\ 10 $$

Thus $\rm\ \ b\ =\ 10 + 18\ n\ \ $ and $\rm\ \ c\ = \ \dfrac{2200 - 85\ (10 + 18\ n))}{18}\ =\ 75 - 85\ n $

Now $\rm\ b \ge 0\ \Rightarrow\ n\: \ge\: 0\ $ and $\rm\ c\ge 0\ \Rightarrow\ n\:\le\:0\:.\:$ Thus $\rm\ n\:=\:0\ $ so $\rm\ b,\:c\ =\ \ldots\ $ hence $\rm\ a\ =\ \ldots$

share|improve this answer
add comment

Given the tags [linear-algebra] and [matrices], this is what you need to do:

  1. Solve the problem using matrices in the usual way; since you have two equations in three unknowns, you will have infinitely many solutions. Express them in terms of a parameter.

  2. Find a value of the parameter that makes all variables into positive integers.

Here we have: $$\begin{align*} 56A + 226B + 92C &= 10000\\ A + B + C &= 100 \end{align*}$$ so we have: $$\begin{align*} \left(\begin{array}{rrr|r} 56 & 226 & 92 & 10000\\ 1 & 1 & 1 & 100 \end{array}\right) &\to \left(\begin{array}{rrr|r} 1 & 1 & 1 & 100\\ 28 & 113 & 46 & 5000 \end{array}\right) &&\to \left(\begin{array}{rrr|r} 1 & 1 & 1 & 100\\ 0 & 85 & 18 & 2200 \end{array}\right)\\ &\to \left(\begin{array}{rrr|r} 1 & 1 & 1 & 100\\ 0 & 1 & \frac{18}{85} & \frac{440}{17} \end{array}\right) &&\to \left(\begin{array}{rrr|r} 1 & 0 & \frac{67}{85} & \frac{1260}{17}\\ 0 & 1 & \frac{18}{85} & \frac{440}{17} \end{array}\right). \end{align*}$$

So the solutions are: $$\begin{align*} A &= \frac{1260}{17} - \frac{67}{85}t\\ B &= \frac{440}{17} - \frac{18}{85}t\\ C&= t \end{align*}$$ Now find the values of $t$ for which all three quantities are positive integers.

share|improve this answer
    
I just have to go through each way? What if there are 1000 items? and so on? –  qwertymk Dec 30 '11 at 21:16
1  
@qwertymk: You don't "have" to do anything; if you want to solve the problem, then you need to come up with a method, and which method you use will depend on which tools you wish to employ. The problem can be solved using congruences as well, but I assumed from your choice of tags that you are expected/required to solve it using matrices/systems of linear equations. If so, this is the way of doing it. If the number of items changes, the only thing that you would need to change is the last entry of the first matrix, and fix the computations on the last column. Then determine $t$. –  Arturo Magidin Dec 30 '11 at 21:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.