# How frequently am I going to lose this game?

I hope this question fits the site, if not feel free to flag.

In the place I live there's a simple game of cards that you play on your own. Cards are 40, let's say A1 ... A10 , B1 ... B10 , C1 ... C10 , D1 ... D 10. The game goes as follows:

1. You dispose all of the 40 cards on the table, with their face down. You have to create a 4x10 matrix, like below. Mentally, you assign each row to a type (A, B, C or D) and each column to a number (1...10).

cols:   _ 1 _ 2 _ 3 _ 4 _ 5 _ 6 _ 7 _ 8 _ 9 _ 10
row A |
row B |    HERE YOU HAVE THE 40 CARDS FACE-DOWN
row C |
row D |      X

2. Note that each card now, like the one I checked with a X, in addition to having its value (which you can't see because it's down) is strictly connected to another card through its position: X can identify the value D2 with its position.

3. You choose one card randomly, let's say X.

4. You flip it and see its real value, let's say B7.

5. You move to position B7 and flip that card, Y.

cols:   _ 1 _ 2 _ 3 _ 4 _ 5 _ 6 _ 7 _ 8 _ 9 _ 10
row A |
row B |                           Y
row C |
row D |      B7

6. So on.

You win if you manage to flip all the cards. You lose if at some point the value on the card you just flipped, points to a position which is already turned up. For example, you would lose immediately if Y has value D2 (it happens).

What is the probability one is going to lose?

This is probably a question one could solve with just some basic notions, but I don't have any.

We can ignore the rows and column, and just say that you have 40 positions and 40 cards that each point to a specific position.

For the first draw, you have 40 cards but only 1 card will make you lose the game (the card that points to the position you chose). This gives a probability of 39/40 to proceed to the next round.

In the second draw, you have 39 cards to choose from, and still only 1 card that will make you lose, because the card that points to the second position is eliminated from the deck. The only losing card is the one that points to your original position. This gives a probability of 38/39 to proceed.

This gives the following formula:

39/40 * 38/39 * 37/38 * 36/37 * 35/36 * 34/35 * 33/34 * 32/33 * 31/32 * 30/31     * 29/30 * 28/29 * 27/28 * 26/27 * 25/26 * 24/25 * 23/24 * 22/23 * 21/22 * 20/21 * 19/20 * 18/19 * 17/18 * 16/17 * 15/16 * 14/15 * 13/14 * 12/13 * 11/12 * 10/11 * 9/10 * 8/9 * 7/8 * 6/7 * 5/6 * 4/5 * 3/4 * 2/3 * 1/2

[1] 0.025


So the probability of winning is 2.5%

We can try this in a simulation using R (you will need to source the code in order for it to run):

set.seed(1)
card.game <- function() {
cards <- sample(1:40)
pos <- seq(1:40)
result <- NA
for (i in 1:40) {
if (i == 1) {
current.pos <- sample(pos, 1)
pos <- pos[which(pos!=current.pos)]
continue <- length(which(pos==cards[current.pos]))
if (continue == 0) {
result <- 0
return(result)
}
} else {
if (i == 40) {
result <- 1
return(result)
}
current.pos <- cards[current.pos]
pos <- pos[which(pos!=current.pos)]
continue <- length(which(pos==cards[current.pos]))
if (continue == 0) {
result <- 0
return(result)
}
}
}
}
result <- NA
for (i in 1:100000) {
result[i] <- card.game()
}
prop.table(table(result))

result
0       1
0.97494 0.02506


And the result, as you can see, is very close to 2.5% which confirms the calculations above.

• Yes. In the example provided by user "m vai", the first card selected was at position D2, and from the 40 possible cards, only the card labeled "D2" would be losing. The card revealed to have "B7" written on it, so we then proceed to take a look at the card on position B7. Now the card on position B7 can be any card except for the card that points to its own position, because that card is already taken and eliminated from the deck in the previous draw. So we now have 39 possible cards (excluding the one with "B7") and only the one with "D2" is losing.. and this will be the case until the end – JonB Sep 2 '15 at 11:32
• I see now that the question I responded to with my comment was deleted. The question was about why a card that points to its own location isn't a losing draw and I explained this. – JonB Sep 2 '15 at 11:33
• I trust you but would like some guidance on understanding. If there's one and only losing card in the deck (the one corresponding to the position you choose at first), the game appears equivalent to saying: name one card, shuffle the deck, and hope that that card is the last one. That probability should be 1/40. No? – natario Sep 2 '15 at 11:46
• Oh but 1/40 is 2.5% :-) thank you! – natario Sep 2 '15 at 11:46
• Yes, that's the way I see it too! No problem. :) – JonB Sep 2 '15 at 11:51

As @Jonas pointed out, in the whole game there's only one losing card, and it is the one you choose at first. If you ever flip that, you lose; if that is the last card you flip, you win.

Then a simpler approach to the question might be interpreting the game this way:

• you name one card;
• you shuffle your 40 cards deck;
• you win if the card you named is the last in the deck (or the first, equivalently).

From this perspective it is clear that the probability you are going to win is the probability for that certain card to occupy a certain position, which is clearly 1/40 = 0.025.

So, to answer my question, you are going to lose with p = 0.975.

• Not to be negative or critical, but I think that to most people, this explanation is obvious only when you have seen the calculations and reasoning in my answer, but might seem bewildering to many if they see only this answer. I agree that the game is equivalent to hoping that a specific card is the last in the deck, but personally, I didn't realize that until after I had done the calculations and the over-ambitious simulation presented in my answer. :) – JonB Sep 2 '15 at 21:11
• @Jonas I agree and that's why I'm going to let yours be the accepted answer. Thank you again. – natario Sep 2 '15 at 21:28
• I suppose you can quit playing the game now or start placing favorable bets.. hehe. – JonB Sep 2 '15 at 21:29
• It has never been very fun actually ;-) and now that I know it is equivalent to shuffling... – natario Sep 2 '15 at 21:32