# How to differentiate CDF of Gamma Distribution to get back PDF?

CDF of a gamma distribution ($X \sim \mathcal{G}(n, \lambda)$) looks like

$$F(x) = \frac{\Gamma_x(n)}{\Gamma(n)}$$

Where $\Gamma_x(n) = \int_0^x t^{n-1} e^{-t} \, dt$ the incomplete gamma function. Ok so far?

But how do I differentiate such an expression?

$$\frac{d}{dx} \frac{\int_0^x t^{n-1} e^{-t} \, dt}{\int_0^\infty t^{n-1} e^{-t} \, dt}$$

UPDATE

With help from @MhenniBenghorbal, I have gotten:

$$\frac{d}{dx} \frac{\int_0^x t^{n-1} e^{-t} \, dt}{\int_0^\infty t^{n-1} e^{-t} \, dt} = \frac{1}{\Gamma(n)} x^{n-1}e^{-\lambda t}$$

but then its missing the $\lambda^n$ term of the original PDF of a gamma distribution. How do I get that back? I must have overlooked something? But I can see where ...

• The denominator does not depend on $x$. You can use Leibniz rule. – Mhenni Benghorbal Nov 5 '13 at 1:29
• @MhenniBenghorbal, Ok I havent seem to learn this in school, but looking the the wiki page, I will obtain something like: $\frac{1}{\int_0^\infty t^{n-1} e^{-t}\, dt} \int_0^x \frac{\delta}{\delta x} (t^{n-1}e^{-t}) dt$. But $t^{n-1}e^{-t}$ it self doesn't have an $x$ term and will differenciate to $0$? – Jiew Meng Nov 5 '13 at 1:45

$$\frac{d}{dx}\int_{0}^{x}t^{n-1}e^{-t}dt= x^{n-1}e^{-x}.$$
Theorem: Let $f$ be a continuous real-valued function defined on a closed interval $[a, b]$. Let $F$ be the function defined, for all $x$ in $[a, b]$, by $$F(x) = \int_a^x\!f(t)\, dt.$$ Then, $F$ is continuous on $[a, b]$, differentiable on the open interval (a, b), and $$F'(x) = f(x)\,$$ for all $x$ in $(a, b)$.
• Ok, thanks. But now I have a minor hicup, I don't seem to be able to get back the expected PDF of a Gamma distribution. $\frac{1}{\Gamma(n)}x^{n-1} e^{-\lambda x}$ but the PDF of a gamma RV is $\frac{\lambda^n}{\Gamma(n)}x^{n-1}e^{-\lambda x}$. I am missing a $\lambda^n$? – Jiew Meng Nov 5 '13 at 3:00
• There are basically 2 terms the numerator which equals what u gave $x^{n-1}e^{-\lambda t}$ and the denominator which is $\Gamma(n)$. – Jiew Meng Nov 5 '13 at 10:18