Consider the following cumulative distribution function of a random variable X:
F\left(x\right) = \left\{\begin{matrix} 0 \quad\quad\quad if x \lt 2\\ -\frac{1}{4}x^{2}+2x-3 if 2 \leq x \leq 4\\ 1 \quad\quad\quad if x \gt 4.\end{matrix} \right.
(a) What is the PDF of X?
(b) Calculate P(X < 3) and P(X = 4).
(c) Determine E(X) and Var(X).
(a) The first derivative of the CDF yields the PDF, F^{\prime }(x) = f (x):
f\left(x\right) = \left\{\begin{matrix} 0 \quad\quad if x \lt 2\\ -\frac{1}{2}x+2 \quad if 2 \leq x \leq 4\\ 0 \quad\quad if x \gt 4.\end{matrix} \right.
(b) We know from Theorem 7.2.3 that for any continuous variable P(X = x_{0}) = 0 and therefore P(X = 4) = 0. We calculate P(X < 3) = P(X ≤ 3) − P(X = 3) = F(3) − 0 = −\frac{9}{4}+ 6 − 3 = 0.75.
(c) Using (7.15), we obtain the expectation as
E\left(X\right)=\int_{-\infty }^{+\infty }{x f\left(x\right)dx }. (7.15)
E\left(X\right)=\int_{-\infty }^{\infty }{x f\left(x\right)dx } =\int_{-\infty }^{2}{x0 dx} +\int_{2}^{4}{x\left(-\frac{1}{2}x+2 \right)dx } +\int_{4}^{\infty }{x0 dx}
=0+\int_{2}^{4}{\left(-\frac{1}{2}x^{2}+2x \right) dx} +0
=\left[-\frac{1}{6}x^{3} +x^{2}\right] ^{4}_{2} =\left(-\frac{64}{6} +16\right) -\left(-\frac{8}{6}+4 \right) =\frac{8}{3} .
Given that we have already calculated E(X), we can use Theorem 7.3.1 to calculate the variance as Var(X) = E(X²) − [E(X)]². The expectation of X² is
E(X²)= \int_{2}^{4}{x^{2}\left(-\frac{1}{2}x+2 \right) dx} = \int_{2}^{4}{\left(-\frac{1}{2}x^{3}+2 x^{2} \right) dx}
=\left[-\frac{1}{8}x^{4} +\frac{2}{3}x^{3}\right] ^{4}_{2} =\left(-32+\frac{128}{3}\right) -\left(-2+\frac{16}{3}\right) =\frac{22}{3} .
We thus obtain Var(X) = \frac{22}{3}- \left(\frac{8}{3}\right)^{2}= \frac{66-64}{9}=\frac{2}{9}.