WEBVTT

00:00:00.499 --> 00:00:02.830
The following content is
provided under a Creative

00:00:02.830 --> 00:00:04.340
Commons license.

00:00:04.340 --> 00:00:06.680
Your support will help
MIT OpenCourseWare

00:00:06.680 --> 00:00:11.050
continue to offer high-quality
educational resources for free.

00:00:11.050 --> 00:00:13.660
To make a donation, or
view additional materials

00:00:13.660 --> 00:00:17.547
from hundreds of MIT courses,
visit MIT OpenCourseWare

00:00:17.547 --> 00:00:18.172
at ocw.mit.edu.

00:00:22.895 --> 00:00:24.270
PROFESSOR: Now
today, we're going

00:00:24.270 --> 00:00:26.740
to talk about random walks.

00:00:26.740 --> 00:00:29.940
And in particular, we're going
to look at a classic phenomenon

00:00:29.940 --> 00:00:32.750
known as Gamblers Ruin.

00:00:32.750 --> 00:00:34.760
It's a great way
to end the term,

00:00:34.760 --> 00:00:38.050
because the solution requires
several of the techniques

00:00:38.050 --> 00:00:40.740
that we've developed
since the midterm.

00:00:40.740 --> 00:00:42.500
So it's actually a good review.

00:00:42.500 --> 00:00:43.730
We'll review recurrences.

00:00:43.730 --> 00:00:46.120
We'll review a lot
of probability laws.

00:00:46.120 --> 00:00:49.050
And it's actually a
nice problem to look at.

00:00:49.050 --> 00:00:52.090
It's another example where you
get a non-intuitive solution

00:00:52.090 --> 00:00:53.740
using probability.

00:00:53.740 --> 00:00:56.560
And if you like to
gamble, it's really good

00:00:56.560 --> 00:00:59.330
that you look at this problem
before you go to Vegas or down

00:00:59.330 --> 00:01:01.050
to Foxwoods.

00:01:01.050 --> 00:01:07.165
Now the Gambler's Ruin problem,
you start with n dollars.

00:01:19.330 --> 00:01:22.390
And we're going to do a
simplified version, where

00:01:22.390 --> 00:01:27.080
in each bet, you win
$1 or you lose $1.

00:01:27.080 --> 00:01:29.680
Now, these days, there are not
many bets in a casino for $1.

00:01:29.680 --> 00:01:31.150
It's more like $10.

00:01:31.150 --> 00:01:34.250
But just to make it
simple for counting,

00:01:34.250 --> 00:01:37.980
we're going to
assume that each bet

00:01:37.980 --> 00:01:46.720
you win $1 with
probability p, and you lose

00:01:46.720 --> 00:01:53.900
$1 with probability 1 minus p.

00:01:53.900 --> 00:01:57.120
And in this version,
we're going to assume

00:01:57.120 --> 00:02:00.610
you keep playing until
one of two things

00:02:00.610 --> 00:02:04.380
happens-- you get
ahead by m dollars,

00:02:04.380 --> 00:02:10.530
or you lose all the money you
came with-- all n dollars.

00:02:10.530 --> 00:02:19.850
So you play until you
win m more-- net m plus--

00:02:19.850 --> 00:02:23.780
or you lose n.

00:02:23.780 --> 00:02:25.030
And that's where you go broke.

00:02:25.030 --> 00:02:25.904
You run out of money.

00:02:28.335 --> 00:02:30.460
And we're going to assume
you don't borrow anything

00:02:30.460 --> 00:02:31.085
from the house.

00:02:33.750 --> 00:02:36.610
All right, and we're going
to look at the probability

00:02:36.610 --> 00:02:39.870
that you come out a winner
versus going home broke--

00:02:39.870 --> 00:02:42.690
that you made m dollars.

00:02:42.690 --> 00:02:46.510
Now, the game we're going
to analyze is roulette,

00:02:46.510 --> 00:02:48.330
but the technique
works for any of them.

00:02:54.160 --> 00:02:55.710
How many people
have played roulette

00:02:55.710 --> 00:02:57.850
before in some form or another?

00:02:57.850 --> 00:03:00.200
OK, so this is a
game where there's

00:03:00.200 --> 00:03:03.310
the ball that goes around the
dish, and you spin the wheel.

00:03:03.310 --> 00:03:07.170
And there's 36
numbers from 1 to 36.

00:03:07.170 --> 00:03:09.260
Half of them are
red, half are black.

00:03:09.260 --> 00:03:12.727
And then there's the zero and
the double zero that are green.

00:03:12.727 --> 00:03:14.310
And we're going to
look at the version

00:03:14.310 --> 00:03:17.000
where you just bet
on red or black.

00:03:17.000 --> 00:03:19.710
And you win if the ball
lands on a slot that's red.

00:03:19.710 --> 00:03:21.330
And there's 18 of those.

00:03:21.330 --> 00:03:23.690
And you lose otherwise.

00:03:23.690 --> 00:03:28.530
So in this case, the
probability of winning, p,

00:03:28.530 --> 00:03:31.520
is there's 18 chances to win.

00:03:31.520 --> 00:03:33.760
And it's not 36 total.

00:03:33.760 --> 00:03:38.200
It's 38 total because of the
zero and the double zero.

00:03:38.200 --> 00:03:42.680
All right so this is
9/19 chance of winning

00:03:42.680 --> 00:03:45.960
and a 10/19 chance of losing.

00:03:45.960 --> 00:03:51.400
And so this is a game that has a
chance of winning of about 47%,

00:03:51.400 --> 00:03:53.370
so it's almost a fair game.

00:03:53.370 --> 00:03:54.869
It's not 50-50.

00:03:54.869 --> 00:03:57.160
And that's because the casino's
got to make some money.

00:03:57.160 --> 00:03:59.400
I mean, they have
the big facility.

00:03:59.400 --> 00:04:02.010
They're giving you free
drinks, and all the rest.

00:04:02.010 --> 00:04:03.880
So they got to
make money somehow.

00:04:03.880 --> 00:04:07.440
And they make money on
this bet because they're

00:04:07.440 --> 00:04:12.430
going to make $0.03
on the dollar here.

00:04:12.430 --> 00:04:13.780
You're going to wager.

00:04:13.780 --> 00:04:18.230
And then you're going
to come back with 47%.

00:04:18.230 --> 00:04:20.339
And people generally
are fine with that.

00:04:20.339 --> 00:04:22.900
They don't expect to have
the odds in their favor

00:04:22.900 --> 00:04:26.010
when you're gambling
in a casino.

00:04:26.010 --> 00:04:30.180
Now, in an effort to sort
of come home a winner,

00:04:30.180 --> 00:04:32.780
the way people do that--
knowing that the odds are

00:04:32.780 --> 00:04:35.980
a little against
them-- is they might

00:04:35.980 --> 00:04:38.580
put more money in
their pocket coming in

00:04:38.580 --> 00:04:40.050
than they expect to win.

00:04:40.050 --> 00:04:43.760
So often, you'll see
people come into the casino

00:04:43.760 --> 00:04:48.829
with the goal of winning 100,
but they start with 1,000

00:04:48.829 --> 00:04:49.495
in their pocket.

00:04:52.730 --> 00:04:55.440
So they're willing
to risk $1,000,

00:04:55.440 --> 00:04:59.790
but they're going to quit
happy if they get up 100.

00:04:59.790 --> 00:05:03.450
OK so you either go
home with $1,100,

00:05:03.450 --> 00:05:05.550
or you're going home
with $0, in this case.

00:05:05.550 --> 00:05:07.760
And you came with $1,000.

00:05:07.760 --> 00:05:10.300
And this means that you're--
at least the thinking goes--

00:05:10.300 --> 00:05:13.890
this means you're more
likely to go home happy.

00:05:13.890 --> 00:05:16.110
If you quit when
you get up by 100,

00:05:16.110 --> 00:05:17.580
you're more likely
to land there,

00:05:17.580 --> 00:05:21.650
because it's almost a fair game,
than you are to lose all 1,000.

00:05:21.650 --> 00:05:23.570
That's the thinking anyway.

00:05:23.570 --> 00:05:27.090
In fact, my mother-in-law
plays roulette, red and black,

00:05:27.090 --> 00:05:30.040
and she follows the strategy.

00:05:30.040 --> 00:05:32.570
And she claims that she
does this for that reason--

00:05:32.570 --> 00:05:35.510
that she almost always wins.

00:05:35.510 --> 00:05:37.820
She goes home happy
almost always.

00:05:37.820 --> 00:05:40.290
And that's the
important thing here.

00:05:40.290 --> 00:05:42.500
And it does reasonable,
because after all, roulette

00:05:42.500 --> 00:05:45.980
is almost a fair game.

00:05:45.980 --> 00:05:47.470
So what do you think?

00:05:47.470 --> 00:05:49.100
How many people
think she's right

00:05:49.100 --> 00:05:52.650
that she almost always wins?

00:05:52.650 --> 00:05:53.700
Anybody?

00:05:53.700 --> 00:05:54.900
I have sort of set it up.

00:05:54.900 --> 00:05:56.775
It's my mother-in-law,
after all,

00:05:56.775 --> 00:05:58.380
so probably she's
going to be wrong.

00:06:01.740 --> 00:06:06.480
Well, how many people think
it's better than a 50% chance

00:06:06.480 --> 00:06:11.610
you win $100 before
you lose $1,000?

00:06:11.610 --> 00:06:15.030
That's probably
more-- how many people

00:06:15.030 --> 00:06:19.350
think you're more likely to
lose $1,000 before you win $100?

00:06:19.350 --> 00:06:21.960
Wow, OK, so you've been
to 6.04 too long now.

00:06:21.960 --> 00:06:24.420
OK, what about this-- how
many people think you're

00:06:24.420 --> 00:06:30.505
more likely to lose
$10,000 than to win $100?

00:06:30.505 --> 00:06:32.130
All right, how many
people think you're

00:06:32.130 --> 00:06:33.500
more likely to lose $1 million?

00:06:36.697 --> 00:06:38.030
A bunch of you still think that.

00:06:38.030 --> 00:06:40.370
OK, well, you're right.

00:06:40.370 --> 00:06:45.830
In fact, it is almost
certain you will go broke,

00:06:45.830 --> 00:06:51.730
no matter how much money you
bring, before you win $100.

00:06:51.730 --> 00:06:55.290
In fact, we're
going to prove today

00:06:55.290 --> 00:07:02.080
that the probability that
you win $100 before losing

00:07:02.080 --> 00:07:04.870
$100 million if you
stayed long enough-- that

00:07:04.870 --> 00:07:09.930
takes a while-- the chance you
go home a winner is less than 1

00:07:09.930 --> 00:07:14.470
in 37,648.

00:07:14.470 --> 00:07:18.326
You have no chance
to go home happy.

00:07:18.326 --> 00:07:20.950
So my mother-in-law's telling me
the story about how she always

00:07:20.950 --> 00:07:21.740
goes home happy.

00:07:21.740 --> 00:07:24.960
And I'm saying, no, no,
wait a minute, you can't.

00:07:24.960 --> 00:07:26.230
You never went home happy.

00:07:26.230 --> 00:07:28.040
Let's be honest.

00:07:28.040 --> 00:07:29.057
It can't be.

00:07:29.057 --> 00:07:30.390
She goes, no, no, no, it's true.

00:07:30.390 --> 00:07:32.905
I go, no, look, there's
a mathematical proof.

00:07:32.905 --> 00:07:33.530
I have a proof.

00:07:33.530 --> 00:07:38.140
I can show you my proof-- very
unlikely you go home a winner.

00:07:38.140 --> 00:07:40.150
So somehow, she's
not very impressed

00:07:40.150 --> 00:07:42.300
with the mathematical proof.

00:07:42.300 --> 00:07:43.320
And she keeps insisting.

00:07:43.320 --> 00:07:45.400
And I keep trying to
show her the proof.

00:07:45.400 --> 00:07:48.170
And anyway, I hope I'll have
more luck with you guys today

00:07:48.170 --> 00:07:51.520
in showing you the proof that
the chance you go home happy

00:07:51.520 --> 00:07:54.600
here is very, very small.

00:07:54.600 --> 00:07:56.240
Now, in the end, I
didn't convince her,

00:07:56.240 --> 00:07:59.680
but we'll see how
we do here today.

00:07:59.680 --> 00:08:02.940
Now, in order to see why this
probability is so stunningly

00:08:02.940 --> 00:08:06.690
small-- you would just
never guess it's that low--

00:08:06.690 --> 00:08:09.510
we've got to learn
about random walks.

