# Substitution of variable in integral

I'm having some difficulties with working with integrals. I stumbled upon the following exercise in my probability book:

Let $X$ and $Y$ be independent random variables having, respectively, the gamma distribution with parameters $s$ and $\lambda$, and the gamma distribution with parameters $t$ and $\lambda$. Then $Z=X+Y$ has density function

\begin{aligned} f_Z(z)=&\int_{-\infty}^\infty f_X(x)f_Y(z-x)\,\mathrm{d}x\\ =&\begin{cases}\int_0^zf_X(x)f_Y(z-x)\,\mathrm{d}x&\text{if }z>0,\\ 0&\text{otherwise.} \end{cases} \end{aligned}

Right, so far so good. But then they plug in the density functions for $X$ and $Y$, and I don't understand how they do the substitution $y=x/z$.

For $z>0$,

\begin{align}f_Z(z)=\frac{1}{\Gamma (s)\Gamma (t)}\lambda^{s+t}e^{-\lambda z}\int_0^z x^{s-1}(z-x)^{t-1}\,\mathrm{d}x\end{align}.

Substitue $y=x/z$ in the last integral to obtain

\begin{align}f_Z(z)=\frac{1}{\Gamma (s)\Gamma (t)}\lambda^{s+t}\left[\int_0^1y^{s-1}(1-y)^{t-1}\,\mathrm{d}y\right]z^{s+t-1}e^{-\lambda z}.\end{align}

So I have two questions:

1) How did they come up with $y=x/z$?

2) How does this substitution work? Can I just replace all $x$ by $yz$ and that's it? Or should I apply integration by substitution, in the sense of

\begin{aligned}\int_{\phi(a)}^{\phi(b)}f(x)\,\mathrm{d}x=\int_a^b f(\phi(t))\phi '(t)\,\mathrm{d}t\end{aligned}.

• what is your background in calculus? this is one of the most basic substitutions one could imagine so you should be familiar with such stuff if you want to succesfully study something so much more complicated like probability theory... Jan 26 '17 at 18:21
• @tired I should apply 'integration by substitution'? And I don't know. I haven't had Calculus, I've had Analysis. Jan 26 '17 at 18:23
• The last integral (the one that forces the substitution you see) is a well known one. Jan 26 '17 at 18:23
• @Chinny84 What do you mean by "the one that forces the substitution"? Jan 26 '17 at 18:26
• @ShaVuklia Look at Beta function and Beta Distribution and compare with the first integral that you are trying to transform with that sub. Jan 26 '17 at 18:29

$$\int_0^z x^{s-1}(z-x)^{t-1}dx = \int_0^z x^{s-1}z^{t-1}\left(1-\frac{x}{z}\right)^{t-1}dx = z^{t-1}z^{s-1} \int_0^z \left(\frac{x}{z}\right)^{s-1}\left(1-\frac{x}{z}\right)^{t-1}dx$$ let $y = \frac{x}{z}$ with the limits transforming like so - $(0,z)\to(0, z/z) = (0,1)$ Then we have $$dx = zdy$$ so we have $$\int_0^z x^{s-1}(z-x)^{t-1}dx = z^{t-1}z^{s-1}z \int_0^1 y^{s-1}\left(1-y\right)^{t-1}dy = z^{t+s-1}\int_0^1 y^{s-1}\left(1-y\right)^{t-1}dy$$

• Ohhh, now I understand where $y=x/z$ comes from. Thank you for working it out, that is exactly what I needed, because I haven't seen many examples yet, and this helps a lot. Jan 26 '17 at 18:38