1
00:00:00,000 --> 00:00:01,100
2
00:00:01,100 --> 00:00:05,390
In this video, we'll look at an
example in which we compute
3
00:00:05,390 --> 00:00:09,900
the expectation and cumulative
density function of a mixed
4
00:00:09,900 --> 00:00:11,730
random variable.
5
00:00:11,730 --> 00:00:14,500
The problem is as follows.
6
00:00:14,500 --> 00:00:18,480
Al arrives at some bus stand
or taxi stand at a given
7
00:00:18,480 --> 00:00:21,700
time-- let's say time
t equals 0.
8
00:00:21,700 --> 00:00:25,500
He finds a taxi waiting for him
with probability 2/3 in
9
00:00:25,500 --> 00:00:27,600
which he takes it.
10
00:00:27,600 --> 00:00:31,470
Otherwise, he takes the next
arriving taxi or bus.
11
00:00:31,470 --> 00:00:34,080
12
00:00:34,080 --> 00:00:36,540
The time that the next taxi
arrives between 0 and 10
13
00:00:36,540 --> 00:00:38,742
minutes, and it's uniformly
distributed.
14
00:00:38,742 --> 00:00:42,111
The next bus leaves exactly
in 5 minutes.
15
00:00:42,111 --> 00:00:46,920
So the question is, if X is Al's
waiting time, what is the
16
00:00:46,920 --> 00:00:51,800
CDF and expectation of X?
17
00:00:51,800 --> 00:00:57,010
So one way to view this problem
that's convenient is
18
00:00:57,010 --> 00:00:58,170
the tree structure.
19
00:00:58,170 --> 00:01:00,950
So I've drawn it for you here
in which the events of
20
00:01:00,950 --> 00:01:05,920
interest are B1, B2, and B3,
B1 being Al catches the
21
00:01:05,920 --> 00:01:10,370
waiting taxi, B2 being Al
catches the next taxi, which
22
00:01:10,370 --> 00:01:15,460
arrives between 0 and 5 minutes,
and B3 being Al
23
00:01:15,460 --> 00:01:18,290
catches the bus at the
time t plus 5.
24
00:01:18,290 --> 00:01:20,850
Notice that these three
events are disjoint.
25
00:01:20,850 --> 00:01:25,050
So Al catching the waiting taxi
means he can't catch the
26
00:01:25,050 --> 00:01:28,840
bus or the next arriving taxi.
27
00:01:28,840 --> 00:01:32,920
And it also covers the entire
set of outcomes.
28
00:01:32,920 --> 00:01:37,550
So, in fact, B1, B2, and
B3 are a partition.
29
00:01:37,550 --> 00:01:40,845
So let's look at the relevant
probabilities.
30
00:01:40,845 --> 00:01:43,740
31
00:01:43,740 --> 00:01:48,870
Whether or not B1 happens
depends on whether or not the
32
00:01:48,870 --> 00:01:51,710
taxi's waiting for Al.
33
00:01:51,710 --> 00:01:56,680
So if the taxi is waiting for
him, which happens with 2/3
34
00:01:56,680 --> 00:01:59,950
probability, B1 happens.
35
00:01:59,950 --> 00:02:03,450
Otherwise, with 1/3 probability,
we see whether or
36
00:02:03,450 --> 00:02:07,130
not a taxi is going to arrive
between 0 and 5 minutes.
37
00:02:07,130 --> 00:02:11,800
If it arrives, which is going
to happen with what
38
00:02:11,800 --> 00:02:12,340
probability?
39
00:02:12,340 --> 00:02:15,160
Well, we know that the next
taxi is going to arrive
40
00:02:15,160 --> 00:02:17,030
between 0 and 10 minutes
uniform.
41
00:02:17,030 --> 00:02:18,610
It's a uniform distribution.
42
00:02:18,610 --> 00:02:21,300
And so half the mass is going
to be between 0 and 5.
43
00:02:21,300 --> 00:02:23,930
And the other half is going
to be between 5 and 10.
44
00:02:23,930 --> 00:02:29,050
And so this is going
to be 1/2 and 1/2.
45
00:02:29,050 --> 00:02:33,190
And let's look at what
X looks like.
46
00:02:33,190 --> 00:02:36,720
If B1 happens, Al isn't waiting
at all, so x is going
47
00:02:36,720 --> 00:02:38,436
to be equal to 0.
48
00:02:38,436 --> 00:02:41,950
If B3 happens, which is the
other easy case, Al's going to
49
00:02:41,950 --> 00:02:44,360
be waiting for 5 minutes
exactly.
50
00:02:44,360 --> 00:02:48,985
And if B2 happens, well, it's
going to be some value
51
00:02:48,985 --> 00:02:50,640
between 0 and 5.
52
00:02:50,640 --> 00:02:52,828
We can actually draw the
density, so let's see if we
53
00:02:52,828 --> 00:02:55,070
can do that here.
54
00:02:55,070 --> 00:03:06,570
55
00:03:06,570 --> 00:03:12,895
The original next taxi was
uniformly distributed
56
00:03:12,895 --> 00:03:14,204
between 0 and 10.
57
00:03:14,204 --> 00:03:17,100
58
00:03:17,100 --> 00:03:19,030
But now, we're told two
pieces of information.
59
00:03:19,030 --> 00:03:21,690
We're told that B2 happens,
which means that there's no
60
00:03:21,690 --> 00:03:24,190
taxi waiting, and the
next taxi arrives
61
00:03:24,190 --> 00:03:25,300
between 0 and 5 minutes.
62
00:03:25,300 --> 00:03:28,300
Well, the fact that there was no
taxi waiting has no bearing
63
00:03:28,300 --> 00:03:30,090
on that density.
64
00:03:30,090 --> 00:03:33,450
But the fact that the next taxi
arrives between 0 and 5
65
00:03:33,450 --> 00:03:36,300
does make a difference, because
the density then is
66
00:03:36,300 --> 00:03:42,925
going to be definitely 0 in any
region outside 0 and 5.
67
00:03:42,925 --> 00:03:45,070
Now, the question is, how
is it going to look
68
00:03:45,070 --> 00:03:46,930
between 0 and 5?
69
00:03:46,930 --> 00:03:48,440
Well, it's not going
to look crazy.
70
00:03:48,440 --> 00:03:49,800
It's not going to look like
something different.
71
00:03:49,800 --> 00:03:54,100
It's simply going to be a scale
version of the original
72
00:03:54,100 --> 00:03:56,970
density between 0 and 5.
73
00:03:56,970 --> 00:04:03,185
You can verify this by looking
at the actual formula for when
74
00:04:03,185 --> 00:04:07,550
you condition events on
a random variable.
75
00:04:07,550 --> 00:04:10,280
Here, it's going to be 1/5
in order for this to
76
00:04:10,280 --> 00:04:11,530
integrate out to 1.
77
00:04:11,530 --> 00:04:14,340
78
00:04:14,340 --> 00:04:18,610
And now we can jump right into
figuring out the expectation.
79
00:04:18,610 --> 00:04:21,260
Now, notice that X is actually
a mixed random variable?
80
00:04:21,260 --> 00:04:22,060
What does that mean?
81
00:04:22,060 --> 00:04:26,820
Well, X either takes on values
according to either a discrete
82
00:04:26,820 --> 00:04:29,040
probability law or
a continuous one.
83
00:04:29,040 --> 00:04:32,607
So if B1 happens, for example, X
is going to be exactly equal
84
00:04:32,607 --> 00:04:35,660
to 0 with probability
1, which is a
85
00:04:35,660 --> 00:04:38,200
discrete probability problem.
86
00:04:38,200 --> 00:04:43,480
On the other hand, if B2
happens, then the value of X
87
00:04:43,480 --> 00:04:47,525
depends on the density, which
is going to be continuous.
88
00:04:47,525 --> 00:04:48,960
So X is going to
be a continuous
89
00:04:48,960 --> 00:04:51,730
random variable here.
90
00:04:51,730 --> 00:04:56,540
So how do you define an
expectation in this case?
91
00:04:56,540 --> 00:05:04,680
Well, you can do it so that
it satisfies the total
92
00:05:04,680 --> 00:05:11,350
expectation theorem, which means
that the expectation of
93
00:05:11,350 --> 00:05:18,320
X is the probability of B1 times
the expectation given B1
94
00:05:18,320 --> 00:05:27,220
plus the probability of B2 times
the expectation given B2
95
00:05:27,220 --> 00:05:31,121
plus the probability
of B3 times the
96
00:05:31,121 --> 00:05:33,220
expectation given B3.
97
00:05:33,220 --> 00:05:39,340
98
00:05:39,340 --> 00:05:41,530
So this will satisfy the total
expectation theorem.
99
00:05:41,530 --> 00:05:45,180
100
00:05:45,180 --> 00:05:50,436
So the probability of B1 is
going to be exactly 2/3.
101
00:05:50,436 --> 00:05:53,390
102
00:05:53,390 --> 00:05:59,320
It's simply the probability
of a taxi waiting for Al.
103
00:05:59,320 --> 00:06:03,442
The expected value of X-- well,
when B1 happens, X is
104
00:06:03,442 --> 00:06:04,970
going to be exactly
equal to 0.
105
00:06:04,970 --> 00:06:08,740
So the expected value is
also going to be 0.
106
00:06:08,740 --> 00:06:11,600
The probability of B2 happening
is the probability
107
00:06:11,600 --> 00:06:15,050
of a taxi not being there times
the probability of a
108
00:06:15,050 --> 00:06:17,520
taxi arriving between 0 and 5.
109
00:06:17,520 --> 00:06:22,650
It's going to be
1/3 times 1/2.
110
00:06:22,650 --> 00:06:29,420
And the expected value of X
given B2 is going to be the
111
00:06:29,420 --> 00:06:31,780
expected value of
this density.
112
00:06:31,780 --> 00:06:34,173
The expected value of this
density is the midpoint
113
00:06:34,173 --> 00:06:35,770
between 0 and 5.
114
00:06:35,770 --> 00:06:37,670
And so it's going to be 5/2.
115
00:06:37,670 --> 00:06:40,470
116
00:06:40,470 --> 00:06:44,170
And the probability of B3 is
going to be 1/3 times 1/2.
117
00:06:44,170 --> 00:06:48,090
118
00:06:48,090 --> 00:06:51,260
Finally, the expected
value of X given B3.
119
00:06:51,260 --> 00:06:54,400
Well, when B3 happens,
X is going to be
120
00:06:54,400 --> 00:06:57,250
exactly equal to 5.
121
00:06:57,250 --> 00:07:01,810
So the expected value is
also going to be 5.
122
00:07:01,810 --> 00:07:08,820
Now we're left with 5/12
plus 5/6, which
123
00:07:08,820 --> 00:07:11,770
is going to be 15/12.
124
00:07:11,770 --> 00:07:14,526
125
00:07:14,526 --> 00:07:19,290
And we can actually fill that
in here so that we can clear
126
00:07:19,290 --> 00:07:23,650
up the board to do
the other part.
127
00:07:23,650 --> 00:07:28,980
128
00:07:28,980 --> 00:07:36,520
Now we want to compute the CDF
of X. Well, what is the CDF?
129
00:07:36,520 --> 00:07:41,120
Well, the CDF of X is going to
be equal to the probability
130
00:07:41,120 --> 00:07:43,460
that the random variable
X is less than or equal
131
00:07:43,460 --> 00:07:45,235
to some little x.
132
00:07:45,235 --> 00:07:48,650
It's a constant [INAUDIBLE].
133
00:07:48,650 --> 00:07:55,120
Before we jump right in, let's
try to understand what's the
134
00:07:55,120 --> 00:07:57,226
form of the CDF.
135
00:07:57,226 --> 00:08:00,220
And let's consider some
interesting cases.
136
00:08:00,220 --> 00:08:02,790
You know that the random
variable X, the waiting time,
137
00:08:02,790 --> 00:08:06,400
is going to be somewhere
between 0 and 5, right?
138
00:08:06,400 --> 00:08:12,230
So let's consider what happens
if little x is going to be
139
00:08:12,230 --> 00:08:13,690
less than 0.
140
00:08:13,690 --> 00:08:17,410
That's basically saying, what's
the probability of the
141
00:08:17,410 --> 00:08:20,160
random variable X being
less than some number
142
00:08:20,160 --> 00:08:23,010
that's less than 0?
143
00:08:23,010 --> 00:08:27,070
Waiting time can't be negative,
so the probablility
144
00:08:27,070 --> 00:08:31,030
of this is going to be 0.
145
00:08:31,030 --> 00:08:37,400
Now, what if X is between
equaling 0 and
146
00:08:37,400 --> 00:08:38,750
strictly less than 5?
147
00:08:38,750 --> 00:08:41,740
148
00:08:41,740 --> 00:08:47,640
In that case, either X can fall
between 0 and 5 according
149
00:08:47,640 --> 00:08:52,000
to this case, in the case
of B2, or X can be
150
00:08:52,000 --> 00:08:52,760
exactly equal to 0.
151
00:08:52,760 --> 00:08:54,800
It's not clear.
152
00:08:54,800 --> 00:08:57,461
So let's do that later.
153
00:08:57,461 --> 00:08:58,980
Let's fill that in later.
154
00:08:58,980 --> 00:09:05,702
What about if x is greater
than or equal to 5?
155
00:09:05,702 --> 00:09:07,130
Little x, right?
156
00:09:07,130 --> 00:09:10,600
That's the probability that the
random variable X is less
157
00:09:10,600 --> 00:09:14,060
than some number that's bigger
than or equal to 5.
158
00:09:14,060 --> 00:09:17,733
The waiting time X, the random
variable, is definitely going
159
00:09:17,733 --> 00:09:21,812
to be less than or equal to 5,
so the probability of this is
160
00:09:21,812 --> 00:09:23,062
going to be 1.
161
00:09:23,062 --> 00:09:27,130
162
00:09:27,130 --> 00:09:30,160
So now this case.
163
00:09:30,160 --> 00:09:31,720
How do we do it?
164
00:09:31,720 --> 00:09:34,940
Well, let's try to use a similar
kind of approach that
165
00:09:34,940 --> 00:09:39,940
we did for the expected value
and use the total probability
166
00:09:39,940 --> 00:09:41,290
theorem in this case.
167
00:09:41,290 --> 00:09:44,350
So let's try to review this.
168
00:09:44,350 --> 00:09:51,960
First of all, let's assume that
this is true, that little
169
00:09:51,960 --> 00:09:55,500
x is between 0 and
5, including 0.
170
00:09:55,500 --> 00:09:58,230
171
00:09:58,230 --> 00:10:04,900
And let's use the total
probability theorem, and use
172
00:10:04,900 --> 00:10:08,502
the partitions B1, B2, and B3.
173
00:10:08,502 --> 00:10:34,080
174
00:10:34,080 --> 00:10:37,770
So what's the probability
of B1?
175
00:10:37,770 --> 00:10:42,300
It's the probability that Al
catches waiting taxi, which
176
00:10:42,300 --> 00:10:43,890
happens with probability 2/3.
177
00:10:43,890 --> 00:10:46,600
178
00:10:46,600 --> 00:10:50,460
What's the probability that the
random variable X, which
179
00:10:50,460 --> 00:10:55,560
is less than or equal to little
x under this condition,
180
00:10:55,560 --> 00:10:56,220
when B1 happens?
181
00:10:56,220 --> 00:11:00,010
Well, if B1 happens, then random
variable X is going to
182
00:11:00,010 --> 00:11:02,680
be exactly equal to 0, right?
183
00:11:02,680 --> 00:11:06,286
So in that case, it's definitely
going to be less
184
00:11:06,286 --> 00:11:11,630
than or equal to any value
of x, including 0.
185
00:11:11,630 --> 00:11:16,010
So the probability will be 1.
186
00:11:16,010 --> 00:11:21,280
What's the probability
that B2 happens now?
187
00:11:21,280 --> 00:11:24,912
The probability that B2 happens
is 1/3 times 1/2, as
188
00:11:24,912 --> 00:11:26,162
we did before.
189
00:11:26,162 --> 00:11:29,500
190
00:11:29,500 --> 00:11:33,220
And the probability that the
random variable X is less than
191
00:11:33,220 --> 00:11:36,970
or equal to little x
when B2 happens.
192
00:11:36,970 --> 00:11:39,800
Well, if B2 happens, this
is your density.
193
00:11:39,800 --> 00:11:41,430
And this is our condition.
194
00:11:41,430 --> 00:11:42,980
And so x is going to
be somewhere in
195
00:11:42,980 --> 00:11:45,330
between these spots.
196
00:11:45,330 --> 00:11:47,920
And we'd like to compute what's
the probably that
197
00:11:47,920 --> 00:11:51,180
random variable X is less than
or equal to little x.
198
00:11:51,180 --> 00:11:53,470
So we want this area.
199
00:11:53,470 --> 00:11:59,980
And that area is going to have
height of 1/5 and width of x.
200
00:11:59,980 --> 00:12:04,580
And so the area's going
to be 1/5 times x.
201
00:12:04,580 --> 00:12:08,818
And finally, the probability
that B3 happens is going to be
202
00:12:08,818 --> 00:12:15,840
1/3 times 1/2 again times the
probability that the random
203
00:12:15,840 --> 00:12:18,500
variable X is less than or equal
to little x given B3.
204
00:12:18,500 --> 00:12:23,216
Well, when B3 happens, X is
going to be exactly 5 as a
205
00:12:23,216 --> 00:12:24,650
random variable.
206
00:12:24,650 --> 00:12:28,440
But little x, you know-- we're
assuming in this condition--
207
00:12:28,440 --> 00:12:32,920
is going to be between 0 and 5,
but strictly less than 5.
208
00:12:32,920 --> 00:12:38,220
So there's no way that if the
random variable X is 5 and
209
00:12:38,220 --> 00:12:40,410
this is strictly less than 5,
this is going to be true.
210
00:12:40,410 --> 00:12:43,380
And so that probability
will be 0.
211
00:12:43,380 --> 00:12:48,455
So we're now left with
2/3 plus 1/30.
212
00:12:48,455 --> 00:12:53,090
213
00:12:53,090 --> 00:12:56,470
And now we can fill this in.
214
00:12:56,470 --> 00:12:59,730
2/3 plus 1/30 x.
215
00:12:59,730 --> 00:13:02,260
216
00:13:02,260 --> 00:13:07,910
And this is our CDF.
217
00:13:07,910 --> 00:13:13,370
So now we've finished the
problem, computed the expected
218
00:13:13,370 --> 00:13:18,880
value here and then the CDF
here, and this was a great
219
00:13:18,880 --> 00:13:22,040
illustration of how you
would do so for a
220
00:13:22,040 --> 00:13:23,290
mixed random variable.
221
00:13:23,290 --> 00:13:24,190