Placeholder Image

Subtitles section Play video

  • Two sets of cards, 1 2 3 4, ace is one, 4 3 2 1, again ace is one,

  • spades and hearts, black and red. They're in opposite orders. I now turn them over

  • and

  • we're going to shuffle them and you decide which one to shuffle but the shuffling means always to take the top card and

  • put it at the bottom. That's shuffling.

  • Okay, that's one shuffle.

  • And, each time we shuffle, you tell me which one to shuffle, I'll shuffle that one.

  • Okay, so let's shuffle a number of times. Well, what can we say? Oh, let's use the phrase numberphile shall we?

  • So numberphile: N-U-M-B-E-R-P-H-I-L-E

  • So, for each of these letters you say well, shuffle the right one or the left one. And you can say

  • You know, N-U-M

  • B-E-R-P-H and so forth.

  • You can choose whatever you like. Okay, so Brady, you tell me which one to shuffle, then. So left or right?

  • -So, N -Yeah

  • U

  • M

  • B

  • -E -Yes, sorry, E

  • R

  • P

  • H

  • I

  • L

  • E

  • Okay, so those two cards emerged to the top as a result of your choice, I didn't choose this.

  • So I'm going to set them aside. Yeah, two of them.

  • Now, we repeat numberphile again and for each of those letters

  • We shuffle either of these and you choose which ones shuffle for each of those data. So which one do you want?

  • Let's do . . . Let's do all of them that one.

  • Oh my god. So, okay N-U-M

  • B-E-R

  • P-H-I

  • L-E

  • I wasn't expecting this. Okay those two cards emerged to top.

  • In fact, this one didn't move but this emerged to the top so I put these aside.

  • Now one last time, numberphile, and you choose which one to shuffle.

  • OK

  • N

  • U

  • M

  • B

  • E

  • R

  • P

  • H

  • I

  • L

  • E

  • OK, these two emerged to the top,

  • and these two are left over.

  • OK.

  • Now if we were really lucky and luck doesn't come except to the deserving.

  • Because numberphile is such a magic phrase,

  • these two

  • may be the same number.

  • You know numberphile means "liking numbers" and these two numbers like each other, of course, 2 and 2, but that might have been luck.

  • But if we really believe in that magical numberphile, these two might have matched

  • Remember, you chose which one to shuffle, yeah? I didn't. That's surely not possible.

  • But what's really impossible would be impossible?

  • Is for the next two to match and the surprise par surprise, the last two also match.

  • So they all match pair-wise.

  • Lovely! Numberphile -- I knew it was magic.

  • We knew it was magic.

  • So the trick that I have just shown you is a classic trick which was described for the first time as far as I know

  • by the late Martin Gardner called The Last Cards Match

  • and I made a variation on this and the variation is a little slower than the original trick

  • But it's also mathematically more interesting. So I'd like to reveal the secret.

  • What we had was two piles of cards

  • You have 1, 2, 3, 4 in one order

  • and 1, 2, 3, 4

  • Or if you like 4 3 2 1 in the reverse order, and these should be thought of as like clocks

  • Okay, so a clock has you know, 1, 2, 3, 4 all the way to 12 and then it starts all over again.

  • So you are doing modular arithmetic here

  • Also, if you go one two, three four, and if you want to go five here six here seven here eight here

  • And so we can keep going. Okay, you remember that our way of shuffling was very special

  • We took the top card and then put it at the bottom

  • So you . . . as you keep repeating this you are cyclically or cyclically depending on the side of the Atlantic

  • Permuting those cards so you go from here to here to here to here and keep going

  • Whereas in the other deck which had the reverse order you go from to here to here to here, okay?

  • We had four cars but let's generalize and explain a little bit because this card trick works with any number of cards in general.

  • Let's say that you have cards one two three and so on

  • Arranged in a cyclic fashion all the way to M

  • So let's say M minus 2

  • M minus 1. M is number . . . total number of cards and I choose that M for a purpose on the other side you have because

  • In the reverse order M, M minus 1, M minus 2 and dotto dotto

  • You keep going and then 3 2 1 you come back like that. OK?

  • So in our card trick M was four, but in general it works and one shuffle does this:

  • you start from one and go to 2 and

  • 2 goes to 3 and here you go from M to M minus 1 and M minus 1 to M minus 2 and that kind of thing.

  • Suppose that on the left, that is the red pile you made

  • L

  • shuffles

  • On the right you made R shuffles, L as in left, R as in right.

  • Well, the total number of shuffles that we made was the number of letters in "numberphile"

  • N-U-M-B-E-R-P-H-I-L-E

  • 11 letters. So we know that L plus R was 11 for us.

  • So L and R are not independent. If you chose to shuffle the red deck L times,

  • automatically you are shuffling, whatever you else you do, the right deck R times, but R equals 11 minus L.

  • And if you choose to shuffle the right deck, that is the black deck, R times,

  • you cannot help shuffling the left deck, that is the red deck, 11 minus R times. So you have that relationship.

  • So let's start shuffling.

  • Say that you shuffle the red deck L times: 1 goes to 2. So each time you increase by one. 2 goes 3 and

  • if you keep going after L shuffles, it takes a little bit of thinking to

  • convince ourselves

  • You arrived at not L, but L plus 1

  • after L shuffles.

  • On the right, black deck

  • After one shuffle, you go from M to M minus 1, M minus 1 to M minus 2,

  • And if you keep going, and that is slightly less confusing,

  • at the end, you arrive at, after R shuffles, M minus R.

  • So, after those shuffles

  • the cards that emerge on the top of each deck is L plus 1 and M minus R. Those two cards emerge.

  • We used eleven

  • But let's say that L plus R was some number more generally which was chosen to be some number

  • Which is congruent minus 1 modulo M where M is the number of cards in each deck

  • So for us M was 4 and for us 11 was the chosen number and eleven is minus 1 mod 4, by the way.

  • Where have you pulled . . .yeah, where have you pulled that minus one mod M from?

  • We'll see why this minus 1 becomes useful in a moment

  • That's . . . that's part of the magic

  • OK.

  • You have to do magic at some point, okay?

  • So, let's see what L plus 1 is compared with M minus R and we'll see that they are actually the same thing. You see?

  • Because L we see is equal to . . . look at this,

  • L plus R equals minus 1, or congruent minus 1, so L equals minus 1 minus R.

  • Let's not forget plus 1, so minus 1 plus 1 cancel, and you are left with only

  • Minus R. So this is modulo M

  • But minus R can be written by modulism again as M minus R. That's the same thing, module M.

  • Doing it like that. Ok, and so what we see is that

  • Module M, L plus 1, the top of the red deck and M minus R

  • top of the black deck,

  • are actually the same. So after those shuffles, the same cards

  • emerge on the top. You put them aside now you have to start over again.

  • And then the number of cards M changes, but that's where minus 1 becomes useful.

  • 11, that we chose,

  • that's the number of letters in numberphile, has the beautiful property that it is

  • indeed congruent minus 1 mod 4.

  • That's the initial number of cards in each deck. After I set out the top cards together, you have now . . .

  • Do the same thing mod three?

  • But 11 is also

  • minus 1 mod 3 and

  • Next stage, you have you lost one pair of cards

  • You have to do mod 2, but amazingly 11 is also

  • Minus 1 mod 2 and that is why this number, magic number, key number, 11, worked.

  • Just as you descended those different moduli, the chain of order, mod 4, mod 3, mod 2

  • Okay, and that's how I chose 11.

  • Or, if you want to do this card trick in other . . . with other parameters

  • For example with larger number of cards and 10 and 12 and so forth and so forth

  • All you have to do is to solve this, what is called simultaneous system of congruences.

  • Like a simultaneous system of equations but you are doing modular arithmetic and

  • There is a way of doing it's called Chinese remainder theorem

  • By the way, the standard way we teach and learn Chinese remainder theorem has modules all co-prime.

  • They should all be co-prime, but this is a tricky case

  • of Chinese remainder theorem because for example 2 and 4 are not co-prime.

  • But even there there is a version of Chinese remainder theorem that works.

  • So this kind of congruence . . . system of congruence is always solvable. So you give me any M,

  • so use a lot of cards if you like

  • but just reverse the orders here and here and you find some key number which is equivalent to 11

  • But some X which is minus 1 mod M

  • also minus 1 mod M minus 1, minus 1 mod M minus 2,

  • so all the way down all those moduli. You should always be minus 1. You should solve

  • those simultaneous equations for X and using that

  • number of phrases, this trick always works.

  • So if I had two powers of ten, there'd be some other word I'd be having to use?

  • That's right, but it could be a longer phrase and longer word and

  • But I'm sure it would be some word, like numberphile, which would be special significance to you.

  • If you'd like to try your hand at some of the mathematical card tricks you've seen on numberphile, but don't own a deck of cards

  • Well, you could try these numberphile ones. There's a link with more information about them down in the video description

  • And if you'd like to see more videos about playing cards, well,