# We want to buy 20 fruits in the market: Apples, Bananas, Coconuts, and Durians. Intense Math Problem.?

We want to buy 20 fruits in the market: Apples, Bananas, Coconuts, and Durians. We can tell apart different kind. We must buy at least 4 Apples and 3 Coconuts, but we must not buy more than 5 Bananas. Also, we must not buy more than 4 Durians. In how many different ways can this shopping be carried out?

Not sure how to go about this. I feel like there is a possibility of thousands of shopping options in this case. Any help?

Relevance
• Anonymous
7 years ago

There is a way to do this using generating functions, but it has been too far back for me now. We will use a longer yet systematic approach. Let A, B, C, and D be the number of apples, bananas, coconuts, and durians purchased. Then we require A + B + C + D = 20 with A>=4, C>=3, B<=5, D<=4.

Let x=A+4 and y=C+3. Then the problem becomes x+B+y+D = 13 with x>=0,y>=0, B<=5, D<=4.

We take each case for B seperately, B=4,3,2,1,0. Then we have

x+y+D=8, x+y+D=9, x+y+D=10, x+y+D=11, x+y+D=12 or x+y+D=13 with the conditions x>=0, y>=0, and D<=4.

For each of these 6 cases, we take the cases D=4,3,2,1,0. This will result in 6*5=30 cases. Instead of listing them explicity, I will show them in the following way:

x+y=4, x+y=5, ..., x+y =8

x+y = 5, x+y=6, ..., x+y =9

x+y=6, ........., x+y=10

x+y=7, ........., x+y = 11

x+y=8,.... , x+y=12

x+y=9, ..... x+y =13

All 30 with the condition x>=0 and y>=0. Now, it is not hard to see that the equation x+y=k has k+1 many solutions where x>0 and y>=0. So the total number of solutions of these 30 equations is

(5 + 6 + ... + 9) + (6 +....+ 10) + (7+...+11) + (8+...+12) + (9+...+13) + (10+....+14)

= 35 + 40 + 45 + 50 + 55 + 60

=285

So there are 285 ways he can buy 20 pieces of fruit given the 4 restrictions.

If I'm not mistaken, the generating method involves looking at the expansion of (a+b + c +d)^20, taking only the terms which have exponents on a,b, c, and d that are >=4, >=3, <=5 , and <=4 respectively, setting a= b= c=d=1, and then calculating the result. In many ways this is just as lengthy as what we did here.

• makela
Lv 4
3 years ago

no, i might quite use the money to purchase sturdy high quality sparkling durian or coconut juice on the industry, quite than spend time interior the fruit orchard the place i ought to have a spiky fruit land on my head and kill me ....