# Thread: An Expected Value Problem

1. ## An Expected Value Problem

A point is chosen uniformly at random from a unit square. Let D be the distance of the point from the midpoint of one side of the square. Find E(D^2).

I'm having trouble finding either P(D = x) or P(D >= x). Up to D = 1/2, the geometry is straightforward, but for values higher than that, I'm having trouble. I think if I can find those probabilities I can find the expected value using the integral definitions for the expected value of the second moment.

However, maybe there is a way of doing it that I don't see.

Any help is greatly appreciated.

2. Originally Posted by KrisRS
A point is chosen uniformly at random from a unit square. Let D be the distance of the point from the midpoint of one side of the square. Mr F says: Which side?

Find E(D^2).

I'm having trouble finding either P(D = x) or P(D >= x). Up to D = 1/2, the geometry is straightforward, but for values higher than that, I'm having trouble. I think if I can find those probabilities I can find the expected value using the integral definitions for the expected value of the second moment.

However, maybe there is a way of doing it that I don't see.

Any help is greatly appreciated.
The square of the distance from the midpoint of the side joining (0, 0) and (1, 0) is $D^2 = x^2 - x + \frac{1}{4} + y^2$ so your job is to find $E\left(X^2 - X + \frac{1}{4} + Y^2 \right) = E\left(X^2 \right) - E(X) + \frac{1}{4} + E\left(Y^2 \right)$.

The required calculations are simple since X ~ U(0, 1) and Y ~ U(0, 1).

3. ## Thanks!

I don't know why I didn't see that earlier--this works out very well. For some reason when I saw D^2 I was only thinking about the areas of circles emanating from the midpoint. This strategy makes a lot more sense.

Also, the expected value ends up being the same regardless of which midpoint is used.