# How many marbles are in the bag? [duplicate]

The bag contains marbles of three different solid colors. All but two of the marbles are red. All but two of them are green. All but two of them are blue.

• I know it sounds stupid, but you gave the answer yourself in the question, "all but two of the marbles" of different colours (you gave only 3 colors) so it's 1 of each, no math, nothing required (the logical-deduction tag is a hint in my opinion) – Schneejäger Jul 12 '17 at 6:59
• seems like a duplicate of puzzling.stackexchange.com/q/4854 just marbles instead of cars. – MPS Jul 12 '17 at 7:02

three: one red, one blue, one green.

To prove that this is the only possibility, let $R,G,B$ be the numbers of marbles of each colour in the bag. "All but two of the marbles are red" means $G+B=2$, and similarly $R+B=2$ and $R+G=2$. But each of $R,G,B$ must be a non-negative integer, so now the solution is clear.

• You didn't account for the possibility that there are marbles of some color other than red, blue, or green. You can show that this is not possible, but you have to actually do it. "All but two of the marbles are red" means $G + B + N = 2$ where $N$ is the number of marbles some color other than red, blue, or green. – David Schwartz Jul 11 '17 at 21:23
• @David No, the question explicitly says "The bag contains marbles of three different solid colo[u]rs". – Rand al'Thor Jul 11 '17 at 22:06
• Right, so? That doesn't rule out the bag having yellow, orange, and purple marbles. "All but two of the marbles are blue" can be true even if there are no blue marbles, for example, if there are two orange marbles in the bag. – David Schwartz Jul 11 '17 at 22:41
• Rather than introduce an N into the math, I think that case can be more simply handled by saying "There must be at least one red marble, because if there weren't, then there would be only two marbles, so there cannot be three different colors of marbles" and repeat for blue and green. – Joe K Jul 11 '17 at 22:44
• You can easily solve those equations without even needing "must be a non-negative" and "now the solution is clear". Some good rigorous algebra does the job much better. Just add all three equations together to get $2R + 2G +2B = 6$ and hence $R + G + B = 3$. Or you could subtract one from another to get a set of equations like $G - R = 0$ which then lead to $G = R = B$ and substituting into any of the equations gives you the value of each. – Chris Jul 11 '17 at 23:14

Here's my answer taking into account the possibilities of other colors. Sorry it's a bit long-winded. Any suggestions to help shorten or clarify are appreciated.

3, one red marble, one green marble, and one blue marble.

Proof:

Let $M$ = the number of marbles in the bag. Let $R, G, B$ = the number of red, green, and blue marbles in the bag respectively. Let $X$ = the number of non-red, non-blue, and non-green marbles in the bag.

$M≥3$ because the bag contains three colors of marbles and the minimum number of marbles required to satisfy this is $3$.

$R+G+B+X=M$ because all the red, green, blue, and other-colored marbles must add up to the number of marbles in the bag.

Substitute the inequality, and we have:
$R+G+B+X≥3$

All but $2$ marbles are red, all but $2$ marbles are green, and all but $2$ marbles are blue. In other words, there are $2$ non-red marbles, $2$ non-green marbles, and $2$ non-blue marbles, so we have:
$G+B+X=2$
$R+B+X=2$
$R+G+X=2$

If we rearrange the equations, we have:
$X=2-G-B$
$X=2-R-B$
$X=2-R-G$

When we plug each of these into $R+G+B+X≥3$ for $X$ and solve, all but one variable cancels out in each case and we have:
$R≥1$
$G≥1$
$B≥1$

Since we know $R$, $G$, and $B$ all have to be at least $1$, then $0$ is the only value for $X$ that could satisfy:
$G+B+X=2$
$R+B+X=2$
$R+G+X=2$

So now we know we can safely ignore $X$ because it is $0$. That means we have:
$R+B=2$
$R+G=2$
$G+B=2$

We can rearrange the first and second equations to get:
$B=2-R$
$G=2-R$
and then plug it into the third equation to get:
$(2-R)+(2-R)=2$
$-2R+4=2$
$-2R=-2$
$R=1$

Now, after plugging $R$ into the previous equations, we have:
$B=2-1=1$
$G=2-1=1$

Therefore:
$R=1$
$B=1$
$G=1$

3

Logic:

By symmetry there must be a multiple of 3 marbles. 0 can be ruled out. 3 works. 3k+3 means there are 3k+1 red, green and blue marbles, making 9k+3 marbles in total, but 3k+3=9k+3 means k=0, our only solution.

• How does symmetry show there must be a multiple of 3 marbles? Nothing in the problem statement rules out the possibility of marbles that are neither red, blue, nor green. And how can zero be ruled out exactly? There can be zero red, zero blue, and zero green marbles in the bag and possibly some marbles of other solid colors. – David Schwartz Jul 11 '17 at 21:20
• @DavidSchwartz: So by your interpretation, two purple marbles and zero each of red, green, and blue is a valid solution? – Nemo Jul 12 '17 at 6:39
• @Nemo If it's not a valid solution, the proof above doesn't show why it's not a valid solution. There are two interpretations of the problem and this answer doesn't, IMO, correctly address either of them. – David Schwartz Jul 12 '17 at 7:34

Let N be the total number of marbles, with R, G, B the number of red, green, and blue, respectively.

The conditions literally say:

R = N - 2
G = N - 2
B = N - 2


...from which R = G = B is immediate.

If you think the problem statement only permits red, green, and blue marbles in the bag, then N = R+G+B = 3R and you can solve trivially. If you allow other colors, then it is a quick exercise in inequalities:

R + G + B <= N
3R <= N
3R <= R + 2
2R <= 2


Yielding R=G=B=0 or R=G=B=1, assuming marble counts are non-negative integers. The former would imply a bag with only two marbles, which I think few would describe as "three different solid colors"... But vacuous truth hurts my head, so who am I to judge?

The latter yields N=3 which is the solution to the puzzle.