00:08:09.510 --> 00:08:12.010
And they come up in all
sorts of applications.

00:08:12.010 --> 00:08:16.330
In fact, page rank--
that got Google started--

00:08:16.330 --> 00:08:19.390
it's all based on a random
walk through the Web

00:08:19.390 --> 00:08:24.600
or through the links on
web pages on that graph.

00:08:24.600 --> 00:08:26.380
Now, for the gambling
problem, we're

00:08:26.380 --> 00:08:28.180
going to look at a
very special case--

00:08:28.180 --> 00:08:30.210
probably the simplest
case of a random walk--

00:08:30.210 --> 00:08:33.390
and that's a
one-dimensional random walk.

00:08:33.390 --> 00:08:35.049
In a one-dimensional
random walk,

00:08:35.049 --> 00:08:37.809
there's some value-- say
the number of dollars

00:08:37.809 --> 00:08:40.240
you've got in your pocket.

00:08:40.240 --> 00:08:43.309
And this value can
go up, or go down,

00:08:43.309 --> 00:08:47.310
or stay the same each time you
do something like make a bet.

00:08:47.310 --> 00:08:51.760
And each of this happens
with a certain probability.

00:08:51.760 --> 00:08:55.360
Now in this case, you
either go up by one,

00:08:55.360 --> 00:08:58.010
or you go down by one, and
you can't stay the same.

00:08:58.010 --> 00:09:00.100
Every bet you win
$1 or you lose $1.

00:09:00.100 --> 00:09:02.490
So it's really a special case.

00:09:02.490 --> 00:09:05.700
And we can diagram
it as follows.

00:09:05.700 --> 00:09:09.700
We can put time, or the
number of bets, on this axis.

00:09:12.900 --> 00:09:16.365
And we can put the number
of dollars on this axis.

00:09:20.120 --> 00:09:25.010
Now in this case, we
start with n dollars.

00:09:25.010 --> 00:09:28.990
And we might win the first
bet, so we go to n plus 1.

00:09:28.990 --> 00:09:35.240
We might lose a bet, might lose
again, could win the next one,

00:09:35.240 --> 00:09:39.770
lose, win, lose, lose.

00:09:39.770 --> 00:09:45.210
So this corresponds to a
string-- win, lose, lose, lose,

00:09:45.210 --> 00:09:53.290
lose, win, lose, win,
lose, lose, lose.

00:09:53.290 --> 00:09:57.180
And when we win, we go up $1.

00:09:57.180 --> 00:10:01.260
When we lose, we go down $1.

00:10:01.260 --> 00:10:03.260
And it's called
one-dimensional, because there's

00:10:03.260 --> 00:10:05.050
just one thing that's changing.

00:10:05.050 --> 00:10:07.510
You're going up and down there.

00:10:07.510 --> 00:10:11.420
Now, the probability
of going up is p.

00:10:11.420 --> 00:10:13.990
And that's no matter
what happened before.

00:10:13.990 --> 00:10:17.380
It's a memoryless
independent system.

00:10:17.380 --> 00:10:20.950
The probability you win your
i-th bet has nothing to do--

00:10:20.950 --> 00:10:23.380
is totally independent,
mutually independent-- of all

00:10:23.380 --> 00:10:26.900
the other bets that
took place before.

00:10:26.900 --> 00:10:28.770
So let's write that down.

00:10:32.410 --> 00:10:40.040
So the probability
of an up move is p.

00:10:40.040 --> 00:10:46.210
The probability of a
down move is 1 minus p.

00:10:46.210 --> 00:10:52.720
And these are mutually
independent of past moves.

00:10:56.840 --> 00:10:59.080
Now, when you have
a random walk where

00:10:59.080 --> 00:11:01.060
the moves are
mutually independent,

00:11:01.060 --> 00:11:02.739
it has a special name.

00:11:02.739 --> 00:11:03.780
It's called a martingale.

00:11:10.120 --> 00:11:12.070
All random walks
don't have to have

00:11:12.070 --> 00:11:13.539
mutually independent steps.

00:11:13.539 --> 00:11:15.330
Say you're looking
about winning and losing

00:11:15.330 --> 00:11:17.422
a baseball game in a series.

00:11:17.422 --> 00:11:19.630
We looked at a scenario
where, if you lost yesterday,

00:11:19.630 --> 00:11:22.310
you're feeling lousy,
more likely to lose today.

00:11:22.310 --> 00:11:24.140
Not true in the
gambling case here.

00:11:24.140 --> 00:11:25.261
It's mutually independent.

00:11:25.261 --> 00:11:26.760
And that's the only
case we're going

00:11:26.760 --> 00:11:29.290
to study for random walks.

00:11:29.290 --> 00:11:36.585
Now, if p is not 1/2, the random
walk is said to be biased.

00:11:43.720 --> 00:11:45.430
And that's what
happens in the casino.

00:11:45.430 --> 00:11:49.040
It's biased in
favor of the house.

00:11:49.040 --> 00:11:53.460
If p equals 1/2, then the
random walk is unbiased.

00:12:00.440 --> 00:12:03.360
Now, in this particular
case that we're looking at,

00:12:03.360 --> 00:12:07.070
we have boundaries
on the random walk.

00:12:07.070 --> 00:12:10.000
There's a boundary
at 0, because you

00:12:10.000 --> 00:12:12.220
go home broke if
you lost everything.

00:12:12.220 --> 00:12:15.770
If the random walk ever
hit $0, you're done.

00:12:15.770 --> 00:12:23.100
And we're also going to
put a boundary at n plus m.

00:12:26.220 --> 00:12:30.690
So I'm going to have
a boundary here.

00:12:30.690 --> 00:12:37.180
So that if I win m dollars here,
I stop and I go home happy.

00:12:37.180 --> 00:12:41.790
If the random walk ever
goes here, then I stop.

00:12:41.790 --> 00:12:45.970
Those are called boundary
conditions for the walk.

00:12:45.970 --> 00:12:49.800
And what we want to do is
analyze the probability

00:12:49.800 --> 00:12:52.940
that we hit that top
boundary before we

00:12:52.940 --> 00:12:55.630
hit the bottom boundary.

00:12:55.630 --> 00:12:58.000
So we're going to define
that event to be W star.

00:13:00.580 --> 00:13:10.410
W star is the event that the
random walk hits T, which

00:13:10.410 --> 00:13:17.680
is n plus m, before it hits 0.

00:13:21.240 --> 00:13:26.080
In other words, you go home
happy without going broke.

00:13:26.080 --> 00:13:32.020
Let's also define D to be the
number of dollars at the start.

00:13:32.020 --> 00:13:34.930
And this is just going
to be n in our case.

00:13:40.960 --> 00:13:48.300
We're interested in, call it
X sub n is the probability

00:13:48.300 --> 00:13:53.750
that we go home happy given
we started with n dollars.

00:13:56.330 --> 00:13:57.740
And that's a function of n.

00:13:57.740 --> 00:14:00.650
So we'll make a
variable called X n.

00:14:00.650 --> 00:14:02.710
And we want to know what
that probability is.

00:14:02.710 --> 00:14:04.293
And of course, the
more you come with,

00:14:04.293 --> 00:14:07.775
you'd think it's a
higher chance of winning

00:14:07.775 --> 00:14:09.150
the more you have
in your pocket,

00:14:09.150 --> 00:14:11.250
because you can play for more.

00:14:11.250 --> 00:14:14.570
So the goal is to
figure this out.

00:14:14.570 --> 00:14:18.050
Now to do this, we could
use the tree method.

00:14:18.050 --> 00:14:22.110
But it gets pretty complicated,
because the sample space

00:14:22.110 --> 00:14:26.390
is the sample space of
all one-loss sequences.

00:14:26.390 --> 00:14:28.130
And how big is
that sample space?

00:14:32.106 --> 00:14:33.100
AUDIENCE: Infinite.

00:14:33.100 --> 00:14:35.050
PROFESSOR: Infinite.

00:14:35.050 --> 00:14:36.977
I could play forever.

00:14:36.977 --> 00:14:39.560
All right, now it turns out the
probability of playing forever

00:14:39.560 --> 00:14:40.080
is 0.

00:14:40.080 --> 00:14:43.350
And we won't prove that, but
there are an infinite number

00:14:43.350 --> 00:14:44.150
of sample points.

00:14:44.150 --> 00:14:46.150
So doing the tree method
is a little complicated

00:14:46.150 --> 00:14:49.060
when it's infinite.

00:14:49.060 --> 00:14:52.280
So what we're going
to do is use some

00:14:52.280 --> 00:14:54.950
of the theorems we've proved
over the last few weeks

00:14:54.950 --> 00:14:57.835
and set up a recurrence
to find this probability.

00:15:01.100 --> 00:15:04.640
Now, I'm going to tell you
what the recurrence is,

00:15:04.640 --> 00:15:09.730
and then prove
that that's right.

00:15:09.730 --> 00:15:17.580
So I claim that X
n is 0 probability

00:15:17.580 --> 00:15:21.320
if we start with $0.

00:15:21.320 --> 00:15:25.730
It's 1 if we start
with T dollars.

00:15:25.730 --> 00:15:36.580
And it's p times X n minus
1 plus 1 minus p X n plus 1

00:15:36.580 --> 00:15:43.100
if we start with between
$0 and T dollars.

00:15:47.110 --> 00:15:49.450
All right, so that's
what I claim X n is.

00:15:49.450 --> 00:15:51.960
And it's, of course, a
recursion that I've set up here.

00:15:51.960 --> 00:15:53.650
So let's see why
that's the case.

00:15:58.230 --> 00:16:00.930
OK, so let's check the 0 case.

00:16:00.930 --> 00:16:07.530
X 0 is the probability
we go home a winner given

00:16:07.530 --> 00:16:09.210
we started with $0.

00:16:12.510 --> 00:16:13.475
Why is that 0?

00:16:16.974 --> 00:16:17.890
AUDIENCE: [INAUDIBLE].

00:16:17.890 --> 00:16:19.386
PROFESSOR: What's that?

00:16:19.386 --> 00:16:21.180
AUDIENCE: [INAUDIBLE].

00:16:21.180 --> 00:16:23.280
PROFESSOR: Yeah,
you started broke.

00:16:23.280 --> 00:16:25.520
You never get off the
ground, because you

00:16:25.520 --> 00:16:27.730
quit as soon as you have $0.

00:16:27.730 --> 00:16:35.020
So you have no chance to win,
because you're broke to start.

00:16:35.020 --> 00:16:41.670
Let's check the next case,
X T-- case n equals T--

00:16:41.670 --> 00:16:45.570
is the probability you
go home a winner given

00:16:45.570 --> 00:16:49.310
you started with T dollars.

00:16:49.310 --> 00:16:51.750
Why is that 1?

00:16:51.750 --> 00:16:55.147
Why is that certain, sort
of from the definition?

00:16:55.147 --> 00:16:56.580
AUDIENCE: [INAUDIBLE].

00:16:56.580 --> 00:16:58.230
PROFESSOR: You already
have your money.

00:16:58.230 --> 00:16:59.560
You already hit
the top boundary,

00:16:59.560 --> 00:17:00.643
because you started there.

00:17:00.643 --> 00:17:02.440
Remember, you quit
and you're happy.

00:17:02.440 --> 00:17:05.900
Go home happy if
you hit T dollars.

00:17:05.900 --> 00:17:08.697
All right, so you're
guaranteed to go home happy,

00:17:08.697 --> 00:17:10.030
because you never make any bets.

00:17:10.030 --> 00:17:13.530
You started with all the money
you needed to go home happy.

00:17:13.530 --> 00:17:18.490
Then we have the
interesting case,

00:17:18.490 --> 00:17:20.849
where you start with
between 0 and T dollars.

00:17:20.849 --> 00:17:23.990
And now you're going
to make some bets.

00:17:23.990 --> 00:17:26.310
And then X n is the
probability-- just

00:17:26.310 --> 00:17:30.590
the definition-- of going
home happy-- i.e. winning

00:17:30.590 --> 00:17:34.680
and having T dollars,
if you start with n.

00:17:34.680 --> 00:17:38.710
Now, there's two cases to
analyze this, based on what

00:17:38.710 --> 00:17:40.380
happens in the first bet.

00:17:40.380 --> 00:17:43.600
You could win it, or
you could lose it.

00:17:43.600 --> 00:17:46.240
And then we're going to recurse.

00:17:46.240 --> 00:17:54.840
So we're going to define
E to be the event that you

00:17:54.840 --> 00:17:57.340
win the first bet.

00:18:00.570 --> 00:18:07.520
And E bar is the event that
you lose the first bet.

