Posted by: rjgage | November 18, 2008

Mathemagic Tricks: A Review of “Invariants under Group Actions to Amaze Your Friends”

This weekend, I presented the findings of the excellent mathematical paper “Invariants under Group Actions to Amaze your Friends” by Douglas Ensley to my grandfather. I carefully set up the “magic” trick described in the paper and performed it for him. The trick is performed in the following way:

1.  Remove all the aces in the deck.

2.  Arrange the aces with the heart face-up on the bottom with the club on top of it, then the diamond then the spade on top. Turn the spade on top face-down.

3.  Allow the spectator to shuffle the deck by performing any of the following as many times and in any order they desire:
a.  Flip the top two cards as one.
b.  Cut any number of cards from the top to the bottom of the deck.
c.  Turn the entire stack over.

4.  Then, with gratuitously ostentatious prestidigitation, turn over the top card, then the top two together, then the top three together.

The ace of clubs will be the only card facing the way opposite all the other cards.

Due to his spending a career as a chemical engineer my grandfather has an eye for things mathematical and stopped me as soon as I finished explaining the rules for shuffling. He said that this was no trick at all because “none of [my] methods of ‘shuffling’ changes the basic picture of the 4-card deck.” I was dumbfounded at being shut down so immediately and thoroughly by my grandfather who never even took Math 152. He immediately saw in this trick, and expressed in a succinct way the mathematical meat of all “fair” card tricks: usage of properties invariant under group actions on a deck of cards to give the illusion of magic.

The article set forth an explanation of card tricks using language unfamiliar to this course but focusing on concepts central to our study of groups. The first such definition is that of a “group action.” According to Wikipedia, “if G is a group and X is a set then a group action may be defined by a group homomorphism from G to the symmetric group of X.” Did your heart skip a beat when you saw the words “symmetric group of X”? Mine did. In this context, then, it can be said that a group action f is the mapping of G and X to X with the properties:

f(e, x) = x, where x is an element of X and e is the identity element of G.

f(g, f(h, x)) = f(g*h, x), where g, h are elements of G and x is an element of X.

Note that elements from the group Sn acting on the set of n elements fit this definition, we can start to get a real taste of the group action.

Invariant properties are the next piece of the mathematical magic-trick puzzle. We all have from linear algebra many a foggy recollection of “T-invariant subspaces.” Just like a T-invariant subspace of a vector space V with a linear transform T is W such that T(W) = W, invariant sets are those which are mapped to themselves under any permutation in a subgroup. This means that given a set X with a subset Y defined by a particular property (call it a function h: X ~~> Y) and a group action f with group G, then h is an invariant property of X if h(X) = h(f(G,X)).  These concepts are applied in the creation of what I consider to be real magic.

The article, in proving various invariant properties of the set of eight elements under a subgroup of permutations from the group S8, reveals a handy recipe for fair magic trick creation.

First, select a possibly invariant property of the ordered set of n playing cards to use somehow in your trick.

Then determine a subgroup of Sn to define group actions that seem to the casual observer to be like shuffling the cards but under which the property in question is invariant.

Then make up a fun story to go along with your card trick and use the invariant property to show the cards, deliver the punch-line, and amaze your friends!

Now to apply this recipe to the magic trick illumined by Dr. Ensley. In the trick, one actually uses two properties each invariant under three different group actions. The three spectator-shuffling actions are the group actions, and the first useful invariant property of the set is that there are always either one or three cards facing down. The second is that the club is always two cards away from the card facing the way opposite the others.

Action 1: Flip top two cards as one.

This action does not change the numbers of cards facing each direction, nor does it change where in the stack those cards are. Therefore the first property is invariant. Considering all possibilities readers can prove to themselves that the second is invariant.

Action 2: Cut the deck.

This action does not turn over any cards so the first property is invariant. Again considering each possible ordering of cards in the set readers can prove to themselves that the second is invariant.

Action 3: Turn the whole stack upside-down

This action does not change which card faces the way opposite the others or the relative position of the club. Both properties are invariant under this group action.

Then the final action: flip the top card, then the top two cards as one, then the top three cards as one. Consider the two possible cases, 1) the club is the first or third card or 2) the club is the second or fourth card. In case 1 the operations will turn over both the club and the wrong-facing card and the club will be wrong-facing. In case 2 the operations will turn over the other two cards, leaving the club as the wrong-facing card.

Make sure to check out the article “Invariants under Group Actions to Amaze Your Friends” by Douglas Ensley on the course website for discussion of a few other pairs of invariant properties and group actions to use in constructing a magic trick of your own!



  1. Hi,

    I’m not really following the instructions in the trick. What does the volunteer do with the stack of aces after step 2? I also don’t understand what you’re supposed to do after Step 4. And, what if the volunteer decides to do nothing in Step 3?

    I found the source of these instructions on the Web, but they’re the same.

    Please elaborate?

    Thanks, Jim

  2. Magic tricks are a particularly fun application of group theory, and many of them are based on this idea of an invariant property — quite and important idea mathematically too. To math 152 on the blog: I hope you’ll all be on the lookout for these in your daily life (especially if you are related to rjgage).

    Although we didn’t use the language of invariant properties in class, we did use the idea sometimes. Here’s a simple example: there are two kinds of symmetries for a polygon. Those that flip the polygon and those that don’t. Which side of the polygon is facing you is invariant under the subgroup of rotations. This helps you count the number of symmetries of a polygon. In more abstract terms, we can say that the property of “what coset of a normal subgroup an element belongs to” is invariant under the action of the subgroup itself.

    A clarification about the way you describe invariant properties. You wrote:

    “This means that given a set X with a subset Y defined by a particular property (call it a function h: X ~~> Y) and a group action f with group G, then h is an invariant property of X if h(X) = h(f(G,X)). ”

    This sentence is a little confusing, principally because you use the word “subset”. The map h: X -> {0,1} may determine a subset of X by considering all the elements that map to 1 as the subset. In that case, the idea that h(X) = h(f(G,X)) means the group action takes things in the subset to itself. But Y (the image of H) isn’t the subset.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: