# Modular arithmetic word problem

We are buying a total of 12 fruits (apples and bananas) for 132 dollars. If the apples are 3 dollars more expensive than the bananas, and we bought more apples than bananas, how many bananas we bought?

Or in other words:

• Let $a=$ Apple price
• Let $b=$ Banana price
• Let $x=$ Apples bought
• Let $y=$ Bananas bought

We know that:

$$x+y=12$$

$$x>y$$

$$a=b+3$$

$$xa+yb=132$$

therefore $$x(b+3) + yb=132$$

which yields $x=44-4b$ or $y=4b-32$

-
What are your thoughts? What have you tried so far? –  Rahul Jan 20 '13 at 1:49
I tried to solve a system of linear equations, but as there are more variables than equations i see it can't be done that way. I don't know how to implement the modular arithmetic (most probably congruence because that's what we are studying right now) so i got stuck. –  Random Jan 20 '13 at 1:55
Please write it up for us, we read that easier than text:) And, I guess you also need the implicit information that we are looking for integer numbers. –  Berci Jan 20 '13 at 2:22
Is this more helpful? –  Random Jan 20 '13 at 2:45

Let be $\,x=$ the number of apples, $\,a=$ price of each apple, $\,y=$number of bananas, $\,b=$ price of each banana, then you have the equations

$$x+y=12\Longleftrightarrow x = 12-y\;\;,\;\;\;ax+by=132\;\;,\;\;\;a=b+3\Longleftrightarrow$$

$$(b+3)(12-y)+by=132\Longleftrightarrow 4b-y=32$$

Do a little more algebra, take into account that $\,y>x\,$ and they both are integers...and what is a clear divisor of $\,y\,$?

-
That's as far as i got, i am stuck right there. –  Random Jan 20 '13 at 2:49
Ok, can you tell what a clear divisor of $\,y\,$ is? –  DonAntonio Jan 20 '13 at 2:55
Sorry, i don't know. –  Random Jan 20 '13 at 3:01
$\,y=4b-32\,$ , so if the right side is divisible by $\,4\,$ ... –  DonAntonio Jan 20 '13 at 3:02
Well the divisor of y has to be 4 as well then? –  Random Jan 20 '13 at 3:19

Using all the former substitutions we have x=12-y,x>y,,, 12-yy or y>6 Both apples and bananas were bought, so y is between 1 and 5 from earlier solutions we have that y=4b-32 therefore y is divisible by 4 from information in the third line we conclude that y=4 So there are 4 bananas bought.

-