00:18:12.080 --> 00:18:14.340
Now, by the theory of
total probability, which

00:18:14.340 --> 00:18:18.120
we did in recitation
maybe a couple weeks ago,

00:18:18.120 --> 00:18:21.970
we can rewrite this depending
on whether E happened

00:18:21.970 --> 00:18:25.080
or the complement of E happened.

00:18:25.080 --> 00:18:28.370
And you get that the
probability is simply

00:18:28.370 --> 00:18:31.990
the probability of
going home happy

00:18:31.990 --> 00:18:34.844
and winning the
first bet times--

00:18:34.844 --> 00:18:36.510
and I've got to put
the conditioning in.

00:18:36.510 --> 00:18:37.580
That doesn't go away.

00:18:44.080 --> 00:18:45.510
So I'm breaking into two cases.

00:18:45.510 --> 00:18:51.350
The first one is you win the
first bet given D equals n,

00:18:51.350 --> 00:18:59.470
And the case where you lose the
first bet, given D equals n.

00:19:02.070 --> 00:19:04.601
Any questions here?

00:19:04.601 --> 00:19:06.530
The probability of
going home happy

00:19:06.530 --> 00:19:09.660
given you start with n
dollars is the probability

00:19:09.660 --> 00:19:17.050
of going home happy and winning
the first bet given D equals

00:19:17.050 --> 00:19:19.465
n plus the probability
of going home happy

00:19:19.465 --> 00:19:22.800
and losing the first
bet given D equals n--

00:19:22.800 --> 00:19:25.630
just those are the two cases.

00:19:25.630 --> 00:19:29.290
Now I can use the definition
of conditional probability

00:19:29.290 --> 00:19:31.256
to rewrite these.

00:19:31.256 --> 00:19:34.350
This is the probability--
you've got two events--

00:19:34.350 --> 00:19:39.520
that the first one
happens given D equals n

00:19:39.520 --> 00:19:43.440
times the probability
the second one happens

00:19:43.440 --> 00:19:49.180
given that the first one
happened and D equals n.

00:19:49.180 --> 00:19:51.560
This is just the definition
of conditional probability,

00:19:51.560 --> 00:19:54.180
when I've got an
intersection of events here.

00:19:54.180 --> 00:19:55.870
The probability
of both happening

00:19:55.870 --> 00:19:57.760
is the probability of
the first happening

00:19:57.760 --> 00:19:59.884
times the probability of
the second happening given

00:19:59.884 --> 00:20:00.960
that the first happened.

00:20:00.960 --> 00:20:05.570
And of course, everything is
in this universe of D equals n.

00:20:05.570 --> 00:20:07.670
So I've used it in a
little different twist

00:20:07.670 --> 00:20:09.490
than we had it before.

00:20:09.490 --> 00:20:11.240
The same thing over
here-- this now

00:20:11.240 --> 00:20:17.140
is the probability of E
prime given D equals n

00:20:17.140 --> 00:20:20.390
times the probability of
W star-- winning, going

00:20:20.390 --> 00:20:29.420
home happy-- given that you lost
the first bet and D equals n.

00:20:29.420 --> 00:20:32.370
That's D equals n there.

00:20:32.370 --> 00:20:34.540
So it looks like it's
got more complicated,

00:20:34.540 --> 00:20:36.005
but now we can
start simplifying.

00:20:38.650 --> 00:20:40.610
What's the
probability of winning

00:20:40.610 --> 00:20:44.022
the first bet given that
you started with n dollars?

00:20:44.022 --> 00:20:45.390
AUDIENCE: p.

00:20:45.390 --> 00:20:47.565
PROFESSOR: p-- in
fact, does this

00:20:47.565 --> 00:20:49.690
have anything to do with
the probability of winning

00:20:49.690 --> 00:20:51.730
the first bet?

00:20:51.730 --> 00:20:53.870
No, this is just p.

00:20:59.610 --> 00:21:03.290
Now, what about this thing?

00:21:03.290 --> 00:21:13.620
I am conditioning on
winning the first bet given

00:21:13.620 --> 00:21:15.355
and I start with n dollars.

00:21:19.750 --> 00:21:22.930
What's another way of
expressing I won the first bet

00:21:22.930 --> 00:21:25.310
and I started with n dollars?

00:21:25.310 --> 00:21:26.087
Yeah?

00:21:26.087 --> 00:21:27.520
AUDIENCE: You have n plus $1.

00:21:27.520 --> 00:21:31.860
PROFESSOR: I now have n
plus $1 going forward.

00:21:31.860 --> 00:21:34.900
And because I have a
martingale, and everything

00:21:34.900 --> 00:21:37.340
is mutually independent,
it's like the world

00:21:37.340 --> 00:21:38.700
starts all over again.

00:21:38.700 --> 00:21:41.440
I'm now in a state
with n plus $1,

00:21:41.440 --> 00:21:44.110
and I want to know
the probability

00:21:44.110 --> 00:21:45.375
that I go home happy.

00:21:45.375 --> 00:21:49.000
It doesn't matter how
I got the n plus $1.

00:21:49.000 --> 00:21:52.000
It's just going forward-- I
got n plus $1 in my pocket,

00:21:52.000 --> 00:21:54.270
I want to know the probability
of going home happy.

00:21:54.270 --> 00:21:57.040
So I reset to D equals n plus 1.

00:21:59.740 --> 00:22:03.892
So I replace this with that,
because however long it

00:22:03.892 --> 00:22:05.850
took me to get there and
all that stuff doesn't

00:22:05.850 --> 00:22:07.660
matter for this analysis.

00:22:07.660 --> 00:22:08.990
It's all mutually dependent.

00:22:13.110 --> 00:22:16.360
Probability of losing the
first bet given that I started

00:22:16.360 --> 00:22:20.490
with n dollars-- 1 minus p.

00:22:20.490 --> 00:22:23.290
Doesn't matter how
much I started with.

00:22:23.290 --> 00:22:29.120
And here, I want to know the
probability of going home happy

00:22:29.120 --> 00:22:31.950
given-- well, if I
lost the first bet

00:22:31.950 --> 00:22:36.080
and I started with
n, what have I got?

00:22:36.080 --> 00:22:37.087
n minus 1.

00:22:40.530 --> 00:22:44.746
It doesn't matter how
I got to n minus 1.

00:22:44.746 --> 00:22:46.370
Now this is going to
get really simple.

00:22:49.250 --> 00:22:52.720
What's another name
for that expression?

00:22:52.720 --> 00:22:53.830
X n plus 1.

00:22:57.560 --> 00:23:00.800
And another name
for this expression?

00:23:00.800 --> 00:23:02.003
X n minus 1.

00:23:05.680 --> 00:23:11.720
So we proved that X n equals
p X n plus 1 plus 1 minus

00:23:11.720 --> 00:23:12.770
p X n minus 1.

00:23:12.770 --> 00:23:15.100
And that's what I
claimed is true.

00:23:15.100 --> 00:23:18.380
So we finished the proof.

00:23:18.380 --> 00:23:20.214
Any questions?

00:23:20.214 --> 00:23:21.130
AUDIENCE: [INAUDIBLE].

00:23:21.130 --> 00:23:22.356
PROFESSOR: Did i screw it up?

00:23:22.356 --> 00:23:23.272
AUDIENCE: [INAUDIBLE].

00:23:23.272 --> 00:23:29.940
PROFESSOR: I claim probability
of winning-- so let's

00:23:29.940 --> 00:23:31.590
see if I have a wrong in here.

00:23:31.590 --> 00:23:32.950
I might have screwed it up.

00:23:32.950 --> 00:23:38.440
I think I proved
it's n plus 1, right?

00:23:38.440 --> 00:23:41.230
Yep, sure enough, I
think this is a plus 1.

00:23:41.230 --> 00:23:43.210
That's a minus 1.

00:23:43.210 --> 00:23:45.692
Now, it's always good to
check to you proved what you

00:23:45.692 --> 00:23:46.900
said you were going to prove.

00:23:46.900 --> 00:23:50.006
So I needed to change this.

00:23:50.006 --> 00:23:50.880
That's what I proved.

00:23:57.290 --> 00:23:58.239
Any other questions?

00:23:58.239 --> 00:23:59.780
That was a pretty
important question.

00:24:02.370 --> 00:24:07.620
All right, so we have
a recurrence for X n.

00:24:07.620 --> 00:24:10.430
Now, it's a little
funny looking at first,

00:24:10.430 --> 00:24:12.430
because normally
with a recurrence,

00:24:12.430 --> 00:24:15.770
X n would depend on X
sub i that are smaller--

00:24:15.770 --> 00:24:18.040
the i's are smaller than n.

00:24:18.040 --> 00:24:20.210
So it looks a little wacky.

00:24:20.210 --> 00:24:21.470
But is that a problem?

00:24:24.320 --> 00:24:26.550
I can just solve
for X n plus 1--

00:24:26.550 --> 00:24:29.550
just subtract this
and put it over there.

00:24:29.550 --> 00:24:30.540
So let's do that.

00:24:47.740 --> 00:24:53.820
OK, so if I solve for X n plus 1
up there, I'll put p X n plus 1

00:24:53.820 --> 00:25:03.210
on its own side, I get p X
n plus 1 minus X n plus 1

00:25:03.210 --> 00:25:08.690
minus p X n minus 1 equals 0.

00:25:08.690 --> 00:25:11.260
And I know that X 0 is 0.

00:25:11.260 --> 00:25:13.445
And I know that X T equals 1.

00:25:17.314 --> 00:25:18.855
Now, what type of
recurrence is this?

00:25:21.860 --> 00:25:22.770
AUDIENCE: Linear.

00:25:22.770 --> 00:25:26.130
PROFESSOR: Linear, good, so
it's a linear recurrence.

00:25:26.130 --> 00:25:28.853
And what type of linear
recurrence is it?

00:25:28.853 --> 00:25:29.800
AUDIENCE: Homogeneous.

00:25:29.800 --> 00:25:33.200
PROFESSOR: Homogeneous-- that's
the best case, simple case,

00:25:33.200 --> 00:25:34.039
that's good.

00:25:34.039 --> 00:25:35.830
The boundary conditions
are a little weird,

00:25:35.830 --> 00:25:38.820
because the recurrences
we all saw before,

00:25:38.820 --> 00:25:40.320
if we had two
boundary conditions it

00:25:40.320 --> 00:25:41.870
would be X0 and X1.

00:25:41.870 --> 00:25:43.260
Here it's X0 and X T.

00:25:43.260 --> 00:25:45.151
But all's you need are two.

00:25:45.151 --> 00:25:46.400
Doesn't matter where they are.

00:25:48.960 --> 00:25:50.220
So how do I solve that thing?

00:25:50.220 --> 00:25:54.070
What's the next thing I do?

00:25:54.070 --> 00:25:55.041
What is it?

00:25:55.041 --> 00:25:56.540
AUDIENCE: Characterize
the equation.

00:25:56.540 --> 00:25:57.560
PROFESSOR: Characterize
the equation.

00:25:57.560 --> 00:25:59.294
And what do you do
it that equation?

00:25:59.294 --> 00:26:00.210
AUDIENCE: [INAUDIBLE].

00:26:00.210 --> 00:26:01.668
PROFESSOR: Solve
it, get the roots.

00:26:01.668 --> 00:26:03.820
This'll be good
practice for the final,

00:26:03.820 --> 00:26:06.797
because you'll probably have
to do something like this.

00:26:06.797 --> 00:26:08.380
So that's the
characteristic equation.

00:26:12.800 --> 00:26:15.940
And what's the order of
this equation-- the degree?

00:26:20.340 --> 00:26:26.730
That's going to be 2, right?

00:26:26.730 --> 00:26:33.600
I'm going to have pr squared
minus r plus 1 minus p is 0.

00:26:33.600 --> 00:26:37.177
That's my
characteristic equation.

00:26:37.177 --> 00:26:37.760
Remember that?

00:26:37.760 --> 00:26:40.640
So I make this be
the constant term.

00:26:40.640 --> 00:26:42.420
Then I have the
first-order term, then

00:26:42.420 --> 00:26:45.210
the second-order term.

00:26:45.210 --> 00:26:48.570
All right, now I solve it.

00:26:48.570 --> 00:26:52.080
And that's easy for a
second-order equation.

00:26:52.080 --> 00:26:59.540
1 plus or minus the square
root of 1 minus 4p 1

00:26:59.540 --> 00:27:03.900
minus p over 2 p.

00:27:07.140 --> 00:27:08.030
Let's do that.

00:27:10.810 --> 00:27:15.380
OK, so this is 1 plus
or minus the square root

