# How to find distribution when I know density

I need a little help in solving a homework exercise from uni.

Let X and Y be two independent random variables with distribution given by:

$$f(x) = \frac{2}{\pi}\frac{1}{e^{x}+e^{-x}}$$

It says to compute the distribution of : $$Z = X + Y$$

If the density functions of $Z$, $X$, $Y$ are $f\left(z\right)$, $f\left(x\right)$, $f\left(y\right)$, where $z = x + y$, then

$$f\left(z\right) = \int_{-\infty}^{+\infty} f(x) f(z-x) \text{d}x$$

which means

$$f\left(z\right) = \int_{-\infty}^{+\infty} -\dfrac{2\mathrm{e}^z\left(\ln\left(\mathrm{e}^{2x}+\mathrm{e}^{2z}\right)-\ln\left(\mathrm{e}^{2x}+1\right)\right)}{{\pi}^2\left(\mathrm{e}^{2z}-1\right)} \text{d}x$$

and them integrate from $-\infty$ to $+\infty$

$$f\left(z\right) = \frac{4ze^{z}}{\pi^{2}\left(e^{2z}-1\right)}$$

And now, how to find the distribution of Z ?

• What is $u$, and why are you calculating its distribution? – jbowman Jan 28 '18 at 16:13
• The distribution function? – Michael M Jan 28 '18 at 16:13
• jbowman: $u = x + y$. It would be better if Adi chooses $z = x + y$, but its just a bit confusing, not bad. – oszkar Jan 28 '18 at 17:11
• @oszkar - I know that, and you know that, but it's not at all clear that the OP knows that, otherwise why even use $u$ instead of $z$? Also note that the notation and initial use of the word "distribution" make it unclear that he means the CDF as opposed to the density, in which latter case he's done but doesn't realize it. – jbowman Jan 28 '18 at 19:07
• jbowman: Yes, that's why I have edited Adi's post a bit, to clear things up. Just waiting for peer review. – oszkar Jan 28 '18 at 19:14

For any X continuous random variable from it's density function $f\left(x\right)$ we can get it's distribution function (or cumulative density function):

$$F\left(x\right) = \int_{-\infty}^{x} f\left(t\right) \text{d}t$$

So, in your case that's mean you have to calculate the next integral function:

$$F\left(z\right) = \int_{-\infty}^{z} \frac{ 4te^t }{ \pi^2 \left( e^{2t} - 1 \right) } \text{d}t$$

If I calculate it with a computer algebra system (maxima), the result is:

$$F\left(z\right) = \frac{ 4 \left( \lim_{t \rightarrow -\infty} \left( \frac{ t \log\left( e^t + 1 \right) }{2} - \frac{ \text{Li}_2 \left( e^t \right) }{2} + \frac{ \text{Li}_2 \left( -e^t \right) }{2} - \frac{ t \log\left( 1 - e^t \right) }{2} \right) + \frac{ -\text{Li}_2 \left( -e^{-z} \right) + \text{Li}_2 \left( e^{-z} \right) - z \log\left( e^{-z} \left( e^z - 1 \right) \right) + z \log\left( e^{-z} \left( e^z + 1 \right) \right) }{2} \right) }{\pi^2}$$

and after taking the $\lim$ and make some simplifications that comes to

$$F\left(z\right) = \frac{2}{\pi^2}\left( \text{Li}_2\left( e^{z} \right) -\text{Li}_2\left( -e^{-z} \right) + z \log\left( e^{2z} + 1 \right) \right)$$

(where $\text{Li}_2\left(x\right)$ is the dilogarithm function).