# Colored items in a box

When I looked in an old box of mine I found the following x items with 4 different colors exactly:

• 5 items that are either blue or brown.

• 7 items that are either brown or yellow.

• 5 items that are either yellow or red.

Oh, also; there are more yellow items than brown items.

How many items are blue, brown, yellow and red respectively?

• Personally, I think there needs to be more clarity in the question that only (or "total" might be better) x items are either a or b. When I first read it I was considering the possibility that there could be 17 items you are describing which let me to believe the puzzle was unsolvable. Obviously based on the answers, not everyone thought this, but I just wanted to provide some feedback of how it could be misinterpreted. For example, if I said the answer was 1 blue, 1 red, 7 brown, 8 yellow, which part of your question would make that answer invalid? – musefan Jul 8 at 9:53

Solution:

4 yellow
3 brown
2 blue
1 red

Explanation:

There are more yellow than brown items, but if Y is 5 or higher, R is 0 or lower. So Y must be 4. The rest follows ...

Setting up some simultaneous equations:

Bl + Br = 5
Br + Y = 7
Y + R = 5
Y > Br

Now as there are more yellow than brown:

We know that there are no more than 3 brown items, and no less than 4 yellow items.
I.e. Br < 4 and Y > 3

Now

As there has to be at least one of each colour, and Y + R = 5 with Y > 3:

There has to be 4 yellow items and 1 red.

From here:

Brown = 3 and Black = 2

So the final amounts are:

1 red, 2 black, 3 brown and 4 yellow

• +1 for the nice explanations! But i believe Glorfindel was first and his solution is simple but just as valid – Prim3numbah Jul 7 at 13:51

Since there are at most $$5$$ yellow or red items, there are at most $$5$$ yellow items. Since there are more yellow than brown items and $$7$$ yellow and brown items in total, there must be at least $$4$$ yellow items. So the number of yellow items is either $$4$$ or $$5$$.

Case 1:

There are exactly $$4$$ yellow items. Then we must have $$5-4 = 1$$ red item, $$7-4=3$$ brown items and $$5-3=2$$ blue items.

Example box with all required properties: $$4$$ yellow items, $$1$$ red item, $$3$$ brown items, $$2$$ blue items, nothing else.

Case 2:

There are exactly $$5$$ yellow items. Then we get $$5-5 = 0$$ red items, $$7-5=2$$ brown items and $$5-2=3$$ blue items. Since there are four colors of items in the box, there must be another color in the box (not red), of which there may be an arbitrary positive amount of items.

Example box with all required properties: $$5$$ yellow items, $$2$$ brown items, $$3$$ blue items, $$1000$$ green items, nothing else.

• This is expanding on a case not considered in @Glorfindel's answer, since that answer is making an assumption not stated in the problem. – Magma Jul 7 at 20:45
• Of course this answer is making an assumption too: rot13(jub fnvq vgrzf pnaabg unir zhygvcyr pbybef?) – Magma Jul 7 at 20:47