00:27:15.380 --> 00:27:20.460
of 1 minus 4p plus
4p squared over 2p.

00:27:28.689 --> 00:27:30.730
Just using the quadratic
formula and simplifying.

00:27:35.780 --> 00:27:38.930
And it works out really
nicely, because that

00:27:38.930 --> 00:27:42.410
is the square root of-- this
is just 1 minus 2p squared.

00:27:48.990 --> 00:27:55.740
So that's 1 plus or
minus 1 minus 2p over 2p.

00:27:55.740 --> 00:28:06.410
And that is 2 minus 2p over
2p or 1 minus 1 cancels,

00:28:06.410 --> 00:28:13.020
then minus 2p is 2p over 2p.

00:28:13.020 --> 00:28:17.590
So the answers, the roots
are divide by 2 on this one.

00:28:17.590 --> 00:28:22.947
I get 1 minus p over p and 1.

00:28:22.947 --> 00:28:23.780
Those are the roots.

00:28:27.582 --> 00:28:28.665
Are these roots different?

00:28:30.960 --> 00:28:32.460
Do I have the case
of a double root?

00:28:32.460 --> 00:28:36.407
Are the roots always different?

00:28:36.407 --> 00:28:37.490
They're usually different.

00:28:37.490 --> 00:28:39.880
What's the case where
these roots are the same?

00:28:39.880 --> 00:28:40.870
AUDIENCE: 0.5.

00:28:40.870 --> 00:28:43.760
PROFESSOR: 0.5, which is
sort of an interesting case

00:28:43.760 --> 00:28:45.990
in this game.

00:28:45.990 --> 00:28:49.110
Because if p equals 1/2, we
have an unbiased random walk.

00:28:49.110 --> 00:28:51.250
You got a fair game.

00:28:51.250 --> 00:28:53.730
And so it says right away,
well, maybe the result

00:28:53.730 --> 00:28:56.807
is going to be different for
a fair game than the game

00:28:56.807 --> 00:28:58.765
we're playing in the
casino, where it's biased.

00:29:01.300 --> 00:29:04.432
So let's look at the casino
game where p is not 1/2.

00:29:04.432 --> 00:29:05.640
Then the roots are different.

00:29:08.280 --> 00:29:10.000
Later, we'll go back
and analyze the case

00:29:10.000 --> 00:29:13.053
when the roots of the
same for the fair game.

00:29:20.310 --> 00:29:30.250
So if p is not 1/2, then
we can solve for X n.

00:29:30.250 --> 00:29:37.960
X n is some constant times the
first root to the nth power

00:29:37.960 --> 00:29:42.180
plus a constant times the
second root to the nth power.

00:29:42.180 --> 00:29:45.515
Remember, that's how it works
for any linear homogeneous

00:29:45.515 --> 00:29:46.015
recurrence.

00:29:49.300 --> 00:29:53.900
And that's easy, because
the second root was 1.

00:29:53.900 --> 00:29:57.200
This is just plus
B. 1 to the n is 1.

00:29:59.960 --> 00:30:03.050
How do I figure out
what A and B are?

00:30:03.050 --> 00:30:04.300
AUDIENCE: Boundary conditions.

00:30:04.300 --> 00:30:07.090
PROFESSOR: Boundary
conditions, very good.

00:30:07.090 --> 00:30:08.855
So let's look at the
boundary conditions.

00:30:30.250 --> 00:30:36.100
OK, so the first boundary
condition is at 0.

00:30:36.100 --> 00:30:40.410
So we have 0 equals X 0.

00:30:40.410 --> 00:30:44.570
Plugging in there-- oops
I forgot the n up here.

00:30:44.570 --> 00:30:48.140
Plugging in n equals 0--
well, this to the 0 is just 1.

00:30:48.140 --> 00:30:57.054
That is A plus B. That
means that B equals minus A.

00:30:57.054 --> 00:30:58.470
Then the second
boundary condition

00:30:58.470 --> 00:31:05.880
is 1 equals X sub T.
And that is A 1 minus

00:31:05.880 --> 00:31:13.442
p over p to the T plus
B, but B was minus A.

00:31:13.442 --> 00:31:16.860
And now I can solve for A.

00:31:16.860 --> 00:31:28.850
So that means that A equals
1 over 1 minus p over p

00:31:28.850 --> 00:31:32.200
to the T minus 1.

00:31:32.200 --> 00:31:38.610
And B is negative A--
minus 1 over 1 minus p,

00:31:38.610 --> 00:31:40.810
over p to the T minus 1.

00:31:43.540 --> 00:31:51.140
And then I plug those back
in to the formula for X n.

00:31:51.140 --> 00:31:54.320
So here's my constant A.
I multiply that times 1

00:31:54.320 --> 00:31:59.020
minus p over p to the
n, plus I add this in.

00:31:59.020 --> 00:32:02.620
So this means that the
probability of going home

00:32:02.620 --> 00:32:10.500
a winner is 1 minus p over p to
the n over that thing-- 1 minus

00:32:10.500 --> 00:32:14.830
p over p to the T
minus 1, plus the B

00:32:14.830 --> 00:32:22.910
term, which really is a minus
term here, is just minus 1.

00:32:22.910 --> 00:32:23.880
Put that on top here.

00:32:26.620 --> 00:32:30.350
That sort of looks
messy, but there's

00:32:30.350 --> 00:32:34.780
a simplification to get an
upper bound that's very close.

00:32:34.780 --> 00:32:38.870
In particular, if you have
a biased game against you--

00:32:38.870 --> 00:32:43.960
so if p is less than 1/2,
as it is in roulette,

00:32:43.960 --> 00:32:47.720
then this is a
number bigger than 1.

00:32:47.720 --> 00:32:53.105
That means that 1 minus p
over p is bigger than 1.

00:32:56.340 --> 00:32:57.990
So this is bigger than 1.

00:32:57.990 --> 00:32:58.990
This is bigger than 1.

00:32:58.990 --> 00:33:01.620
T is the upper limit.

00:33:01.620 --> 00:33:03.410
It's n plus m.

00:33:03.410 --> 00:33:05.970
So I've got a bigger number
down here than I do here.

00:33:05.970 --> 00:33:08.750
So overall, it's a
fraction less than 1.

00:33:08.750 --> 00:33:10.860
And when you have a
fraction less than 1,

00:33:10.860 --> 00:33:14.330
if you add 1 to the
numerator and denominator,

00:33:14.330 --> 00:33:15.480
it gets closer to 1.

00:33:15.480 --> 00:33:17.670
It gets bigger.

00:33:17.670 --> 00:33:23.460
So this is upper-bounded by
just adding 1 to each of these.

00:33:23.460 --> 00:33:28.440
Its upper-bounded by this
over that, which is 1 minus p

00:33:28.440 --> 00:33:36.860
over p to the n minus T.
And T is just n plus m.

00:33:36.860 --> 00:33:40.930
So this equals-- why don't
I turn it upside down?

00:33:40.930 --> 00:33:44.720
Make it p over 1 minus p to get
a fraction that's less than 1.

00:33:44.720 --> 00:33:50.950
T minus n, and that equals
p over 1 minus p to the m.

00:33:54.240 --> 00:33:56.987
And this is how much you're
trying to get ahead-- $100

00:33:56.987 --> 00:33:58.320
in the case of my mother-in-law.

00:34:01.230 --> 00:34:03.894
So what we've
proved-- let me state

00:34:03.894 --> 00:34:05.060
what we proved as a theorem.

00:34:24.929 --> 00:34:31.830
So we proved that if
p is less than 1/2--

00:34:31.830 --> 00:34:33.889
if you're more
likely to lose a bet

00:34:33.889 --> 00:34:40.420
than win it-- then
the probability

00:34:40.420 --> 00:34:51.150
that you win m dollars before
you lose n dollars is at most p

00:34:51.150 --> 00:34:55.510
over 1 minus p to the m.

00:34:55.510 --> 00:34:58.590
That's what we just proved.

00:34:58.590 --> 00:35:00.659
And so now you can plug
in values-- for example,

00:35:00.659 --> 00:35:01.200
for roulette.

00:35:05.260 --> 00:35:11.960
p equals 9/19, which
means that p over 1

00:35:11.960 --> 00:35:19.750
minus p-- that's going
to be 9/19 over 10/19,

00:35:19.750 --> 00:35:21.010
which is just 9/10.

00:35:24.740 --> 00:35:30.010
And if m-- the amount you
want to win-- is $100,

00:35:30.010 --> 00:35:33.165
and n is $1,000-- that's
what you start with

00:35:33.165 --> 00:35:36.420
and you're willing
to lose-- well,

00:35:36.420 --> 00:35:42.640
the probability you win--
you go home happy-- W

00:35:42.640 --> 00:35:50.310
star you win $100-- is
less than or equal to 9/10

00:35:50.310 --> 00:35:53.800
raised to the m, which is 100.

00:35:53.800 --> 00:35:57.610
So it's 9/10 of 100, and that
turns out to be less than 1

00:35:57.610 --> 00:36:06.280
in 37,648, which is where
that answer came from.

00:36:06.280 --> 00:36:07.800
Now you can see why
my mother-in-law

00:36:07.800 --> 00:36:11.640
may have got lost somewhere
here now in the calculations.

00:36:11.640 --> 00:36:13.560
But this is a proof
that the chance

00:36:13.560 --> 00:36:18.850
you win $100 before you lose
$1,000 is very, very small.

00:36:18.850 --> 00:36:22.810
Now, do you see why the answer
is no better than if you came

00:36:22.810 --> 00:36:26.310
with $1 million in your pocket?

00:36:26.310 --> 00:36:30.390
Say you came with n
equals $1 million.

00:36:30.390 --> 00:36:32.390
Why is the answer not changing?

00:36:35.690 --> 00:36:37.020
Yeah.

00:36:37.020 --> 00:36:39.930
AUDIENCE: Once you
lose, say, $1,000,

00:36:39.930 --> 00:36:42.650
you're already in
a really deep hole.

00:36:42.650 --> 00:36:44.130
PROFESSOR: That's the intuition.

00:36:44.130 --> 00:36:44.671
That's right.

00:36:44.671 --> 00:36:46.560
We're going to get
to that in a minute.

00:36:46.560 --> 00:36:49.590
I want to know from
the formula, why

00:36:49.590 --> 00:36:54.280
is it no difference if I come
with $1,000 versus $1 million?

00:36:54.280 --> 00:36:55.051
Yeah.

00:36:55.051 --> 00:36:56.592
AUDIENCE: The formula
doesn't have n.

00:36:56.592 --> 00:37:00.180
PROFESSOR: Yeah, the formula
has nothing to do with n.

00:37:00.180 --> 00:37:04.130
You could come with $100
trillion in your wallet,

00:37:04.130 --> 00:37:06.710
and it doesn't
improve this bound.

00:37:06.710 --> 00:37:10.260
This bound only depends on
what you're trying to win,

00:37:10.260 --> 00:37:11.530
not on how much you came with.

00:37:11.530 --> 00:37:13.890
So no matter how
much you come with,

00:37:13.890 --> 00:37:17.250
the chance you win $100
before you lose everything

00:37:17.250 --> 00:37:20.860
is at most 1 in 37,000.

00:37:20.860 --> 00:37:22.650
Now, we can plug in
some other values

00:37:22.650 --> 00:37:27.081
just for fun--
different values of m.

00:37:32.380 --> 00:37:36.350
If you thought 1 in
37,000 was unlikely,

00:37:36.350 --> 00:37:44.380
the chance of winning
$1,000, or 1,000 bets worth

00:37:44.380 --> 00:37:50.870
before you're broke-- that's
less than 9/10 to the 1,000.

00:37:50.870 --> 00:37:57.090
That's less than 2 times
10 to the minus 46--

00:37:57.090 --> 00:37:59.760
really, really, really unlikely.

00:37:59.760 --> 00:38:06.400
Even winning $10 is not likely.

00:38:06.400 --> 00:38:07.650
Just plug in the numbers.

00:38:07.650 --> 00:38:13.790
The probability you win
$10 betting $1 at a time

00:38:13.790 --> 00:38:18.470
is less than 9/10
to the 10th power.

00:38:18.470 --> 00:38:24.150
That's less than 0.35.

00:38:24.150 --> 00:38:30.710
You can come to the casino with
$10 million, bet $1 at a time,

00:38:30.710 --> 00:38:34.390
and you quit if you just
get up 10 bets-- get up $10.

00:38:34.390 --> 00:38:38.740
The chance you get up $10 before
you lose $10 million is about 1

00:38:38.740 --> 00:38:42.100
in 3 you're twice as
likely to lose $10 million

