# Three cups and a ball

I am walking down the streets of Paris when a street performer approaches me. He has a row of 3 cups facing down on a table. He places a ball under the left cup. He proceeds to swap pairs of cups, keeping the ball hidden from sight. He moves them so quickly that I cannot trace the cup with the ball. However, I did notice that he touched the left-most* cup 5 times, the middle* cup 4 times and the right-most* cup 3 times.

The performer asks me which cup contains the ball now. Given the limited information I have, what should I answer to maximize my chances of guessing correctly? No computers please.

*These are the locations of the cups just before their swap, not their original starting locations.

• I saw this cup challenge when I lived in Paris as a kid. I've always wondered if it is possible to win the challenge using maths. Jul 18 at 13:09
• I'm pretty sure the real answer is that in this situation they are almost certainly cheating somehow, and they are almost certainly either going to swindle you or have a confederate pick your pocket while you're concentrating on their legerdemain, so you should refuse to have anything to do with it :-). Jul 18 at 14:56
• I think I know the answer! But my explanation is lengthy... Jul 18 at 15:10
• Yeah, it's a simple sleight-of-hand. It's not a 33% chance. It's a 0% chance. In reality, it doesn't matter which cup you choose, the ball is most likely under none of them, but instead palmed in the performer's hand or otherwise hidden until it's put back on the table under one of the cups you didn't choose. If you see anyone actually pick the right cup, it's a friend of the scammer, to give other people a false sense of security. Jul 19 at 13:33
• Whenever you see this in Paris, you should walk away. The tricky part is definitely NOT to follow the movements of the cups. Aug 20 at 21:52

WLOG, let's assume the ball is initially in cup 1 on the left. Then, the probability of the final position of the ball is:

$$P(L)=30\%$$, $$P(M)=35\%$$, $$P(R)=35\%$$.

There are numerous ways of counting this, but here is a neat method using a triangle!

But before that

let's calculate the number of switching of each pair of cups based on the given conditions.
Let $$A$$ denote the action of switching the left and middle cups, $$B$$ the switching of middle and right cups, and $$C$$ the switching of the left and middle cups. Assume $$xA$$'s, $$yC$$'s and $$zB$$'s are performed. Then, we have $$x+y=5, x+z=4, y+z=3,$$which produces$$x=3, y=2, z=1.$$

Now let's introduce the triangle! In the picture, the black-and-white triangle with 1 2 3 denotes the cups, and the red, green, and blue circles denote the positions. Consider every move as an action performed on the triangle, such as rotating or flipping it, and ensuring that its three vertices land in the three circles.

For example, consider the action switching the middle and right cups. That action can be represented using our triangle in the following way: With the help of a triangular slip of paper, it can be shown that all "switchings" is equivalent to flipping the triangle, and performing two "switchings" is equvalent to a rotation by a certain degree, namely: $$AA=BB=\text{0 degrees rotation}$$$$AB=BC=CA=\text{120 degrees, clockwise rotation}$$$$BA=CB=AC=\text{120 degrees, counterclockwise rotation}$$. Note: the notation $$XY$$ where $$X$$ and $$Y$$ are both actions represents the resultant action of first performing action $$X$$ then performing action $$Y$$.

Now what?

Notice that we can perform 3$$A$$'s, 2$$C$$'s and 1$$B$$ is total-that's 6 "switchings", equivalent to 3 rotations. Hence, by splitting the string of 6 "switchings" into 3 groups of 2 "switchings", or 3 rotations, the problem immediately becomes much more approachable!

And here's the final part of the analysis.
Here's the string of actions: (xx) (xx) (xx). Consider overall action performed on the triangle in the following 4 cases:

Case 1: (AA) and (CC) are in the string of actions.
Then the remaining (xx) must be (A&B). (The notation (X&Y) means either (XY) or (YX).) There are 6 ways to arrange the 3 groups of actions no matter what the remaining (xx) is. Also, the final outcome is completely dependent on the outcome of the remaining (xx), as actions (AA) and (CC) do nothing.
Conclusion: 6 unique strings of actions with the resultant action being 120 degrees, clockwise rotation; 6 unique strings of actions with the resultant action being 120 degrees, counterclockwise rotation.

Case 2: (AA), but not (CC), is in the string of actions.
Then the remaining 2 (xx)'s must be (A&C) and (B&C). There are 6 ways to arrange the 3 groups of actions no matter what the 2 remaining (xx) is. Also, the final outcome is completely dependent on the outcome of the 2 remaining (xx)'s, as action (AA) does nothing. The resultant action of the two (xx)'s can either be 120 degrees, clockwise rotation (when both actions rotate the triangle 120 degrees counterclockwise), 120 degrees, counterclockwise rotation (when both actions rotate the triangle 120 degrees clockwise), or nothing (when the two actions are in opposite directions, hence cancelling out with each other).
Conclusion: 6 unique strings of actions with the resultant action being 120 degrees, clockwise rotation; 6 unique strings of actions with the resultant action being 120 degrees, counterclockwise rotation; 12 unique strings of actions with the resultant action being doing nothing.

Case 3: (CC), but not (AA), is in the string of actions.
This is impossible by using the pigeonhole principle on action $$A$$.

Case 4: Neither (CC) nor (AA) is in the string of actions.
In this case, the three (xx)'s must each contain an $$A$$, with the other element being $$B$$ in two (xx)'s and $$C$$ in one (xx). In this case, there are three arrangements of the (xx)'s: (A&B) (A&C) (A&C), (A&C) (A&C) (A&B), (A&C) (A&B) (A&C). For each arrangement, there are 8 choices of the order of X and Y in (X&Y), of which two rotates the triangle a full 360 degrees back to its original position (all clockwise/counterclockwise rotations), 3 rotates the triangle 120 degrees clockwise (2 clockwise, 1 counterclockwise rotations), and 3 rotates the triangle 120 degrees counterclockwise (1 clockwise, 2 counterclockwise rotations).
Conclusion: 9 unique strings of actions with the resultant action being 120 degrees, clockwise rotation; 9 unique strings of actions with the resultant action being 120 degrees, counterclockwise rotation; 6 unique strings of actions with the resultant action being doing nothing.

And finally, in conclusion to the casework above: There are 21 unique strings of actions with the resultant action being 120 degrees, clockwise rotation; 21 unique strings of actions with the resultant action being 120 degrees, counterclockwise rotation; 18 unique strings of actions with the resultant action being doing nothing.
This can be verified to be correct, as $$21+21+18=60=\dfrac{6!}{3!\cdot 2!},$$which is the total number of distinct strings of actions.

Conclusion:

In all the possible strings of actions, $$18/60=30\%$$ doesn't do anything, leaving cup 1 (which we assumed to contain the ball) in its original position on the left. $$21/60=35\%$$ rotates the triangle clockwise by 120 degrees, meaning that cup 1 is now on the right. $$21/60=35\%$$ rotates the triangle counterclockwise by 120 degrees, meaning that cup 1 is now on the left.

• The triangle is actually unnecessary, but I thought this visualization is pretty cool! Jul 18 at 16:16
• This is correct! I am very impressed with this answer. Jul 19 at 2:24
• Of course, the real answer is that it's not under any of the cups as the performer palmed the ball while initially appearing to put it under the first cup. Jul 19 at 14:46