Calculate Definite Integral in X to expression in X

definite integralsintegration

Let X be a continuous random variable with probability density function (PDF)

$$ f_X(x) = \begin{cases}
cx^2+|x|, & -1/2 < x < 1/2 \\
0, & otherwise
\end{cases} $$

  1. Determine the value of the c constant.
  2. Obtain the cumulative distribution function (CDF) of X.

Solution

  1. Having to be
    $$ \int_{-\infty}^{\infty} f(x) \, \mathrm{d}x = 1, $$
    it is
    $$1=\int_{-1/2}^{1/2} f(x) \, \mathrm{d}x=\int_{-1/2}^{1/2} cx^2+|x| \, \mathrm{d}x=c\int_{-1/2}^{1/2}x^2\, \mathrm{d}x+\int_{-1/2}^{1/2}|x| \, \mathrm{d}x$$

By integrating it, we get:

$$1=c\left[\frac{x^3}{3}\right]_{-1/2}^{1/2}+\left[\frac{x|x|}{2}\right]_{-1/2}^{1/2}=c\left[\frac{(\frac{1}{2})^3-(-\frac{1}{2})^3}{3}\right]+\left[\frac{\frac{1}{2}|\frac{1}{2}|-(-\frac{1}{2}|-\frac{1}{2}|)}{2}\right]=$$
$$=c\frac{\frac{1}{8}+\frac{1}{8}}{3}+\frac{\frac{1}{4}+\frac{1}{4}}{2}=c\frac{2}{8}\times\frac{1}{3}+\frac{2}{4}\times\frac{1}{2}=\frac{c}{12}+\frac{1}{4}$$

So we can conclude that:

$$c=12\times\left(1-\frac{1}{4}\right)=12\times\left(\frac{3}{4}\right)=3\times3=9$$
that matches with the solution provided by the book.

  1. Now, for this step the book provides the following solution:
    enter image description here
    Probably here the integral of |x| has been splitted into 2 integrals (positive and negative numbers), however I'm not getting how it is possible to turn a definite integral with x variables to an expression of x variables, by passing from another integral by substituting y=x.

By integrating
$$9\int_{-1/2}^{1/2}x^2\, \mathrm{d}x+\int_{-1/2}^{1/2}|x| \, \mathrm{d}x$$

I would get only a number.

How do I turn this integral to an expression in x variables?

Best Answer

The CDF $F_X(x)$ of a random variable $X$ is the probability that $X$ takes values smaller than $x$, so $$ F_X(x)=\int_{-\infty}^x f_X(x')\mathrm{d}x'\ . $$ Everything boils down to computing the following integral: $$ F_X(x)=\int_{-\infty}^x \mathrm{d}x'(9x'^2+|x'|)\mathbb{1}_{-1/2\leq x'\leq 1/2}. $$ Clearly, this is a function of $x$, not just a number!

To compute the integral, we first observe that, if $x<-1/2$ the integral is zero (because the integrand is zero), and if $x>1/2$ the integral is identical to $\int_{-1/2}^{1/2} \mathrm{d}x'(9x'^2+|x'|)$ and thus is $=1$ by normalization.

Since the integrand is zero if $x'<-1/2$, we can truncate the range of integration as follows: $$ F_X(x)=\int_{-1/2}^x \mathrm{d}x'(9x'^2+|x'|)\mathbb{1}_{x'\leq 1/2}. $$

Now, it is convenient to consider the cases $-1/2<x<0$ and $0<x<1/2$ separately. If $-1/2<x<0$, you are integrating the function $9x'^2+|x'|$ over a negative range, which means that $|x'|= -x'$, and your integral is $$ F_X(x)=\int_{-1/2}^x \mathrm{d}x'(9x'^2-x')=9x'^3/3-x'^2/2\Big|_{-1/2}^x =9x^3/3-x^2/2-\frac{9}{3}(-1/2)^3+\frac{1}{2}(-1/2)^2= $$ $$ 3 x^3-\frac{x^2}{2}+\frac{1}{2}\ , $$ which coincides with the result given.

If $0<x<1/2$ instead, one needs to be more careful, because the function is now integrated over both a negative and positive range, therefore it is convenient to split the integration range $(-1/2,x)$ into $(-1/2,0)$ and $(0,x)$ - the difference between the two resulting integrals being that the absolute value $|x'|$ is equal to $-x'$ in the first case, and $x'$ in the second case.