00:38:42.100 --> 00:38:44.400
as you are to win 10.

00:38:44.400 --> 00:38:46.780
That just seems weird, right?

00:38:46.780 --> 00:38:49.250
Because it's almost a fair game.

00:38:49.250 --> 00:38:51.390
It's almost 50-50.

00:38:51.390 --> 00:38:52.820
Any questions
about the analysis?

00:38:55.860 --> 00:38:59.710
Yes, I find that shocking.

00:38:59.710 --> 00:39:02.580
Just the intuition would
seem say otherwise.

00:39:02.580 --> 00:39:03.990
So I guess there's a moral here.

00:39:03.990 --> 00:39:05.880
If you're going to
gamble, learn how

00:39:05.880 --> 00:39:09.050
to count cards in blackjack,
or some game where

00:39:09.050 --> 00:39:10.722
you can make it even.

00:39:10.722 --> 00:39:12.680
Because even in a game
where it's pretty close,

00:39:12.680 --> 00:39:14.580
you're doomed.

00:39:14.580 --> 00:39:18.710
You're just never
going to go home happy.

00:39:18.710 --> 00:39:21.900
Now, if you could
have a fair game,

00:39:21.900 --> 00:39:24.780
the world changes-- much
better circumstance.

00:39:24.780 --> 00:39:28.800
So actually, let's do the
same analysis for a fair game,

00:39:28.800 --> 00:39:31.680
because that's where our
intuition really comes from.

00:39:31.680 --> 00:39:34.550
Because we're thinking of
this game as almost fair.

00:39:34.550 --> 00:39:38.700
And in a fair game, the answer's
going to be very different.

00:39:38.700 --> 00:39:41.320
And it all goes back to the
recurrence and the roots

00:39:41.320 --> 00:39:43.490
of the characteristic equation.

00:39:43.490 --> 00:39:49.380
Because in a fair
game, p is 1/2.

00:39:53.490 --> 00:39:56.290
And then you have a double root.

00:39:56.290 --> 00:40:04.970
1 minus 1/2 over 1/2 equals 1,
and that means a double root

00:40:04.970 --> 00:40:07.570
at 1.

00:40:07.570 --> 00:40:10.390
And that changes everything.

00:40:10.390 --> 00:40:16.120
So let's go through now
and do all this analysis

00:40:16.120 --> 00:40:17.440
in the case of a fair game.

00:40:20.140 --> 00:40:22.180
And this will give us
practice with double roots

00:40:22.180 --> 00:40:23.630
and recurrences.

00:40:23.630 --> 00:40:25.939
Because as you see
now, it does happen.

00:40:30.930 --> 00:40:33.866
Let's figure out the chance
that we go home a winner.

00:40:38.490 --> 00:40:40.360
OK, so let's see.

00:40:40.360 --> 00:40:44.766
In this case, we know the roots.

00:40:44.766 --> 00:40:46.580
Can anybody tell me
what formula we're

00:40:46.580 --> 00:40:49.870
going to use for the solution?

00:40:49.870 --> 00:40:52.230
Got a double root at 1.

00:40:52.230 --> 00:40:54.170
So there's going to
be a 1 to the n here.

00:40:56.750 --> 00:40:58.590
I don't just put a
constant A in front.

00:40:58.590 --> 00:41:00.744
What do I do with a double root?

00:41:00.744 --> 00:41:01.660
AUDIENCE: [INAUDIBLE].

00:41:01.660 --> 00:41:02.260
AUDIENCE: A n.

00:41:02.260 --> 00:41:03.430
PROFESSOR: What is it?

00:41:03.430 --> 00:41:04.230
AUDIENCE: A n.

00:41:04.230 --> 00:41:06.560
PROFESSOR: A n-- not quite A n.

00:41:06.560 --> 00:41:08.200
You got an A n here.

00:41:08.200 --> 00:41:09.080
AUDIENCE: Plus B.

00:41:09.080 --> 00:41:13.280
PROFESSOR: Plus B-- that's
what you do for a double root,

00:41:13.280 --> 00:41:17.340
because you make a first
degree polynomial in n here.

00:41:17.340 --> 00:41:18.782
So we plug that in.

00:41:18.782 --> 00:41:20.240
The root's at 1,
so it's real easy.

00:41:20.240 --> 00:41:21.910
The solution's really easy now.

00:41:21.910 --> 00:41:23.340
No messy powers or anything.

00:41:23.340 --> 00:41:28.487
It's just A n plus B. And
I can figure out A and B

00:41:28.487 --> 00:41:29.695
from the boundary conditions.

00:41:36.550 --> 00:41:40.590
All right, X0 is 0.

00:41:40.590 --> 00:41:46.280
X 0 is just B, because
it's A times 0 goes away.

00:41:46.280 --> 00:41:48.120
And that means that B equals 0.

00:41:48.120 --> 00:41:50.960
This is getting really simple.

00:41:50.960 --> 00:41:56.850
1 is X T. And that's
A plus B, but B was 0.

00:41:56.850 --> 00:42:03.620
So that's A times 1
plus B. That's just A.

00:42:03.620 --> 00:42:11.600
It means A equals A n.

00:42:11.600 --> 00:42:13.270
Good, n's not 1.

00:42:13.270 --> 00:42:15.410
N's T. So it's A T plus B.

00:42:15.410 --> 00:42:17.550
This is A T here.

00:42:17.550 --> 00:42:19.280
So A T equals 1.

00:42:19.280 --> 00:42:23.780
That means A is 1 over T.

00:42:23.780 --> 00:42:32.854
All right, that means that
X n is n over T. And T

00:42:32.854 --> 00:42:33.820
is the total.

00:42:33.820 --> 00:42:36.140
The top limit is n plus
m, because you quit

00:42:36.140 --> 00:42:38.090
if you get ahead m dollars.

00:42:38.090 --> 00:42:44.030
This is just now
n over n plus m.

00:42:44.030 --> 00:42:47.880
All right, so let's
write that down.

00:42:47.880 --> 00:42:48.515
It's a theorem.

00:42:53.450 --> 00:42:58.920
If p is 1/2, i.e., you
have a fair game, then

00:42:58.920 --> 00:43:04.580
the probability
you win m dollars

00:43:04.580 --> 00:43:15.270
before you lose n dollars
is just n over n plus m.

00:43:15.270 --> 00:43:17.590
And this might fit
the intuition better.

00:43:20.700 --> 00:43:28.810
So for the mother-in-law
strategy, if m is 100,

00:43:28.810 --> 00:43:34.580
and n is 1,000, what's
the probability you

00:43:34.580 --> 00:43:36.460
win-- you go home a winner?

00:43:42.230 --> 00:43:48.904
Yeah, 1,000 over 1,000 plus 100.

00:43:48.904 --> 00:43:54.490
1,000 over 1,000 is 10 over 11.

00:43:54.490 --> 00:43:57.850
So she does go home happy most
of the time-- 10 out of 11

00:43:57.850 --> 00:44:00.410
nights-- if she's
playing a fair game.

00:44:02.970 --> 00:44:06.920
Any questions about that?

00:44:06.920 --> 00:44:13.630
So the trouble we get into
here is that the fair game

00:44:13.630 --> 00:44:16.890
results match our intuition.

00:44:16.890 --> 00:44:20.520
You know if you have 10 times
as much money in a fair game,

00:44:20.520 --> 00:44:23.660
you'd expect to go home
happy 10 out of 11 nights.

00:44:23.660 --> 00:44:24.790
That makes a lot of sense.

00:44:24.790 --> 00:44:28.660
You go home happy 10, and
then you lose the 11th.

00:44:28.660 --> 00:44:30.790
That's a 10 to 1 ratio,
which is the money

00:44:30.790 --> 00:44:33.001
you brought into the game.

00:44:33.001 --> 00:44:36.160
The trouble we get
into is, the fair game

00:44:36.160 --> 00:44:38.790
is very close to the real game.

00:44:38.790 --> 00:44:42.120
Instead of 50-50, it's 47-53.

00:44:42.120 --> 00:44:44.310
And so our intuition
says the results--

00:44:44.310 --> 00:44:46.780
the probability of going
home happy in a fair game--

00:44:46.780 --> 00:44:49.200
should be close to the
probability of going

00:44:49.200 --> 00:44:51.180
home happy in the real game.

00:44:51.180 --> 00:44:52.340
And that's not true.

00:44:52.340 --> 00:44:55.990
There's a discontinuity here
because of the double root.

00:44:55.990 --> 00:44:58.350
And the character
completely changes.

00:44:58.350 --> 00:45:01.380
So instead of being
close to 10 out of 11,

00:45:01.380 --> 00:45:04.140
you're down there
at 1 in 37,000--

00:45:04.140 --> 00:45:07.640
completely different behavior.

00:45:07.640 --> 00:45:12.580
OK, any questions?

00:45:12.580 --> 00:45:14.398
All right, so let me
give you an-- yeah.

00:45:14.398 --> 00:45:17.540
AUDIENCE: So what
happens if you make n 1,

00:45:17.540 --> 00:45:20.520
and then you do that repeatedly?

00:45:20.520 --> 00:45:23.280
PROFESSOR: Now, if
I did n equals 1,

00:45:23.280 --> 00:45:24.750
I could use that
as an upper bound,

00:45:24.750 --> 00:45:28.080
and it's not so
interesting as, say, 90%.

00:45:28.080 --> 00:45:30.890
But I would actually go
plug it back in here.

00:45:30.890 --> 00:45:33.300
So this would be n plus
1, and it would depend

00:45:33.300 --> 00:45:34.890
how much money I brought.

00:45:34.890 --> 00:45:39.640
But there is a pretty good
chance I go home a winner for m

00:45:39.640 --> 00:45:41.230
equals 1.

00:45:41.230 --> 00:45:43.940
Because I've got a pretty
good chance that I either--

00:45:43.940 --> 00:45:46.090
47% chance I win the first time.

00:45:46.090 --> 00:45:47.752
Then I go home happy.

00:45:47.752 --> 00:45:50.790
If I lost the first time, now
I've just got to win twice.

00:45:50.790 --> 00:45:52.720
And I might win twice in a row.

00:45:52.720 --> 00:45:55.330
That'll happen about
20% of the time.

00:45:55.330 --> 00:45:58.940
If I lose that, now I've
got to win three in a row.

00:45:58.940 --> 00:46:02.150
That'll happen around
10% of the time.

00:46:02.150 --> 00:46:05.540
So I've got 10 plus
20 plus almost 50.

00:46:05.540 --> 00:46:08.010
Most of the time, I'm going
to go home happy if I just

00:46:08.010 --> 00:46:10.460
have to get ahead by $1.

00:46:10.460 --> 00:46:12.460
But it doesn't take
much more than one

00:46:12.460 --> 00:46:14.660
before you're not
likely to go home happy.

00:46:14.660 --> 00:46:19.050
Getting ahead 10 is not
going to happen, very likely.

00:46:19.050 --> 00:46:21.930
Now, you want to
recurse on that?

00:46:21.930 --> 00:46:25.490
I'm pretty likely
to get ahead by one.

00:46:25.490 --> 00:46:26.990
Well, OK, get ahead by one.

00:46:26.990 --> 00:46:29.639
I'm pretty likely
to do it again.

00:46:29.639 --> 00:46:30.430
And I did it again.

00:46:30.430 --> 00:46:32.320
Now I'm pretty likely
to do it again.

00:46:32.320 --> 00:46:33.945
And there's this
thing called induction

00:46:33.945 --> 00:46:35.270
that we worried a lot about.

00:46:35.270 --> 00:46:38.130
So by induction, are we likely
to go home happy with 10?

00:46:38.130 --> 00:46:43.460
No, because every time you
don't get there, you're dead.

00:46:43.460 --> 00:46:45.720
You had a little chance of
dying and not reaching one,

00:46:45.720 --> 00:46:48.251
and a little chance of dying
and not going from one to two.

00:46:48.251 --> 00:46:50.000
And you add up all
those chances of dying,

00:46:50.000 --> 00:46:52.440
and you're toast, because
that'll be adding up

00:46:52.440 --> 00:46:56.317
to everything, pretty much.

00:46:56.317 --> 00:46:57.400
So that's a good question.

00:46:57.400 --> 00:46:59.410
If you're likely
to get up by one,

00:46:59.410 --> 00:47:01.839
why aren't you likely
to get up by 10?

00:47:01.839 --> 00:47:02.880
It doesn't work that way.

00:47:02.880 --> 00:47:05.300
That's a great question.

00:47:05.300 --> 00:47:12.130
Let me show you the phenomenon
that's going on here, as

