To calculate $\displaystyle \int_0^{\infty}y^2e^{-y} dy$
=$\displaystyle -y^2e^{-y}-2ye^{-y}-2e^{-y}|_o^{\infty}$
This should fail at $\infty$, but the answer is given as 2. Seems like $e^{-y}$ "wins" over $y^2$.
So, am I making a mistake here ? Please help.
In that first term, you are evaluating $$\lim_{y\to \infty}-\frac{y^2}{e^y}=\lim_{y\to\infty}-\frac{2y}{e^y}=\lim_{y\to\infty}-\frac{2}{e^y}=0$$ by repeated application of L'Hopital's rule.