# Cumulative distribution function & expectation

Let a be a real number and f: $$f:\mathbb{R}\rightarrow \mathbb{R}, \ f(x) = \begin{cases} a3^x & \text{for } x < 0\\ 1& \text{for } x =0 \\ a3^{-x} & \text{for } x > 0\end{cases}$$

For a = log(3), f is a probability density function.

Now, I'm stuck in the following Problem: If X is a random variable with density f. What's its cumulative Distribution function and the expectation?

• what are the formulae for these? Mar 20, 2013 at 22:31

The expectation exists. Just set up the integral and note that it converges,

The density function is symmetrical about $x=0$, so since the expectation exists, it is $0$.

Let us find $a$. You have already done the calculation, but there was a little slip. For positive $x$, the density function is $a e^{-(\log 3)x}$. Integrate from $0$ to $\infty$. We get $\dfrac{a}{\log 3}$. This should be $1/2$. So $a=\dfrac{\log 3}{2}$.

Now we are ready to calculate the cdf $F_X(x)$. There are two cases to consider, $x\ge 0$ and $x\lt 0$. We need to do them separately.

For $x\ge 0$, the cdf is $\dfrac{1}{2}+\displaystyle\int_0^x \dfrac{\log 3}{2}e^{-(\log 3)t}\,dt$. The integration is straightforward.

For negative $x$, either do a separate calculation, or use symmetry.

• Thank you very much! You're right, I forgot the factor 1/2. I have still 2 questions: (1) how did you get the cdf, in particular the Terms after the integrand-sign? (2) What if $Y=3^X$ - does the cdf/expectation exist in this case? Mar 21, 2013 at 20:19
• For the cdf, I just integrated the density function we were given, from $-\infty$ to $x$. Changed letter to $t$ because don't like to use $x$ for dummy variable of integration when $x$ has another meaning. But you can use $x$. Saved some trouble by using symmetry to observe that the integral up to $0$ is $1/2$. If $Y=3^X$ there should be no particular cdf difficulty. Just use $F_Y(y) =\Pr(X\log 3 \le \log y)$. Mar 21, 2013 at 20:20
• Thanks a lot for your answer! What exactly do you mean with Pr(X log(3) <= log(y))? I mean how can I know what the probability is that Xlog(3) <= log(y)? Mar 22, 2013 at 23:38
• You want $\Pr(X\le (\log y)/(\log 3)$. Since you know the density function of $X$, and indeed its cdf (calculated in the answer), you know $\Pr(X\le w)$ for any $w$. (There is a shorter way of getting at the distribution of $Y$, but you may not have seen it.) The $Y=3^X$ is really a separate question, hard to do in detail in comments, editing facilities are too poor, allowed length too short.) Mar 22, 2013 at 23:43

It's a simple integration exercise: $$F(x)=\int_{-\infty}^x f(t)dt \\ E(X)=\int_{\Bbb R} xf(x)dx\,.$$ You can use $3^x=e^{\log(3)\cdot x}$ and partial integration for the expectation, and of course you have to separate the integrals as $\int_{-\infty}^s=\int_{-\infty}^0+\int_0^s$ in case $s\in [0,\infty]$.