00:47:12.130 --> 00:47:15.300
to why it works out this way.

00:47:15.300 --> 00:47:16.644
We had the math.

00:47:16.644 --> 00:47:17.810
So we looked at it that way.

00:47:17.810 --> 00:47:20.810
We notice that one case is a
double root and the other case

00:47:20.810 --> 00:47:22.200
isn't.

00:47:22.200 --> 00:47:23.640
And that exponential,
in the case

00:47:23.640 --> 00:47:25.670
where you didn't have
that second root at 1

00:47:25.670 --> 00:47:28.590
makes an enormous difference.

00:47:28.590 --> 00:47:32.800
Qualitatively, we can
draw the two cases.

00:47:32.800 --> 00:47:43.010
So in the case of an
unbiased or fair game,

00:47:43.010 --> 00:47:47.640
if we track what's
going on over time,

00:47:47.640 --> 00:47:54.265
and we start with n dollars,
sort of this is our baseline.

00:47:57.350 --> 00:48:02.190
And here's our
target-- T is n plus m.

00:48:02.190 --> 00:48:04.230
And so we quit if
we ever get here.

00:48:04.230 --> 00:48:06.530
And we quit if we
ever hit the bottom.

00:48:06.530 --> 00:48:08.920
And we've got a random walk.

00:48:08.920 --> 00:48:15.200
It's going around, just
doing this kind of stuff.

00:48:15.200 --> 00:48:19.150
And eventually, it's going to
hit one of these boundaries.

00:48:19.150 --> 00:48:23.580
And if m is small
compared to n, we're

00:48:23.580 --> 00:48:26.170
more likely to
hit this boundary.

00:48:26.170 --> 00:48:29.150
And in fact, the chance
we hit this boundary first

00:48:29.150 --> 00:48:31.120
is the ratio of these sizes.

00:48:31.120 --> 00:48:34.230
It's n over the total.

00:48:34.230 --> 00:48:38.300
It's the chance that
we hit that one first.

00:48:38.300 --> 00:48:42.300
Now in the biased case, the
picture looks different.

00:48:55.060 --> 00:49:02.342
So in the biased case--
so this is now biased.

00:49:02.342 --> 00:49:04.300
And we're going to assume
it's downward biased.

00:49:04.300 --> 00:49:05.425
You're more likely to lose.

00:49:09.960 --> 00:49:13.770
So you start at n, you've
got your boundary up here

00:49:13.770 --> 00:49:17.740
at T equals n plus m.

00:49:17.740 --> 00:49:21.190
Time is going this way.

00:49:21.190 --> 00:49:28.810
The problem is, you've got
a downward sort of baseline,

00:49:28.810 --> 00:49:33.080
because you expect to lose
a little bit each time.

00:49:33.080 --> 00:49:35.785
And so you're taking
this random walk.

00:49:38.360 --> 00:49:41.970
And you collide here.

00:49:41.970 --> 00:49:47.050
And these things are
known as the swings.

00:49:47.050 --> 00:49:48.795
This is known as the drift.

00:49:52.390 --> 00:49:55.930
And the drift downward
is 1 minus 2p.

00:49:55.930 --> 00:49:58.510
That's what you expect to
lose if you get the expected

00:49:58.510 --> 00:50:01.690
loss on each bet-- 1 minus 2p.

00:50:01.690 --> 00:50:04.800
Because you're going
to not be a fair game.

00:50:04.800 --> 00:50:06.810
This one has zero
drift up there.

00:50:06.810 --> 00:50:08.590
It stays steady.

00:50:08.590 --> 00:50:17.195
And in random walks, drift
outweighs the swings.

00:50:19.900 --> 00:50:21.420
These are the swings here.

00:50:21.420 --> 00:50:23.310
And they're random.

00:50:23.310 --> 00:50:24.980
The drift is deterministic.

00:50:24.980 --> 00:50:26.950
It's steadily going down.

00:50:26.950 --> 00:50:28.890
And so almost always
in a random walk,

00:50:28.890 --> 00:50:32.520
the drift totally
takes over the swings.

00:50:32.520 --> 00:50:34.400
The swings are small
compared to what you're

00:50:34.400 --> 00:50:37.730
losing on a steady basis.

00:50:37.730 --> 00:50:41.260
And that's why you're so
much more likely to lose when

00:50:41.260 --> 00:50:44.110
you have the drift downward.

00:50:46.670 --> 00:50:49.450
Just as an example, maybe
putting some numbers

00:50:49.450 --> 00:50:49.950
around that.

00:50:53.680 --> 00:50:55.700
The swings are the
same in both cases,

00:50:55.700 --> 00:50:59.180
So that gives you some
qualification for how big

00:50:59.180 --> 00:51:00.308
the swings tend to be.

00:51:03.660 --> 00:51:06.365
We can sort of do that with
standard deviation notation.

00:51:09.380 --> 00:51:17.510
After X bets or X steps,
the amount you've drifted,

00:51:17.510 --> 00:51:21.530
or the expected
losses, 1 minus 2p

00:51:21.530 --> 00:51:25.940
X. Maybe we should
just understand

00:51:25.940 --> 00:51:27.300
why this is the case.

00:51:27.300 --> 00:51:37.960
The expected return on a
bet is 1 with probability p,

00:51:37.960 --> 00:51:41.650
and minus 1 with
probability 1 minus p.

00:51:41.650 --> 00:51:46.046
And so that is-- did
I get that right?

00:51:46.046 --> 00:51:49.730
I think that's right.

00:51:49.730 --> 00:51:52.200
Oh, expected loss--
[INAUDIBLE] drifts down.

00:51:52.200 --> 00:51:54.569
Instead of expected
return, let's do the loss,

00:51:54.569 --> 00:51:55.610
because that's the drift.

00:51:55.610 --> 00:51:57.270
It's a downward thing.

00:51:57.270 --> 00:52:01.910
So the expected loss-- now
you lose $1 with 1 minus p.

00:52:04.610 --> 00:52:07.670
And you gain $1, which
is negative loss,

00:52:07.670 --> 00:52:10.050
with probability p.

00:52:10.050 --> 00:52:14.570
And so you get 1 minus
p minus p is 1 minus 2p.

00:52:14.570 --> 00:52:16.370
So that's your expected loss.

00:52:16.370 --> 00:52:21.300
Your expected winnings
are the negative of that.

00:52:21.300 --> 00:52:25.700
So after x steps, you
expect to lose-- well,

00:52:25.700 --> 00:52:27.700
I just add up the
linearity of expectation.

00:52:27.700 --> 00:52:30.950
You expect to lose
this much x times.

00:52:30.950 --> 00:52:32.480
So that's your expected drift.

00:52:32.480 --> 00:52:36.440
You're expected
to lose that much.

00:52:36.440 --> 00:52:38.950
Now, the swing--
and we won't prove

00:52:38.950 --> 00:52:44.670
this-- the swing is expected
to be square root of x

00:52:44.670 --> 00:52:45.480
times a constant.

00:52:45.480 --> 00:52:47.670
So I've used the
theta notation here.

00:52:47.670 --> 00:52:50.230
And the constant is small.

00:52:50.230 --> 00:52:54.090
If I take x consecutive
bets for $1,

00:52:54.090 --> 00:52:57.610
I'm very likely to be
about square root of x

00:52:57.610 --> 00:53:01.510
off of the expected drift.

00:53:01.510 --> 00:53:05.040
And you can see that
this is square root.

00:53:05.040 --> 00:53:06.550
That is linear.

00:53:06.550 --> 00:53:10.250
So this totally dominates that.

00:53:10.250 --> 00:53:14.110
So the swings are generally
not enough to save you.

00:53:14.110 --> 00:53:17.300
And so you're just going to
cruise downward and crash,

00:53:17.300 --> 00:53:18.136
almost surely.

00:53:21.330 --> 00:53:25.160
OK, any questions about that?

00:53:31.360 --> 00:53:34.430
All right, so we figured out
the probability of winning m

00:53:34.430 --> 00:53:36.420
dollars before going broke.

00:53:36.420 --> 00:53:40.230
That's done with.

00:53:40.230 --> 00:53:43.060
Now, this means it's
logical to conclude

00:53:43.060 --> 00:53:47.310
you're likely go home
broke in an unfair game.

00:53:47.310 --> 00:53:50.820
Actually, before we do
that, there's one other case

00:53:50.820 --> 00:53:52.760
we've got to rule out.

00:53:52.760 --> 00:53:56.512
We've proved you're likely
not to go home a winner.

00:53:56.512 --> 00:53:58.720
Does that necessarily mean
you're likely to go broke?

00:53:58.720 --> 00:54:00.845
I've been saying that, but
there's some other thing

00:54:00.845 --> 00:54:03.240
we should check.

00:54:03.240 --> 00:54:07.484
What's one way you
might not go home broke?

00:54:07.484 --> 00:54:08.400
AUDIENCE: [INAUDIBLE].

00:54:08.400 --> 00:54:09.385
PROFESSOR: What is it?

00:54:09.385 --> 00:54:09.780
AUDIENCE: You don't go home.

00:54:09.780 --> 00:54:11.220
PROFESSOR: You don't go home.

00:54:11.220 --> 00:54:13.520
And why would you not go home?

00:54:13.520 --> 00:54:14.020
Yeah?

00:54:14.020 --> 00:54:15.395
AUDIENCE: You're
playing forever.

00:54:15.395 --> 00:54:16.990
PROFESSOR: You're
playing forever-- we

00:54:16.990 --> 00:54:19.840
didn't rule out that case--
you're playing forever.

00:54:19.840 --> 00:54:22.790
But it turns out, if you
did the same analysis,

00:54:22.790 --> 00:54:25.200
you can analyze the probability
of going home broke.

00:54:25.200 --> 00:54:27.366
And when you add it to the
probability of going home

00:54:27.366 --> 00:54:30.320
a winner, it adds to 1,
which means the probability

00:54:30.320 --> 00:54:33.480
playing forever is 0.

00:54:33.480 --> 00:54:35.757
Now, there are sample points
where you play forever.

00:54:35.757 --> 00:54:37.590
But when you add up all
those sample points,

00:54:37.590 --> 00:54:41.210
if their probability
is 0, we ignore them.

00:54:41.210 --> 00:54:42.950
And we say it can't happen.

00:54:42.950 --> 00:54:46.379
Now, we're bordering
on philosophy here,

00:54:46.379 --> 00:54:47.920
because there is a
sample point here.

00:54:47.920 --> 00:54:50.640
You could win, lose, win,
lose, win, lose forever.

00:54:50.640 --> 00:54:54.305
But because you add them
all up at 0, measure theory

00:54:54.305 --> 00:54:56.430
and some math we're not
going to get into tells you

00:54:56.430 --> 00:54:58.010
it doesn't happen.

00:54:58.010 --> 00:55:00.430
It's probability 1 you're
a winner or a loser.

00:55:07.430 --> 00:55:09.760
All right, so I'm
not going to prove

00:55:09.760 --> 00:55:13.350
that the probability
you play forever is 0.

00:55:24.250 --> 00:55:27.660
But let's look at
how long you play.

00:55:27.660 --> 00:55:32.230
How long does it take you to
go home one way or another-- go

00:55:32.230 --> 00:55:33.750
broke?

00:55:33.750 --> 00:55:36.440
And to do this, we're going
to set up another recurrence.

00:55:39.440 --> 00:55:42.160
So we know eventually
we hit a boundary.

00:55:42.160 --> 00:55:44.160
I want to know how
many bets does it

00:55:44.160 --> 00:55:48.100
take to hit the boundary?

00:55:48.100 --> 00:55:50.530
How long do we get to play
before we go home unhappy?

00:55:53.270 --> 00:55:59.150
So S will be the number of
steps until we hit a boundary.

00:56:04.320 --> 00:56:06.820
And I want to know the
expected number-- I'll call it

00:56:06.820 --> 00:56:10.464
E sub n here-- is the
expected value of S given

00:56:10.464 --> 00:56:11.630
that I start with n dollars.

00:56:14.884 --> 00:56:16.300
I mean, the reason
you could think

00:56:16.300 --> 00:56:18.550
about this is, we know
we're going to go home

00:56:18.550 --> 00:56:20.410
broke-- pretty likely.

00:56:20.410 --> 00:56:22.810
Do we at least have some
fun in the meantime?

00:56:22.810 --> 00:56:25.640
Do we get a lot gambling in
and free drinks, or whatever,

00:56:25.640 --> 00:56:28.700
before we're killed here?

00:56:31.590 --> 00:56:33.210
Now, this also has a recurrence.

