Integration Revision - Integration By Parts, Twice

So looking at the first one from a few days ago (Oct 13th):

\int^{\infty}_{0}x^{2}\:\lambda\: e^{-\lambda x}\:dx=\frac{2}{\lambda^{2}}

I was totally lost with this. But running through some old tricks made this seem a lot more approachable. First off, moving the constant out brings a bit more clarity to the integrand,

\int^{\infty}_{0}x^{2}\lambda e^{-\lambda x}\:dx=\lambda\int^{\infty}_{0}x^{2} e^{-\lambda x}\:dx

But given the x^{2} and the exponential, we'll also probably need to use integration by parts:

\int^{b}_{a} f(x)g^{\prime}(x)dx=[f(x)g(x)]^{b}_{a}-\int^{b}_{a} f^{\prime}(x)g(x)dx

So, as above, letting:
f(x)=x^{2}
g^{\prime}(x)=e^{-\lambda x},

we have:
f^{\prime}(x)=2x
g(x)=-\frac{1}{\lambda}e^{-\lambda x}

Then plugging f, f^{\prime}, g and g^{\prime} into our lovely integration by parts tool above gives:

\lambda\int^{\infty}_{0}x^{2}\: e^{-\lambda x}\:dx

=\lambda\left(\left[-x^{2}\: \frac{1}{\lambda}\:e^{-\lambda x}\right]^{\infty}_{0}-\int^{\infty}_{0}-2x\:\frac{1}{\lambda}\: e^{-\lambda x}\:dx\right)

=\lambda\left(0-0+2\frac{1}{\lambda}\int^{\infty}_{0}x\: e^{-\lambda x}\:dx\right)

=2\int^{\infty}_{0}x\: e^{-\lambda x}\:dx

Which looks very familiar with what we've started with, except x^{2} is now just x! If we can reduce x by another power, we'll end up with just 1 which will surely give us a much easier integral to solve.

So applying integration by parts again, but letting:
f(x)=x
g^{\prime}(x)=e^{-\lambda x},

we have:
f^{\prime}(x)=1
g(x)=-\frac{1}{\lambda}e^{-\lambda x}

Then:

2\int^{\infty}_{0}x\: e^{-\lambda x}\:dx

=2\left(\left[-x\: \frac{1}{\lambda}\:e^{-\lambda x}\right]^{\infty}_{0}-\int^{\infty}_{0}-\frac{1}{\lambda}\: e^{-\lambda x}\:dx\right)

=2\left(0-0+\frac{1}{\lambda}\int^{\infty}_{0} e^{-\lambda x}\:dx\right)

=\frac{2}{\lambda}\int^{\infty}_{0} e^{-\lambda x}\:dx

=\frac{2}{\lambda}\left[-\frac{1}{\lambda}\:e^{-\lambda x}\right]^{\infty}_{0}

=\frac{2}{\lambda}\left(0-\left(-\frac{1}{\lambda}\right)\right)

=\frac{2}{\lambda}\:\frac{1}{\lambda}

=\frac{2}{\lambda^{2}}