Mr. Markov either wins or loses at a card table. His result on a given day is related to his result the day before.
If he loses today, there is a 50% chance he would lose tomorrow.
If he wins today, there is a 30% chance that he would lose tomorrow.
How often would he lose on two consecutive days? Assume an infinite horizon so the first day result is irrelevant.
(Note: Losing three days in a row counts as losing on two consecutive days twice)
First find the probability of a loss; that is, the fraction of the trials (days) that result in a loss:
Let x be that probability (of a loss, not necessarily consecutive).
So, based on the conditional probabilities:
x = .3(1 - x) + .5(x)
Solving this gives x = 3/8.
But each loss is followed by another trial, and in such a trial, 1/2 the time there will be another loss, so this happens 3/16 of the overall trials. (Successes, of course, do not lead to the next day's possibility of being the second day of a two-day loss pair.) So overall, 3/8 of the time there is a loss, and in 1/2 of those times, another loss follows--3/16 of the days are loss days that follow after at least one other loss day.
Therefore 3/16 is the answer.
trials = trials + 1
r = RND(1)
IF prevLoss THEN
IF r < .5 THEN loss = 1: ELSE loss = 0
IF loss THEN dblLoss = dblLoss + 1
IF r < .3 THEN loss = 1: ELSE loss = 0
prevLoss = loss
IF loss THEN losses = losses + 1
PRINT losses, dblLoss, trials, dblLoss / trials
results, as the last line, when stopped, in:
losses cons losses trials prob
161143 80562 428453 .1880299589453219
Posted by Charlie
on 2010-06-26 14:58:43