Can you explain this card trick?

Can you explain the card trick that is explained here?

Edit: Here's a summary of the trick as explained in the video:

Start by asking a spectator to pick any three cards they like out of a standard 52-card deck, without showing them to you, and write them down (to make sure they won't forget them). (Ed. note: You can shuffle the deck if you like, or even let the spectator shuffle it, but you don't have to.)

Divide the remaining cards into four piles, so that first pile will have 10 cards, the second and third piles will have 15 cards each, and fourth pile, set aside, will have the remaining 9 cards.

Now, tell the spectator to put the first card they picked on top of the first pile, then cut the second pile anywhere they want and put the top half on top of the first pile (and the card they picked). Then they should put the second card they picked on top of what remains of the second pile, cut the third pile anywhere they want and put the top half on top of the second pile, and finally put the third card they picked on what remains of the third pile and place the entire fourth pile on top of it. (Ed. note: You could have the spectator cut the fourth pile too, if you wanted; it shouldn't matter as long as all nine cards of it eventually end up on top of the third pile.)

Now collect the three piles of cards together so that pile #3 ends up on top of the deck, pile #2 in between and pile #1 on the bottom. Next, take four cards off the top of the deck and place them on the bottom. Deal the cards from the top of the deck alternatingly into two piles, the first pile face up and the second pile face down. Tell the spectator in advance to say "stop" if they see any of their cards in the face-up pile (which they won't).

Once you've dealt out the entire deck, set the face-up pile aside, pick up the face-down pile and repeat the process, dealing it into two smaller piles, the first pile face up and the other face down. Again, tell the spectator to say "stop" if they see any of their three cards in the face-up pile — they won't. Keep repeating this process until you're down to just three face-down cards. Show those cards to the spectator; they'll be exactly the ones they picked and wrote down.

-
I disagree with closing this question. It would be much better to make the question self-contained, by describing the trick in detail, so people didn't have to follow the link. But it is a real question with a mathematical answer, as Marvis has shown. –  Ross Millikan Dec 22 '12 at 4:17
It was such an involved trick that I thought the video would be the most efficient way to explain all that is going on. –  stan Dec 22 '12 at 4:30
If you want to type it out, have at it. Otherwise, close it. –  stan Dec 22 '12 at 4:56
Come on! This question was asked only 8 hours ago, but the external content is not accessible. This is really bad! Present the card trick here.. –  stefan Dec 22 '12 at 9:59
Link still working for me. –  stan Dec 22 '12 at 16:31

As Ross rightly points out, the cuts are just to seemingly make it random though it doesn't affect anything. Irrespective of the cuts, note that there are $15$ cards between the first card the contestant places and the second card the contestant places. Similarly, irrespective of the cuts, note that there are $15$ cards between the second card the contestant places and the third card the contestant places.

Let us label the cards as follows. Let $a_k^{j}$ be the $k^{th}$ card from top in the hand of the performer after the $j^{th}$ up-down phase. Initially, i.e. after the contestant places the cards and before the first up-down starts, $j=0$.

Now the cards in the last pile i.e. the pile containing $9$ cards (the only pile on which the contestant doesn't place any card) be $a_1^{0}, a_2^{0}, \ldots, a_9^{0}$ starting from the top most card. Let the third card the contestant places on the third pile be $a_{10}^{0}$. Then there are $15$ cards followed by the second card the contestant places on the second pile. Accounting for the $15$ cards in between, the second card is $a_{26}^{0}$. Now there are $15$ cards followed by the first card the contestant places on the first pile. Accounting for the $15$ cards in between, the first card is $a_{42}^{0}$. Hence, now the contestant cards are $\color{red}{a_{10}^{0}, a_{26}^{0}, a_{42}^{0}}$.

Now the performer moves $4$ cards to the rear. Hence, now the contestant cards are $a_6^{0}, a_{22}^{0}$ and $a_{38}^{0}$.

$$\color{red}{\{a_{10}^{0}, a_{26}^{0}, a_{42}^{0}\} \to \{a_{6}^{0}, a_{22}^{0}, a_{38}^{0}\}}$$

Now in the first up-down phase all the odd number cards are eliminated i.e. $a_{2k-1}^{0}$ gets eliminated. However, on the pile with the cards closed, the order has reversed i.e. $a_2^{0}$ is the bottom most card, followed by $a_4^{0}$ and so on and the top-most card is $a_{52}^{0}$. Now reordering the card so that the topmost card is now $a_1^{1}$, we find that the card $a_{2k}^{0}$ gets mapped to $a_{27-k}^{1}$. Hence, the contestant cards are now at $a_{24}^{1}, a_{16}^{1}$ and $a_8^{1}$. $$\color{red}{\{a_{6}^{0}, a_{22}^{0}, a_{38}^{0}\} \to \{a_{24}^{1}, a_{16}^{1}, a_8^{1}\}}$$ There are now $26$ cards left.

Now in the second up-down phase all the odd number cards are eliminated i.e. $a_{2k-1}^{1}$ gets eliminated. As before, on the pile with the cards closed, the order has reversed i.e. $a_2^{1}$ is the bottom most card, followed by $a_4^{1}$ and so on and the top-most card is $a_{26}^{1}$. Now reordering the card so that the topmost card is now $a_1^{2}$, we find that the card $a_{2k}^{1}$ gets mapped to $a_{14-k}^{2}$. Hence, the contestant cards are now at $a_{2}^{2}, a_{6}^{2}$ and $a_{10}^{2}$. $$\color{red}{\{a_{24}^{1}, a_{16}^{1}, a_8^{1}\} \to \{a_{2}^{2}, a_{6}^{2}, a_{10}^{2}\}}$$

There are now $13$ cards left.

Now in the third up-down phase all the odd number cards are eliminated i.e. $a_{2k-1}^{2}$ gets eliminated. As before, on the pile with the cards closed, the order has reversed i.e. $a_2^{2}$ is the bottom most card, followed by $a_4^{2}$ and so on and the top-most card is $a_{6}^{2}$. Now reordering the card so that the topmost card is now $a_1^{3}$, we find that the card $a_{2k}^{2}$ gets mapped to $a_{7-k}^{3}$. Hence, the contestant cards are now at $a_{6}^{3}, a_{4}^{3}$ and $a_{2}^{3}$. $$\color{red}{\{a_{2}^{2}, a_{6}^{2}, a_{10}^{2}\} \to \{a_6^3,a_4^3, a_2^3\}}$$ There are now $6$ cards left.

Hence, the last up-down has the open cards as $a_1^{3}$, $a_3^{3}$ and $a_5^{3}$; the closed cards being $a_2^{3}$, $a_4^{3}$ and $a_6^{3}$, which are precisely the contestant cards.

EDIT

Below is an attempt to explain this pictorially. The document was created using $\LaTeX$ and below is a screenshot.

-
+1. Well done.. –  Ross Millikan Dec 22 '12 at 5:20
+1 Now I call that "making an effort"...wow! –  DonAntonio Dec 22 '12 at 10:38

If you follow carefully, the cuts are an illusion. Before you start dealing the cards up and down you have a deck with 15 cards (including the five moved from the final 9), the spectator's card, 15 more, the spectator's card, 15 more, the spectator's card, and 4. The cards face up are all the ones in odd positions, but the spectator's cards are in places 16,32,48, so they don't show up. The even cards are now in their original positions divided by 2, so the spectator's cards are at 8, 16, 24. Each deal takes out the odd cards. Four deals leave you with just the spectator cards.

-
@stan: I had missed the reversal that Marvis points out. +1 to him. –  Ross Millikan Dec 22 '12 at 3:47

As mentioned, the key is to realize the special cards are sitting in positions 15, 31, and 47 (where the bottom card is 1 and the top card is 52).

When the up/downs begin, keeping mind the inherent order reversal that occurs when we pick up the down pile and start the next iteration, the positioning of the cards just goes like this:

So, at the 4th iteration, the only cards in the down pile are the ones in positions 15, 31, 47---the special cards!

-