# How to find the cumulative distribution function and the expected value of a random variable.

I've seen a lot of questions about cumulative distribution function (CDF) when you already have the PDF, but I was wondering how you find it when you're not given the PDF?

E.g., Let $X:([0,1], \mathcal{B}([0,1]) \to \Bbb{R}$ be a random variable, and let $\mathbb{P} = \lambda$, where $\lambda$ is the lebesgue measure ($\lambda([a,b]) = b-a$.

$X$ is defined by: $$X(\omega) = \begin{cases} 2\omega,\text{ if \omega \in [0,1/2)}\\ 1, \text{ if \omega \in [1/2,1]} \end{cases}$$ By eye, I think the CDF is given by $$F_X(x) = \begin{cases} 0,\text{if x<0}\\ \frac{1}{2}x, \text{ if x \in [0,1)}\\ 1, \text{ if x\geq 1} \end{cases}$$

However, I don't know any standard technique to find it and I was hoping someone could point me to a source which explains how to find this.

Once I have the CDF, I want to use this to find $\mathbb{E}[X]$. I know $\mathbb{E}[X] = \int_{[0,1]} X(\omega)d\mathbb{P}(\omega) = \int_\mathbb{R}xdF_X(x)$.

Clearly, $$dF_X(x) = \begin{cases} 1/2dx,\text{ if x\in[0,1)}\\ 0dx, \text{ otherwise} \end{cases}$$

So using the above formula, I would get: $$\mathbb{E}[X] = \int_\mathbb{R}xdF_X(x) = \int_0^1x\frac{1}{2} dx = 1/4$$

But this seems wrong, because isn't this the expectation value we'd get if $X$ was uniformuly distributed between 0 and 1/2, and didn't include the extra part between 1/2 and 1?

Please let me know if I've misunderstood how to calculate CDFs or expected values, and if possible give me a constructive way to find them in general situations. Thanks!

• You have a point mass at $x=1$, where you lost it when you differentiate $F$. – Atbey Mar 20 '18 at 23:18
• Ohhh, thanks! Is there a rigorous way of including it, or do I just say, including the point mass at x =1 with probability 1/2? – user428487 Mar 20 '18 at 23:35
• Sure there is, use the definition: $E[X] = \int XdP$. – Atbey Mar 20 '18 at 23:48
• İf you want to use $F$, note that $E[X] = \int_0^{\infty} P(X\geq t) dt$ – Atbey Mar 20 '18 at 23:51

## 1 Answer

$X(\omega) = 2\omega\mathbf 1_{\omega\in[0;1/2)}+\mathbf 1_{\omega\in[1/2;1)}$

$\mathsf P\{\omega:X(\omega)\leq x\} ~{= \lambda[0;x/2)\mathbf 1_{x\in[0;1)}+\mathbf 1_{x\in[1;\infty)} \\[1ex] =\begin{cases}0&:& x < 0\\ x/2 &:& x\in[0;1)\\ 1&:& x\in[1;\infty)\end{cases}}$

Either include the point mass from the step discontinuity

$$\mathsf E(X)=\int_0^1 x\tfrac {\partial x^2/2}{\partial x}\mathsf d x+1/2 = 3/4$$

Or use the alternative definition:

$$\mathsf E(X) = \int_0^1 \mathsf P(X>x)\mathsf d x =\int_0^1(1-x/2)\mathsf d x={[x-x^2/4]}_{x=0}^{x=1}=3/4$$