Hi.
In this problem, we'll get a chance to see the usefulness
of conditioning in helping us to calculate quantities that
would otherwise be difficult to calculate.
Specifically, we'll be using the law of iterated
expectations and the law of total variance.
Before we get started, let's just take a quick moment to
interpret what these two laws are saying.
Really, what it's saying is, in order to calculate the
expectation or the variance of some random variable x, if
that's difficult to do, we'll instead attack
this problem in stages.
So the first stage is, we'll condition on some related
random variable, y.
And the hope is that by conditioning on this and
reducing it to this conditional universe, the
expectation of x will be easier to calculate.
Now, recall that this conditional expectation is
really a random variable, which is a function of the
random variable y.
So what we've done is we first average out x given some y.
What remains is some new random variable, which is a
function of y.
And now, what we have is randomness in y, which will
then average out again to get the final expectation of x.
OK, so in this problem, we'll actually see an example of how
this plays out.
One more thing before we get started that's useful to
recall is if y is a uniform random variable, distributed
between a and b, then the variance of y is b minus a
squared over 12, and the expectation of y is just a
midpoint, a plus b over 2.
All right, so let's get started on the problem.
So what we have is we have a stick of some fixed length, l,
and what we do is we break it uniformly at random.
So what we do is we choose a point uniformly at random
along this stick.
And we break it there, and then we keep the left portion
of that stick.
So let's call the length of this left portion after the
first break random variable y.
So it's random because the point where
we break it is random.
And then what we do is we repeat this process.
We'll take this left side of the stick that's left.
And we'll pick another point, uniformly at random, along
this left remaining side.
And we'll break it again, and keep the left
side of that break.
And we'll call that the length of the final remaining piece,
x, which again is random.
The problem is really asking us to calculate the
expectation of variance of x.
So at first, it seems difficult to do, because the
expectation and variance of x depends on where you break it
the second time and also where you break it the first time.
So let's see if conditioning can help us here.
So the first thing that we'll notice is that, if we just
consider y, the length of the stick after the first break,
it's actually pretty easy to calculate the expectation and
variance of y.
Because y, when you think about it, is actually just the
simple uniform in a variable, uniformly distributed between
0 and l, the length of the stick.
And this is because we're told that we choose the point of
the break uniformly at random between 0 and l.
And so wherever we choose it, that's going to be the length
of the left side of the stick.
And so because of this, we know that the expectation of y
is just l/2, and the variance of y is l squared over 12.
But unfortunately, calculating the expectation variance of x
is not quite as simple, because x isn't just uniformly
distributed between 0 and some fixed number.
Because it's actually uniformly distributed between
0 and y, wherever the first break was.
But where the first break is is random too.
And so we can't just say that x is a uniformly distributed
random variable.
So what do we do instead?
Well, we'll make the nice observation that let's pretend
that we actually know what y is.
If we knew what y was, then calculating the expectation of
x would be simple, right?
So if we were given that y is just some little y, then x
would in fact just be uniformly distributed between
0 and little y.
And then if that's the case, then our calculation is
simple, because the expectation of x would just be
y/2, and the variance would just be y squared over 12.
All right, so let's make that a little bit more formal.
What we're saying is that the expectation of x, If we knew
what y was, would just be y/2.
And the variance of x If we knew what y was would just be
y squared over 12.
All right, so notice what we've done.
We've taken the second stage and we've said, let's pretend
we know what happens in the first stage where we break it.
And we know what y, the first break, was.
Then the second stage becomes simple, because the average of
x is just going to be the midpoint.
Now what we do to calculate the actual expectation of x,
well, we'll invoke the law of iterated expectations.
So expectation of x is expectation of the conditional
expectation of x given 1, which in this case is just
expectation of y/2.
And we know what the expectation of y is.
It's l/2.
And so this is just l/4.
l/4.
All right, and so notice what we've done.
We've taken this calculation and done it in stages.
So we assume we know where the first break is.
Given that, the average location of the second break
becomes simple.
It's just in the midpoint.
And then, we move up to the higher stage.
And that now we average out over where the first break
could have been.
And that gives us our final answer.
And notice that this actually makes sense, if we just think
about it intuitively, because on average, the first break
will be somewhere in the middle.
And then that will leave us with half the stick left, and
we break it again.
On average, that will leave us with another half.
So on average, you get a quarter of the original stick
left, which makes sense.
All right, so that's the first part, where we use the law of
iterated expectations.
Now, let's go to part B, where we're actually asked to find
the variance.
The variance is given by the law of total variance.
So let's do it in stages.
We'll first calculate the first term, the expectation of
the conditional variance.
Well, what is the expectation of the conditional variance?
We've already calculated out what this
conditional variance is.
The conditional variance is y squared over 12.
So let's just plug that in.
It's expectation of y squared over 12.
All right, now this looks like it could be a little difficult
to calculate.
But let's just first pull out the 1/12.
And then remember, one way to calculate the expectation of
the square of a random variable
is to use the variance.
So recall that the variance of any random variable is just
expectation of the square minus the square of the
expectation.
So if we want to calculate the expectation of the square, we
can just take the variance and add the square of the
expectation.
So this actually we can get pretty easily.
It's actually just the variance of y plus the square
of the expectation of y.
And we know what these two terms are.
The variance of y is l squared over 12.
And the expectation of y is l/2.
So when you square that, you get l squared over 4.
So l squared over 12 plus l squared over 4 gives you l
squared over 3.
And you get that the first term is l squared over 36.
All right, now let's calculate the second term.
Second term is the variance of the conditional expectation.
So the variance of expectation of x given y.
Well, what is the expectation of x given y?
We've already calculated that.
That's y/2.
So what we really want is the variance of y/2.
And remember, when you have a constant inside the variance,
you pull it out but you square it.
So what you get is 1/4 the variance of y, which we know
that the variance of y is l squared over 12.
So we get that this is l squared over 48.
OK, so we've calculated both terms of
this conditional variance.
So all we need to do to find the final answer
is just to add them.
So it's l squared over 36 plus l squared over 48.
And so, the final answer is 7 l squared over 144.
OK, and so this is the first, the expectation of x, maybe
you could have guessed intuitively.
But the variance of x is not something that looks like
something that you could have calculated off
the top of your head.
And so I guess the lesson from this example is that it is
often very helpful if you condition on some things,
because it allows you to calculate things in stages and
build up from the bottom.
But it's important to note that the choice of what you
condition on-- so the choice of y-- is actually very
important, because you could choose lots of other y's that
wouldn't actually help you at all.
And so how to actually choose this y is something that you
can learn based on just having practiced with
these kinds of problems.
So again, the overall lesson is, conditioning can often
help when you calculate these problems.
And so you should look to see if that could
be a possible solution.
So I hope that was helpful, and see you next time.