00:56:33.210 --> 00:56:35.030
And I'm going to show
you what it is, then

00:56:35.030 --> 00:56:37.940
prove that that's correct.

00:56:37.940 --> 00:56:42.610
So I claim that
the expected number

00:56:42.610 --> 00:56:44.600
of steps given we
start with n dollars

00:56:44.600 --> 00:56:51.500
is 0 if we start with no money,
because we are already broke.

00:56:51.500 --> 00:56:57.370
It's 0 if we start
with T dollars,

00:56:57.370 --> 00:56:59.110
because then we
just go home happy.

00:56:59.110 --> 00:57:03.290
There's no bets, because we've
already hit the upper boundary.

00:57:03.290 --> 00:57:09.490
And the interesting case will be
it's 1 plus p times E n minus 1

00:57:09.490 --> 00:57:17.980
plus 1 minus p-- oops, n plus
1-- 1 minus p E n minus 1,

00:57:17.980 --> 00:57:21.423
if we start with
between 0 and T dollars.

00:57:26.980 --> 00:57:30.650
OK, so let's prove that.

00:57:33.400 --> 00:57:38.660
Actually, the proof is exactly
the same as the last one.

00:57:38.660 --> 00:57:40.194
So I don't think
I need to do it.

00:57:44.300 --> 00:57:48.370
The proof is pretty simple,
because we look at two cases.

00:57:48.370 --> 00:57:52.150
You win the first bet--
happens with probability p.

00:57:52.150 --> 00:57:55.250
And then you're starting
with n plus $1 over again.

00:57:55.250 --> 00:57:58.050
Or you lose the
first bet-- happens

00:57:58.050 --> 00:58:00.360
with probability 1 minus p.

00:58:00.360 --> 00:58:03.890
And you're starting
over with n minus $1

00:58:03.890 --> 00:58:05.705
now-- same as last time.

00:58:05.705 --> 00:58:07.080
In fact, this
whole recurrence is

00:58:07.080 --> 00:58:11.690
identical to last time
except for one thing.

00:58:11.690 --> 00:58:13.914
What's the one thing
that's different now?

00:58:13.914 --> 00:58:14.870
AUDIENCE: [INAUDIBLE].

00:58:14.870 --> 00:58:15.994
PROFESSOR: What is it?

00:58:15.994 --> 00:58:18.780
AUDIENCE: You have [INAUDIBLE].

00:58:18.780 --> 00:58:20.738
PROFESSOR: You have--

00:58:20.738 --> 00:58:23.208
AUDIENCE: So it's not
[INAUDIBLE] any more.

00:58:23.208 --> 00:58:24.690
PROFESSOR: That's different.

00:58:24.690 --> 00:58:26.920
There's another difference.

00:58:26.920 --> 00:58:30.100
That's one difference that's
going to make it inhomogeneous.

00:58:30.100 --> 00:58:31.409
That's sort of a pain.

00:58:31.409 --> 00:58:33.200
What's the other
difference from last time?

00:58:33.200 --> 00:58:35.025
This part's the same otherwise.

00:58:35.025 --> 00:58:35.900
AUDIENCE: Boundaries.

00:58:35.900 --> 00:58:36.400
PROFESSOR: What is it?

00:58:36.400 --> 00:58:37.650
AUDIENCE: Boundary conditions.

00:58:37.650 --> 00:58:40.120
PROFESSOR: Boundary conditions--
that was a 1 before.

00:58:40.120 --> 00:58:42.290
Now it's a 0.

00:58:42.290 --> 00:58:46.420
OK, so a little change
here, and I added a 1 here.

00:58:46.420 --> 00:58:50.041
But that's going to make it
a pretty different answer.

00:58:50.041 --> 00:58:51.540
So let's see what
the recurrence is.

00:58:51.540 --> 00:58:57.310
I'll rearrange terms here
to put it into recurrence.

00:58:57.310 --> 00:59:07.650
I get p E sub n plus 1 minus
E n plus 1 minus p E n minus 1

00:59:07.650 --> 00:59:10.710
equals minus 1, not 0.

00:59:10.710 --> 00:59:15.570
And the boundary conditions
are E 0 is 0 and E T is 0.

00:59:18.210 --> 00:59:21.550
OK, what's the
first thing you do

00:59:21.550 --> 00:59:26.020
when you have an inhomogeneous
linear recurrence?

00:59:26.020 --> 00:59:28.920
Solve the homogeneous one.

00:59:28.920 --> 00:59:32.050
And the answer there-- well,
it's the same as before.

00:59:32.050 --> 00:59:33.990
This is the part we analyzed.

00:59:33.990 --> 00:59:36.650
And we'll do it for
the case when p is not

00:59:36.650 --> 00:59:39.770
1/2-- so the unfair game.

00:59:39.770 --> 00:59:47.270
So the homogeneous
solution is E n

00:59:47.270 --> 00:59:51.870
just from before-- same
thing-- 1 minus p over p

00:59:51.870 --> 00:59:55.720
to the n plus B. And this
is the case with two roots.

00:59:55.720 --> 00:59:56.842
p does not equal 1/2.

01:00:00.620 --> 01:00:07.634
What's the next thing you do
for inhomogeneous recurrence?

01:00:07.634 --> 01:00:11.620
Are we plugging in
boundary conditions yet?

01:00:11.620 --> 01:00:12.120
No.

01:00:12.120 --> 01:00:14.840
So what do I do next?

01:00:14.840 --> 01:00:15.860
Particular solution.

01:00:21.160 --> 01:00:25.660
And what's my first guess?

01:00:25.660 --> 01:00:31.780
We have the recurrence
like this here.

01:00:34.590 --> 01:00:37.960
What do I guess for E n?

01:00:37.960 --> 01:00:42.610
I'm trying to guess something
that looks like that.

01:00:42.610 --> 01:00:45.380
So what do I guess?

01:00:45.380 --> 01:00:47.740
Constant, yeah.

01:00:47.740 --> 01:00:48.420
That's a scalar.

01:00:48.420 --> 01:00:51.120
I just guess a constant.

01:00:51.120 --> 01:00:57.420
And if I plug a constant a
into here, it's going to fail.

01:00:57.420 --> 01:01:01.730
Because I'll just
pull the a out.

01:01:01.730 --> 01:01:05.740
I'll get p minus 1
plus 1 minus p is 0,

01:01:05.740 --> 01:01:07.640
and 0 doesn't equal minus 1.

01:01:07.640 --> 01:01:08.220
So it fails.

01:01:12.240 --> 01:01:13.290
So I guess again.

01:01:13.290 --> 01:01:16.380
What do I guess next time?

01:01:16.380 --> 01:01:19.990
a n plus b.

01:01:19.990 --> 01:01:22.580
All right, and I
don't think I'll

01:01:22.580 --> 01:01:28.430
drag you through all the
algebra for that, but it works.

01:01:28.430 --> 01:01:35.310
And when you do it, you
find that a is minus 1

01:01:35.310 --> 01:01:38.100
over 2p minus 1.

01:01:38.100 --> 01:01:39.470
And b could be anything.

01:01:39.470 --> 01:01:44.080
So let me just rewrite
this as 1 over 1 minus 2p.

01:01:44.080 --> 01:01:46.170
And b can be anything, so
we'll set b equal to 0.

01:01:49.490 --> 01:01:52.910
So we've got our
particular solution.

01:01:52.910 --> 01:01:54.520
It's not hard to
go compute that.

01:01:54.520 --> 01:01:57.402
You just plug it
back in and solve.

01:02:04.642 --> 01:02:06.850
Now we add them together to
get the general solution.

01:02:18.830 --> 01:02:25.440
This is A n plus B. B was 0, and
here's A as 1 over 1 minus 2p.

01:02:25.440 --> 01:02:29.270
And now what do we do to finish?

01:02:29.270 --> 01:02:33.700
I've got my general
solution here

01:02:33.700 --> 01:02:37.537
by adding up the homogeneous
and the particular solution.

01:02:37.537 --> 01:02:38.870
Plug in the boundary conditions.

01:02:45.680 --> 01:02:49.789
All right, I'm not going to drag
you through solving this case,

01:02:49.789 --> 01:02:51.330
but I'm going to
show you the answer.

01:02:55.430 --> 01:03:03.480
E n equals n over 1 minus 2p
minus T, the upper boundary,

01:03:03.480 --> 01:03:13.400
over 1 minus 2p times 1 minus p
over p to the n minus 1 over 1

01:03:13.400 --> 01:03:17.930
minus p over p to the T minus 1.

01:03:17.930 --> 01:03:20.670
So actually, this looks a little
familiar from the last time

01:03:20.670 --> 01:03:23.742
when we did this recurrence,
figuring out the probability we

01:03:23.742 --> 01:03:24.450
go home a winner.

01:03:24.450 --> 01:03:27.630
Here this is the
expected number of steps

01:03:27.630 --> 01:03:30.900
to hit a boundary, to go home.

01:03:30.900 --> 01:03:33.130
If we plug in the values,
it's a little hairy,

01:03:33.130 --> 01:03:35.850
but you can compute it.

01:03:35.850 --> 01:03:42.860
So for example, if m
is 100, n is 1,000,

01:03:42.860 --> 01:03:47.160
T would be 1,100 in that case.

01:03:47.160 --> 01:03:52.210
p is 9/19 playing roulette.

01:03:52.210 --> 01:03:59.580
Then the expected number of
bets before you have to go home

01:03:59.580 --> 01:04:13.480
is 1,900 from this part,
minus 0.56 from that part.

01:04:13.480 --> 01:04:17.570
So actually 19,000, sorry.

01:04:17.570 --> 01:04:24.580
So it's very close to 19,000
bets you've got to make.

01:04:24.580 --> 01:04:28.230
So it takes a long
time to lose $1,000.

01:04:28.230 --> 01:04:32.410
And it sort of comes
very close to the answer

01:04:32.410 --> 01:04:34.860
you would have guessed
without thinking and solving

01:04:34.860 --> 01:04:36.120
the recurrence.

01:04:36.120 --> 01:04:41.350
If you expect to lose
1 minus 2p every bet,

01:04:41.350 --> 01:04:44.160
and you want to know how long
the expected time to lose

01:04:44.160 --> 01:04:46.890
n dollars, you might
well have said,

01:04:46.890 --> 01:04:51.210
I think it's going to be n over
the amount I lose every time.

01:04:51.210 --> 01:04:54.460
That would be
wrong, technically,

01:04:54.460 --> 01:04:57.400
because you'd have left
off this nasty thing.

01:04:57.400 --> 01:05:00.780
But this nasty thing doesn't
make much of a real difference,

01:05:00.780 --> 01:05:04.245
because it goes to 0 really
fast for any numbers like 100

01:05:04.245 --> 01:05:06.570
and 1,000-- makes no
difference at all.

01:05:06.570 --> 01:05:08.380
So the intuition in
that case comes out

01:05:08.380 --> 01:05:11.430
to be pretty close, even
though technically, it's

01:05:11.430 --> 01:05:15.540
not exactly right.

01:05:15.540 --> 01:05:21.460
Now, to see why this goes to
0, if T equals n plus m here--

01:05:21.460 --> 01:05:25.350
this is n plus m--
and your upper limits,

01:05:25.350 --> 01:05:31.040
say m goes to infinity--
it's 100 in this case-- then

01:05:31.040 --> 01:05:34.770
that just zooms to 0, and
you're only left with that.

01:05:34.770 --> 01:05:39.510
Which means that we can use
asymptotic notation here

01:05:39.510 --> 01:05:42.782
to sort of characterize the
expected number of bets.

01:05:48.020 --> 01:05:51.000
And it's totally
dominated by the drift.

01:05:51.000 --> 01:05:58.120
So as m goes to infinity, the
expected time to live here

01:05:58.120 --> 01:06:02.060
is tilde n over 1 minus 2p.

01:06:02.060 --> 01:06:07.330
If you've got n dollars,
losing 1 minus 2p every time,

01:06:07.330 --> 01:06:11.650
then you last for n
over 1 minus 2p steps.

01:06:11.650 --> 01:06:17.180
OK, now, actually,
what situation in words

01:06:17.180 --> 01:06:19.900
does m going to infinity mean?

01:06:19.900 --> 01:06:23.200
Say I set m to be infinity?

01:06:23.200 --> 01:06:26.810
What is that kind of
game if m is infinity?

01:06:26.810 --> 01:06:28.120
How long am I playing now?

01:06:28.120 --> 01:06:28.729
Yeah.

01:06:28.729 --> 01:06:30.520
AUDIENCE: Now you're
playing for as long as

01:06:30.520 --> 01:06:32.760
it takes you to lose
all of your money.

