# Finding the CDF given a PDF

Let $\alpha$, $\beta$ be two fixed positive constants, and define the density (pdf) $$f(x) = \begin{cases} \frac{\alpha}{2}e^{\alpha x} & \text{if} x<0\\ \frac{\beta}{2}e^{-\beta x} & \text{if} x\geq 0 \end{cases}$$ Find the cumulative distribution function (cdf) of $X$.

I am blanking on how to do this again I haven't taken a probability theory course for about 5 years now I thought we just integrate for the two different condtions to get the cdf so essentially I would do

$$\int_{-\infty}^{0}f(x) \ \ \ \text{for} \ \ x < 0$$ and $$\int_{0}^{\infty}f(x) \ \ \ \text{for} \ \ x \geq 0$$

If someone could just provide a detailed solution I would greatly appreciate it.

• It's enough to integrate on $( -\infty, t)$ for various $t$. – Sean Roberson Oct 3 '16 at 2:40
• @SeanRoberson could you provide a solution for this I am not sure if I know what you mean – Wolfy Oct 3 '16 at 2:42
• I'll do so once I return home, provided nobody else has. – Sean Roberson Oct 3 '16 at 2:44
• Remember that $$\int_a^b f(x) \, dx = \int_a^c f(x) \, dx + \int_c^b f(x) \, dx$$ so just "insert" $c=0$ when necessary. – Jeppe Stig Nielsen Oct 3 '16 at 7:27

The CDF $F$ is defined by $$F(x) = \int_{-\infty}^{x}f(t)\text{ d}t$$ for every $x$. As long as $x < 0$, $$F(x) = \int_{-\infty}^{x}f(t)\text{ d}t = \int_{-\infty}^{x}\dfrac{\alpha}{2}e^{\alpha t}\text{ d}t\text{.}$$ For $x \geq 0$, $$F(x) = \int_{-\infty}^{x}f(t)\text{ d}t = \int_{-\infty}^{0}\dfrac{\alpha}{2}e^{\alpha t}\text{ d}t + \int_{0}^{x}\dfrac{\beta}{2}e^{-\beta t}\text{ d}t\text{.}$$ I will leave the integration up to you.
$$F_X(x)=\int_{-\infty}^{x}f_X(t)dt= 1_{\{x<0\}}\int_{-\infty}^{x}\frac{\alpha}{2}e^{\alpha t}dt+1_{\{x\ge0\}}\left(\int_{-\infty}^{0}\frac{\alpha}{2}e^{\alpha t}dt+\int_{0}^{x}\frac{\beta}{2}e^{-\beta t}dt\right)= 1_{\{x<0\}}\frac{1}{2}e^{\alpha x} +1_{\{x\ge0\}}\left(\frac{1}{2}+\frac{1}{2}-\frac{1}{2}e^{-\beta x}\right)$$
All you need to do is integrate your PDF on $(-\infty,t)$. You will need to separate the integrals at $t=0$ if $t>0$.
$$\int_{-\infty}^t PDF(x)dx$$ assuming $t\leq0$.
$$\int_{-\infty}^0 PDF(x)dx+\int_0^t PDF(x)dx$$ if $t>0$. You use the first piecewise case in the first integral and the second piecewise case in the second integral.