# Probability -- In a well shuffled deck of cards, what is the expected number of Spades between the Ace of Hearts and King of Diamonds.?

To elaborate, I m looking to find the expected number of cards that are Spades that lie between wherever the Ace of Hearts and King of Diamonds are in the shuffled deck. Have been unsure of this for a while now, so any help would be greatly appreciated.

### 2 Answers

- Anonymous5 years agoFavorite Answer
Let’s add things up assuming that the Ace comes before the King. Then the cases where the King comes before the Ace, because of symmetry, will give us the same answer, and we can just double the result.

Write X(n) to be the event that there are n cards in between the Ace and King.

The solution is fairly simple, but can get messy. You need to list the possible cases, and get a formula for the sum of the probabilities for X(n). The evaluation of the formulas will involve nothing more sophisticated than knowing the sum of the first n integers, or the sum of the squares of the first n integers. This is something commonly seen in problems of this nature.

The probability is 1/52 that the Ace is in position 1 (I'll just write A=1 to indicate that, and K=n to indicate the King's position). Then the probability is 1/51 that the King is in any other position. I’ll work on just the cases where the King’s position is > the Ace’s position. 52x51 = 2652, so there is a 1/2652 probability for each combination of the Ace’s and King’s position

If A=1, then there is an equal probability for X=0, 1, 2, 3, ... or 50

If A=2, then there is an equal probability for X=0, 1, 2, 3, ... or 49

...

If A=50, then there an equal probability for X(0) to X(1).

All those probabilities are 1/2652.

Add those probabilities up:

For X(0) you get (1/2652) times the sum of

0 to 50 = 50 * 51 / 2

0 to 49 = 49 * 50 / 2

...

0 to 1 = 1 * 2 / 2 = 1

This is where the summation formulas come into play. You have

sum k=1 to 50 (k)(k+1)/2

= sum k=1 to 50 (k^2 + k)/2

Use sum of the first n squares = n(2n+1)(n+1)/6 and sum of n integers = n(n+1)/2 to evaluate that, and you get, using n=50:

50(101)51/12 + 50(51)/4 =22100

That’s the sum of X(k) for all the cases where the Ace comes before the King. Double that to include the sum of X(k) for the cases where the King comes first. Then divide by 2652 to get the average value.

The expectation of X = 44200 / 2652 = 16.6667 = your answer.

I set up a simulation of this problem, and in 10000 trials I got an average number of cards = 16.6264, which is in close agreement to the theoretical answer.

I'm trying to find a quicker way to solve this. All I have is this non-rigorous approach. Think of the deck of 50 cards in the deck without the Ace and King. Insert those cards into the deck, dividing the deck into 3 sets, 2 of which can possibly be empty. The sets are those before the first card, between the two cards, and after the last card. On average, the 3 sets contain the same number of cards, which will be 50/3 = 16.6667. In other words, selecting the two random spots to insert the cards divides the deck into 3 sets, which on average are equal. Sorry, I don't have a good logical explanation as to precisely why this should be, but it "seems right." Horrible reasoning, but in this case it turns out to be true. Sometimes intuition is correct, sometimes not.

The simulation I ran confirms that each of the sets have the same number of cards.

All this says is: on average the dividers are in a sense evenly divided in the deck. It's not a profound result, but it's intuitive & can be handy to have in you tool box of math tricks. A proof would be nice. Each particular case can be proven as above, I think. If you have a nice proof, email me.