# Cumulative Distribution Function calculation

I've got a question here that I've been working and I've ran into some difficulty.

"Let X be a mixed random variable with distribution function:

F(x) = 0 if x < 0

   cx + 1/4 if 0 <= x < 1 (c is some constant)

1/3  if 1 <= x <2

1    if x >= 2


As for my notation above, I'm unfamiliar with LaTex, but what I'm trying to show you is a piecewise function. Here <= means "less than or equal to".

Now the question asks to find the value of c, given the expected value is 1. Here is what I have done:

First, find the values of the probabilities at 0,1 and 2

Using limits, we find P(X=0) is 1/4. Similiarly, we find P(X=1) is 1/12 -c (here I subtracted c+1/4 from 1/3, using the idea of limits again)

Finally, we find P(X=2) is 1- 1/3 = 2/3.

Now, use these values to calculate the expected value:

Here is where the confusion arises. First, I split the E[X] into three components:

1) the definite integral of d/dx [(cx + 1/4)times x] between 0 and 1

2) 1/12 - c times 1

3) 2 times 2/3

Now, I add these all up and equate:

c/2 +4/3 +1/12 -c = 1,

hence solving c = 5/6, however this leads to a negative probability for P(X=1), as 1/12 - 5/6 is less than zero.

Where have I gone wrong in my above calculations? I think it's to do with my expected value calculation.

-
Just to clarify, the values inside the grey box are also piecewise values of F(x), even though that's probably evident! –  user64219 May 16 '12 at 21:50

Your calculations are all correct. Even with somewhat less work than you did, one can see that it is impossible for the mean to be $1$. Our random variable is non-negative, and is equal to $2$ with probability $2/3$, so has it has mean at least $4/3$. Presumably there is a typo in the description of the cumulative distribution function.

-
Ah right, that would explain it. Thanks! –  user64219 May 16 '12 at 22:06
@Dilip Glad to have given you the proper +1 for your answer. Thanks for reversing your vote which in retrospect I think wasn't necessary because the downvote was justified for the original post. –  Michael Chernick May 17 '12 at 14:01

Problems involving mixed random variables are sometimes easier to solve using an alternative definition of the expected value. For a nonnegative random variable, which is what you have, this alternative definition is

$$E[X] = \int_0^{\infty} [1 - F(x)]\,\mathrm dx$$ where the square brackets should not be removed and the integral on the right expressed as the difference of two integrals from $0$ to $\infty$. For your CDF, you can write $$E[X] = \int_0^1 \left[\frac{3}{4} - cx \right]\,\mathrm dx + \int_1^2 \frac{2}{3}\,\mathrm dx + \int_0^{\infty} 0 \,\mathrm dx$$ So, compute the value of the integrals which will give you a function $g(c)$ of $c$, set $E[X] = g(c) = 1$, and solve for $c$.

Edit: Ooops, as André's answer shows, you will get a nonsensical answer if you follow the above procedure for your CDF, but the idea will work for a correctly formulated problem.

-
That should be useful, thank you. I'm just trying to relate it to the method I tried above. Here do you mean F(x) as in the cumulative distribution function? (As opposed to f(x) the density function, which I used). –  user64219 May 16 '12 at 22:20
Yes, $F(x)$ is the cumulative distribution function. See also this question for more details about this alternative definition of expected value. –  Dilip Sarwate May 16 '12 at 22:26