## 4.1.4 Solved Problems: Continuous Random Variables

Problem

Let $X$ be a random variable with PDF given by $$\nonumber f_X(x) = \left\{ \begin{array}{l l} cx^2& \quad |x| \leq 1\\ 0 & \quad \text{otherwise} \end{array} \right.$$

1. Find the constant $c$.
2. Find $EX$ and Var$(X)$.
3. Find $P(X \geq \frac{1}{2})$.

• Solution
1. To find $c$, we can use $\int_{-\infty}^{\infty} f_X(u)du=1$:  $1$ $=\int_{-\infty}^{\infty} f_X(u)du$ $= \int_{-1}^{1} cu^2du$ $= \frac{2}{3} c.$

Thus, we must have $c=\frac{3}{2}$.
2. To find $EX$, we can write  $EX$ $= \int_{-1}^{1} u f_X(u)du$ $= \frac{3}{2}\int_{-1}^{1} u^3 du$ $=0.$

In fact, we could have guessed $EX=0$ because the PDF is symmetric around $x=0$. To find Var$(X)$, we have  $\textrm{Var}(X)$ $=EX^2-(EX)^2=EX^2$ $= \int_{-1}^{1} u^2 f_X(u)du$ $= \frac{3}{2}\int_{-1}^{1} u^4 du$ $=\frac{3}{5}.$

3. To find $P(X \geq \frac{1}{2})$, we can write $$P(X \geq \frac{1}{2})=\frac{3}{2} \int_{\frac{1}{2}}^{1} x^2dx=\frac{7}{16}.$$

Problem

Let $X$ be a continuous random variable with PDF given by $$f_X(x)=\frac{1}{2}e^{-|x|}, \hspace{20pt} \textrm{for all }x \in \mathbb{R}.$$ If $Y=X^2$, find the CDF of $Y$.

• Solution
• First, we note that $R_Y=[0,\infty)$. For $y \in [0,\infty)$, we have

 $F_Y(y)$ $=P(Y \leq y)$ $=P(X^2 \leq y)$ $=P(-\sqrt{y} \leq X \leq \sqrt{y})$ $=\int_{-\sqrt{y}}^{\sqrt{y}} \frac{1}{2}e^{-|x|} dx$ $=\int_{0}^{\sqrt{y}} e^{-x} dx$ $=1-e^{-\sqrt{y}}.$

Thus, $$\nonumber F_Y(y) = \left\{ \begin{array}{l l} 1-e^{-\sqrt{y}} & \quad y \geq 0\\ 0 & \quad \text{otherwise} \end{array} \right.$$

Problem

Let $X$ be a continuous random variable with PDF $$\nonumber f_X(x) = \left\{ \begin{array}{l l} 4x^3 & \quad 0 < x \leq 1\\ 0 & \quad \text{otherwise} \end{array} \right.$$ Find $P(X \leq \frac{2}{3} | X> \frac{1}{3})$.

• Solution
• We have

 $P(X \leq \frac{2}{3} | X > \frac{1}{3})$ $=\frac{P(\frac{1}{3} < X \leq \frac{2}{3})}{P(X > \frac{1}{3})}$ $=\frac{\int_{\frac{1}{3}}^{\frac{2}{3}} 4x^3 dx}{\int_{\frac{1}{3}}^{1} 4x^3 dx}$ $=\frac{3}{16}.$

Problem

Let $X$ be a continuous random variable with PDF $$\nonumber f_X(x) = \left\{ \begin{array}{l l} x^2\left(2x+\frac{3}{2}\right) & \quad 0 < x \leq 1\\ 0 & \quad \text{otherwise} \end{array} \right.$$ If $Y=\frac{2}{X}+3$, find Var$(Y)$.

• Solution
• First, note that $$\textrm{Var}(Y)=\textrm{Var}\left(\frac{2}{X}+3\right)=4\textrm{Var}\left(\frac{1}{X}\right), \hspace{15pt} \textrm{using Equation 4.4}$$ Thus, it suffices to find Var$(\frac{1}{X})=E[\frac{1}{X^2}]-(E[\frac{1}{X}])^2$. Using LOTUS, we have $$E\left[\frac{1}{X}\right]=\int_{0}^{1} x\left(2x+\frac{3}{2}\right) dx =\frac{17}{12}$$ $$E\left[\frac{1}{X^2}\right]=\int_{0}^{1} \left(2x+\frac{3}{2}\right) dx =\frac{5}{2}.$$ Thus, Var$\left(\frac{1}{X}\right)=E[\frac{1}{X^2}]-(E[\frac{1}{X}])^2=\frac{71}{144}$. So, we obtain $$\textrm{Var}(Y)=4\textrm{Var}\left(\frac{1}{X}\right)=\frac{71}{36}.$$

Problem

Let $X$ be a positive continuous random variable. Prove that $EX=\int_{0}^{\infty} P(X \geq x) dx$.

• Solution
• We have $$P(X \geq x)=\int_{x}^{\infty}f_X(t)dt.$$ Thus, we need to show that $$\int_{0}^{\infty} \int_{x}^{\infty}f_X(t)dtdx=EX.$$ The left hand side is a double integral. In particular, it is the integral of $f_X(t)$ over the shaded region in Figure 4.4.

We can take the integral with respect to $x$ or $t$. Thus, we can write  $\int_{0}^{\infty} \int_{x}^{\infty}f_X(t)dtdx$ $=\int_{0}^{\infty} \int_{0}^{t}f_X(t)dx dt$ $=\int_{0}^{\infty} f_X(t) \left(\int_{0}^{t} 1 dx \right) dt$ $=\int_{0}^{\infty} tf_X(t) dt=EX \hspace{20pt} \textrm{since$X$is a positive random variable}.$

Problem

Let $X \sim Uniform(-\frac{\pi}{2},\pi)$ and $Y=\sin(X)$. Find $f_Y(y)$.

• Solution
• Here $Y=g(X)$, where $g$ is a differentiable function. Although $g$ is not monotone, it can be divided to a finite number of regions in which it is monotone. Thus, we can use Equation 4.6. We note that since $R_X=[-\frac{\pi}{2},\pi]$, $R_Y=[-1,1]$. By looking at the plot of $g(x)=\sin(x)$ over $[-\frac{\pi}{2},\pi]$, we notice that for $y \in (0,1)$ there are two solutions to $y=g(x)$, while for $y \in (-1,0)$, there is only one solution. In particular, if $y \in (0,1)$, we have two solutions: $x_1=\arcsin(y)$, and $x_2=\pi-\arcsin(y)$. If $y \in (-1,0)$ we have one solution, $x_1=\arcsin(y)$. Thus, for $y \in(-1,0)$, we have

 $f_Y(y)$ $= \frac{f_X(x_1)}{|g'(x_1)|}$ $= \frac{f_X(\arcsin(y))}{|\cos(\arcsin(y))|}$ $= \frac{\frac{2}{3 \pi}}{\sqrt{1-y^2}}.$

For $y \in(0,1)$, we have  $f_Y(y)$ $= \frac{f_X(x_1)}{|g'(x_1)|}+\frac{f_X(x_2)}{|g'(x_2)|}$ $= \frac{f_X(\arcsin(y))}{|\cos(\arcsin(y))|}+\frac{f_X(\pi-\arcsin(y))}{|\cos(\pi-\arcsin(y))|}$ $= \frac{\frac{2}{3 \pi}}{\sqrt{1-y^2}}+\frac{\frac{2}{3 \pi}}{\sqrt{1-y^2}}$ $= \frac{4}{3 \pi \sqrt{1-y^2}}.$

To summarize, we can write $$\nonumber f_Y(y) = \left\{ \begin{array}{l l} \frac{2}{3 \pi \sqrt{1-y^2}} & \quad -1 < y < 0\\ \frac{4}{3 \pi \sqrt{1-y^2}} & \quad 0 < y < 1\\ 0 & \quad \text{otherwise} \end{array} \right.$$

The print version of the book is available through Amazon here.