Why does integration by parts and calculating derivatives not yield same answer? Take the integral 
$$
\int_{-\infty}^{\infty}e^{-\lambda x^2}\frac{d^2}{dx^2}(e^{-\lambda x^2})dx = \int_{-\infty}^{\infty}e^{-\lambda x^2}\frac{d}{dx}(-2 \lambda x e^{-\lambda x^2})dx 
= \int_{-\infty}^{\infty}(-2 \lambda + 4 \lambda^2 x^2 )e^{-2\lambda x^2}dx 
= -\lambda\frac{\sqrt{\pi}}{(2\lambda)^{3/2}} + 2 \lambda^2\frac{\sqrt{\pi}}{(2\lambda)^{3/2}}
$$
But looking at the first expression and applying partial integration we get:
$$
\int_{-\infty}^{\infty}e^{-\lambda x^2}\frac{d^2}{dx^2}(e^{-\lambda x^2})dx = [e^{-\lambda x^2}\frac{d}{dx}(e^{-\lambda x^2})]_{-\infty}^{\infty} - \int_{-\infty}^{\infty}(-2) \lambda x e^{-\lambda x^2}\frac{d}{dx}(e^{-\lambda x^2})dx = 
$$
$$
-\int_{-\infty}^{\infty}4 \lambda^2 x^2 e^{-2\lambda x^2}dx = - 2 \lambda^2\frac{\sqrt{\pi}}{(2\lambda)^{3/2}}
$$
Where by taking limits:
$$
[e^{-\lambda x^2}\frac{d}{dx}(e^{-\lambda x^2})]_{-\infty}^{\infty} = 0
$$
This doesn't seem correct because
$$
- 2 \lambda^2\frac{\sqrt{\pi}}{(2\lambda)^{3/2}} \neq -\lambda\frac{\sqrt{\pi}}{(2\lambda)^{3/2}} + 2 \lambda^2\frac{\sqrt{\pi}}{(2\lambda)^{3/2}}
$$
equivalent to
$$
\lambda \neq 4\lambda^2 
$$
What is going on here?
 A: Attaching some fictitious "physical dimension" to the objects helps in this case: it allows you to find a possible mistake.
Say that $x \sim L$ is a "length". The argument of the exponential must be a pure number (namely $\lambda x^2 \sim L^0$), so that $\lambda \sim L^{-2}$. Clearly, $dx \sim L$  and $d/dx^2 \sim L^{-2}$. 
Therefore, the result of the integral (call it $I$) must be 
$$I \sim L^{-1}.$$ 
This is not consistent with what you have in your first equation. You probably made a mistake in the calculation: you cannot add terms with different physical dimensions (i.e. $L+L^{-1}$ does not make sense).
You should obtain 
$$I = -\sqrt{\pi\lambda /2} \sim L^{-1} \qquad \qquad  Re(\lambda)>0,$$ which is what you get with your second approach (the integration by parts).
A: $$
\int_{-\infty}^{\infty}(-2 \lambda)e^{-2\lambda x^2}dx 
= -\sqrt{2\pi\lambda} 
\neq -\lambda\frac{\sqrt{\pi}}{(2\lambda)^{3/2}}.
$$
Taken together with the fact that
$$
2 \lambda^2\frac{\sqrt{\pi}}{(2\lambda)^{3/2}}
= \frac12 \sqrt{2\pi\lambda},
$$
the inconsistency in your results is resolved.
