Imagine I offer two kinds of games to you; let's call them Game A and Game B respectively.
In Game A, you bet that a coin I'm going to toss turns up heads; the payout is even (you gain if you win but you lose if you lose). But I don't play fair; the probability that the coin will come up heads is just . Clearly this is a losing game, no? You won't want to play this game.
In Game B, you bet that a coin I'm going to toss turns up heads; the payout is even (you gain if you win but you lose if you lose). Unlike the above, I now have two coins! One coin was that unfair one above, turning up heads with probability , but another one is unfair to your favor, turning up heads with probability . So how do I select which coin to use? I will look on the previous game you played; if you won that, I'll use the bad coin (probability of heads ), but if you lost that, I'll be generous and use the good coin (probability of heads ). For ease of discussion, suppose that in the first game you get the good coin; turns out this doesn't matter.
Let's analyze Game B. Suppose in the long run, the probability of winning Game B is , and the probability of losing it is . Then we get the following system:
The first equation is simply "P(win this game) = P(won last game) x P(bad coin gives heads) + P(lost last game) x P(good coin gives heads)", and the second equation is similar but with losing chances instead. The third equation follows from the total probability; either you win or lose this game, so the sum of the probabilities is . When we solve the system, we obtain that . Thus on average you will only win of but lose of games. Since the payout for a win is equal to the cost of a loss, in the long run you will lose every games, so this is a losing game.
But what happens when you play Game A and Game B alternately, in the sequence ?
Observe that all Game B results only depend on Game A, so we might as well create a new game called Game C which plays one Game A followed by one Game B, and our sequence becomes . Let's analyze Game C.
There are essentially four outcomes in Game C:
Computing the expected gain from Game C, we obtain . We have a positive expected value! And since every instance of Game C is independent, playing Game C repeatedly will simply magnify the expected gain. Thus the sequence is winning! But this is the sequence , made up of two losing games! How can we obtain a game that is winning from two losing games?
This is also known as Parrondo's paradox. By playing two losing games in some sequence, you might be able to make it into a winning game!
Note that the two games must be dependent in some way. In the above, Game B depends on the result of the previous game, and this is the trick: we make sure that Game B depends on Game A instead of another Game B. We computed that Game B is losing, but only if the previous game is another Game B; if it's Game A (or some other game, like a "you always lose" game), then Game B is winning. You can prove that if the games are independent, then playing them in any sequence will eventually lose.