01:06:32.760 --> 01:06:36.200
PROFESSOR: Yes, because there is
no stopping condition up here--

01:06:36.200 --> 01:06:37.380
going home happy.

01:06:37.380 --> 01:06:43.060
I'm going to play forever
or until I lose everything.

01:06:43.060 --> 01:06:47.460
And this says how long
you expect to play.

01:06:47.460 --> 01:06:51.220
It's a little less
than n over 1 minus 2p.

01:06:51.220 --> 01:06:53.900
So if you play
until you go broke,

01:06:53.900 --> 01:06:55.510
that's how long
you expect to play.

01:06:59.950 --> 01:07:03.200
So that sort of makes
sense in that scenario.

01:07:03.200 --> 01:07:06.570
That's not one where it
surprises you by intuition.

01:07:06.570 --> 01:07:08.904
It is interesting to consider
the case of a fair game.

01:07:08.904 --> 01:07:10.820
Because there's something
that's non-intuitive

01:07:10.820 --> 01:07:12.570
that happens there.

01:07:12.570 --> 01:07:14.290
So in a fair game, p is 1/2.

01:07:17.350 --> 01:07:24.280
Now, if I plug in 1/2
here, well, I divide by 0.

01:07:24.280 --> 01:07:27.730
I expect to play forever.

01:07:27.730 --> 01:07:29.500
That's not a good way
to do the analysis,

01:07:29.500 --> 01:07:30.950
that you get to a divide by 0.

01:07:30.950 --> 01:07:33.580
Let's actually go
back and look at this

01:07:33.580 --> 01:07:35.100
for the case when p is 1/2.

01:07:37.769 --> 01:07:39.310
And see what happens
in a fair game--

01:07:39.310 --> 01:07:43.250
how long you expect to
play in a fair game.

01:07:43.250 --> 01:07:48.500
Then the homogeneous
solution is the simple case.

01:07:48.500 --> 01:07:54.270
E is A n plus B. You
have a double root at 1,

01:07:54.270 --> 01:07:57.340
which we don't have to
worry about 1 to the n.

01:07:57.340 --> 01:08:03.550
When you do your
particular solution,

01:08:03.550 --> 01:08:08.620
you'll try a single
scalar, and it fails.

01:08:08.620 --> 01:08:11.730
I'll use lowercase a-- fails.

01:08:11.730 --> 01:08:18.460
You will then try a degree one
polynomial, and that will fail.

01:08:18.460 --> 01:08:21.010
What are you going to try next?

01:08:21.010 --> 01:08:28.210
Second-degree polynomial,
and that will work.

01:08:28.210 --> 01:08:34.100
OK, and the answer
you get when you

01:08:34.100 --> 01:08:41.960
do that is that-- I'll
put the answer here.

01:08:41.960 --> 01:08:47.450
It turns out that a is minus
1 and b and c can be 0.

01:08:47.450 --> 01:08:49.470
So it's just going
to be minus n squared

01:08:49.470 --> 01:08:51.660
for the particular solution.

01:08:51.660 --> 01:08:59.931
That means your general solution
is A n plus B minus n squared.

01:08:59.931 --> 01:09:01.389
Now you do your
boundary condition.

01:09:06.660 --> 01:09:10.180
You have E 0 is 0.

01:09:10.180 --> 01:09:11.359
Plug in 0 for n.

01:09:11.359 --> 01:09:13.720
That's equal to B. So B is 0.

01:09:13.720 --> 01:09:15.620
That's nice.

01:09:15.620 --> 01:09:19.180
E T is 0.

01:09:19.180 --> 01:09:25.029
And I plug in T here, I get
AT, B is 0 minus T squared.

01:09:25.029 --> 01:09:28.160
So I solve for A here.

01:09:28.160 --> 01:09:35.550
That means that A equals T. AT
squared minus T squared is 0.

01:09:35.550 --> 01:09:38.439
A has to be T.

01:09:38.439 --> 01:09:49.960
So that means that E n
is Tn minus n squared.

01:09:49.960 --> 01:09:52.090
Now, T is the upper bound.

01:09:52.090 --> 01:09:53.140
It's just n plus m.

01:09:56.800 --> 01:10:00.880
n plus m times n
minus n squared--

01:10:00.880 --> 01:10:01.925
this gets really simple.

01:10:01.925 --> 01:10:03.190
The m squared cancels.

01:10:03.190 --> 01:10:06.470
I just get n out.

01:10:06.470 --> 01:10:08.820
That says if you're playing
a fair game, until you

01:10:08.820 --> 01:10:14.400
win m or lose n, you expect
to play for nm steps, which

01:10:14.400 --> 01:10:15.680
is really nice.

01:10:15.680 --> 01:10:21.100
This is p is 1/2-- very clean.

01:10:21.100 --> 01:10:25.940
Now, if you let m
equal to infinity,

01:10:25.940 --> 01:10:29.680
you're going to expect
to play forever.

01:10:29.680 --> 01:10:33.680
So with a fair game, if you
play until you're broke,

01:10:33.680 --> 01:10:37.220
the expected number
of bets is infinite.

01:10:37.220 --> 01:10:39.510
That's nice.

01:10:39.510 --> 01:10:41.990
You can play forever
is the expectation.

01:10:46.160 --> 01:10:50.430
Now, here's the weird thing.

01:10:50.430 --> 01:10:53.420
If you expect to play
forever, does that

01:10:53.420 --> 01:10:55.725
mean you're not likely
to go home broke?

01:10:58.580 --> 01:11:02.410
You expect to play forever.

01:11:02.410 --> 01:11:05.976
And as long as you're playing,
you're not going home broke.

01:11:05.976 --> 01:11:07.850
Now, there's some chance
of going home broke,

01:11:07.850 --> 01:11:10.330
because you might just lose
every bet-- not likely.

01:11:15.930 --> 01:11:18.580
Here's the weird
thing-- the probability

01:11:18.580 --> 01:11:24.460
you go home broke if you
play until you go broke is 1.

01:11:24.460 --> 01:11:26.970
You will go home broke.

01:11:26.970 --> 01:11:30.140
It's just that it
takes you expected

01:11:30.140 --> 01:11:32.930
infinite amount
of time to do it--

01:11:32.930 --> 01:11:36.350
sort of one of these weird
things in a fair game.

01:11:36.350 --> 01:11:40.330
So here we proved the
expected number bets is nm.

01:11:40.330 --> 01:11:44.420
If m is infinite, that becomes
an infinite number of bets.

01:11:44.420 --> 01:11:48.095
One more theorem here-- this
one's a little surprising.

01:11:52.172 --> 01:11:54.130
This theorem is called
Quit While You're Ahead.

01:12:06.570 --> 01:12:18.700
If you start with n dollars,
and it's a fair game,

01:12:18.700 --> 01:12:33.700
and you play until
you go broke, then

01:12:33.700 --> 01:12:38.540
the probability that
you do go broke,

01:12:38.540 --> 01:12:41.730
as opposed to playing
forever, is 1.

01:12:41.730 --> 01:12:43.430
It's a certainty.

01:12:43.430 --> 01:12:47.140
You'll go broke, even
though you expect it to take

01:12:47.140 --> 01:12:49.570
an infinite amount of time.

01:12:49.570 --> 01:12:51.074
All right, so let's prove that.

01:13:06.561 --> 01:13:07.977
OK, the proof is
by contradiction.

01:13:15.330 --> 01:13:18.600
Assume it's not true.

01:13:18.600 --> 01:13:23.220
And that means that
you're assuming

01:13:23.220 --> 01:13:26.080
that there exists
some number of dollars

01:13:26.080 --> 01:13:32.880
that you can start with, and
some epsilon bigger than 0,

01:13:32.880 --> 01:13:41.190
such that the probability
that you lose the n

01:13:41.190 --> 01:13:43.900
dollars-- in which
case you're going home

01:13:43.900 --> 01:13:56.310
broke-- let me write the
probability you go broke--

01:13:56.310 --> 01:14:00.009
is at most 1 minus epsilon.

01:14:00.009 --> 01:14:01.800
In other words, if the
theorem is not true,

01:14:01.800 --> 01:14:04.860
there's some amount of money
you can start with such

01:14:04.860 --> 01:14:09.000
that the chance you go broke
is less than 1-- less than 1

01:14:09.000 --> 01:14:12.150
minus epsilon.

01:14:12.150 --> 01:14:17.590
OK, now that means that for
all m, where you might possibly

01:14:17.590 --> 01:14:20.680
stop but you're not
going to, the probability

01:14:20.680 --> 01:14:31.365
you lose n before you win m
is at most 1 minus epsilon.

01:14:35.700 --> 01:14:37.240
Because we're saying
the probability

01:14:37.240 --> 01:14:39.360
you lose n no matter
what is at most that.

01:14:39.360 --> 01:14:41.820
So it's certainly less
than 1 minus epsilon

01:14:41.820 --> 01:14:46.670
that you lose n before
you win m dollars.

01:14:46.670 --> 01:14:48.880
And we know what
that probability is.

01:14:48.880 --> 01:14:51.770
This probability is
just m over n plus m.

01:14:51.770 --> 01:14:54.700
We proved that earlier.

01:14:54.700 --> 01:14:59.360
So that has to be less than
1 minus epsilon for all m.

01:14:59.360 --> 01:15:05.150
And now I just multiply
through for all m.

01:15:05.150 --> 01:15:07.570
That means that m is
less than or equal to 1

01:15:07.570 --> 01:15:09.616
minus epsilon n plus m.

01:15:12.930 --> 01:15:17.092
And then we'll solve that.

01:15:25.960 --> 01:15:29.630
OK, so just multiply this out.

01:15:29.630 --> 01:15:39.260
So for all m less than or
equal to n plus m minus epsilon

01:15:39.260 --> 01:15:45.360
n minus epsilon m, and now
pull the m terms out here,

01:15:45.360 --> 01:15:49.640
I get for all m,
epsilon m is less than

01:15:49.640 --> 01:15:53.020
or equal to 1 minus epsilon n.

01:15:53.020 --> 01:15:55.840
That means for all
m, m is smaller

01:15:55.840 --> 01:16:01.170
than 1 minus epsilon
over epsilon times n.

01:16:01.170 --> 01:16:03.060
And that can't be true.

01:16:03.060 --> 01:16:06.270
It's not true the for all
m, this is less than that,

01:16:06.270 --> 01:16:09.030
because these are fixed values.

01:16:09.030 --> 01:16:11.790
That's a contradiction.

01:16:11.790 --> 01:16:15.320
All right, so we
proved that if you

01:16:15.320 --> 01:16:17.530
keep playing until
you're broke, you will go

01:16:17.530 --> 01:16:20.030
broke with probability 1.

01:16:20.030 --> 01:16:25.060
So even if you're playing a fair
game, quit while you're ahead.

01:16:25.060 --> 01:16:28.970
Because if you don't,
you're going to go broke.

01:16:28.970 --> 01:16:31.500
The swings will eventually
catch up with you.

01:16:31.500 --> 01:16:35.159
So if we draw the graph here,
we'll see why that's true.

01:16:51.810 --> 01:16:55.660
All right, if I have
time going this way,

01:16:55.660 --> 01:17:01.750
and I start with n dollars,
my baseline is here.

01:17:01.750 --> 01:17:03.884
The drift is 0.

01:17:03.884 --> 01:17:04.925
I'm going to have swings.

01:17:07.480 --> 01:17:09.510
I might have some
really big, high swings,

01:17:09.510 --> 01:17:12.700
but it doesn't matter,
because eventually I'm

01:17:12.700 --> 01:17:16.030
going to get a really bad swing,
and I'm going to go broke.

01:17:19.450 --> 01:17:21.190
Now, if you ever
play a game where

01:17:21.190 --> 01:17:25.960
you're likely to be winning each
time, and the drift goes up,

01:17:25.960 --> 01:17:27.635
that's a good game
to play, obviously.

01:17:27.635 --> 01:17:29.529
It just keeps getting better.

01:17:29.529 --> 01:17:31.070
And that's a whole
math change there.

01:17:34.410 --> 01:17:36.380
So that's it.

01:17:36.380 --> 01:17:39.030
Remember, we have the ice
cream study session Monday.

01:17:39.030 --> 01:17:41.790
So come to that if you'd like.

01:17:41.790 --> 01:17:45.470
And definitely come to
the final on Tuesday.

01:17:45.470 --> 01:17:47.440
And thanks for your
hard work, and being

01:17:47.440 --> 01:17:49.170
such a great class this year.

01:17:49.170 --> 01:17:52.820
[APPLAUSE]