2

The cdf of a random variable $X$ is given by the following.

\[ F_X(x) = \begin{cases} 0 & x < 0\\\\ \frac x2 & x \in [0,1)\\\\ \frac 23 & x \in [1,2)\\\\ \frac{11}{12} & x \in [2,3) \\\\ 1 & x \ge 3 \end{cases} \] How do I calculate the expectation of the random variable $X$?

Brian M. Scott
  • 616,228

3 Answers3

6

$$\int_0^\infty (1 - F(x))\ dx$$

Robert Israel
  • 448,999
  • Would you elaborate? How should I integrate since F(x) can take many different forms depending on x. – idealistikz Sep 24 '12 at 20:52
  • @idealistikz just break it down into 3 parts, depending on the interval, and the integral over the whoel thing is the sum of the intergals over individual parts. – gt6989b Sep 24 '12 at 20:59
  • Why do I break it into 3 parts when there are 5 conditions? Do you mean 5 parts? – idealistikz Sep 24 '12 at 21:03
  • @idealistikz: Because the integral over the last part is clearly $0$, and the first part is irrelevant: the probability there is $0$. – Brian M. Scott Sep 24 '12 at 21:09
  • Why is the integral over the last part 0? When x>=3, isn't the integral for that part x? – idealistikz Sep 24 '12 at 21:12
  • @idealistikz: $1-F_X(x)=1-1=0$ for $x\ge 3$. – Brian M. Scott Sep 24 '12 at 21:25
  • This works only because the random variable is everywhere nonnegative. Maybe there's something to be said for an answer that works more generally. – Michael Hardy Sep 24 '12 at 21:31
  • @MichaelHardy: true. More generally, $\int_0^\infty (1-F(x))\ dx - \int_{-\infty}^0 F(x)\ dx$ – Robert Israel Sep 24 '12 at 22:07
  • The formula used here for the expectation of a nonnegative random variable has come up on this site many times for a variety of different problems. Someone must like to pick problems that exploit that formula for homework. – Michael R. Chernick Sep 24 '12 at 23:06
  • @BrianM.Scott, since the limit begins at 3, shouldn't I consider it because it doesn't cancel out? – idealistikz Sep 25 '12 at 06:39
  • @idealistikz: What doesn’t cancel out? $\int_3^\infty(1-1)dx=0$. – Brian M. Scott Sep 25 '12 at 06:45
  • I was under the impression I calculate the integral of each interval separately, add them together, and subtract the total from the integral of 1 from 0 to infinity. Rather, am I supposed calculate the integral of 1-F(x) at each interval and sum the total? – idealistikz Sep 25 '12 at 07:01
2

You can come up with a piecewise defined density function by differentiating, but that fails to account for the jump discontinuities at $x=1$, $x=2$, and $x=3$. You get $$ f(x) = 1/2\text{ if }1<x<2\text{ and }f(x)=0\text{ elsewhere}. $$ Calling the random variable (capital) $X$, we then have $$ \begin{cases} \Pr(X\in A) = \int_A \frac12\ dx & \text{if }A\subseteq[0,1), \\[8pt] \Pr(X=1) = 1/6, \\[8pt] \Pr(X=2) = 1/4, \\[8pt] \Pr(X=3) = 1/12. \end{cases} $$ The expected value is then $$ \int_0^1 x\frac12\, dx + 1\cdot\frac16 + 2\cdot\frac14+3\cdot\frac{1}{12}. $$ This is somewhat pedestrian, but it has this advantage over Robert Israel's answer: the method still works even for random variables that can be negative.

2

There is another, definitely less good way, to find the expectation. Let us analyze the distribution of the random variable $X$. The part before $0$ is harmless.

For $0\le x\lt 1$, the cumulative distribution function is $x/2$, nice and familiar, the density function is the derivative of the the cdf, which is $1/2$.

At $1$, and all the way up to but not including $2$, the cdf is $2/3$. So there is a sudden jump at $x=1$. As we approach $1$ from the left, the cdf approaches $1/2$, but all of a sudden it is $2/3$ at $1$, and then stays at that all the way to, but not including $2$. What that means is that there is a discrete "weight" of $2/3-1/2$ at $x=1$: $\Pr(X=1)=2/3-1/2=1/6$.

The cdf takes another sudden jump to $11/12$ at $2$. That means we have a weight of $11/12-2/3$, that is, $3/12$, at $x=2$.

Finally, there is another weight of $1/12$ at $x=3$.

To sum up, this is a mixed continuous-discrete situation: there is a continuous uniform distribution, density $1/2$, between $0$ and $1$. In addition, $\Pr(X=1)=1/6$, $\Pr(X=2)=3/12$, and $\Pr(X=3)=1/12$. The moment about the origin (mean) is therefore $$\int_0^1 x\cdot\frac{1}{2}\,dx+ 1\cdot\frac{1}{6}+2\cdot \frac{3}{12}+3\cdot \frac{1}{12}.$$

I think this simplifies to $\dfrac{7}{6}$. You might want to compare that with the result you get from doing it the full integration way. The latter approach is the one you should become comfortable with.

André Nicolas
  • 507,029