I am working on a pretty simple problem (or so it seems it should be) from Griffith's QM text.
The problem states: for the probability density function $\rho (x) = Ae^{-\lambda(x-a)^2}$
a) find A b) find $\langle x \rangle$, $\langle x^2 \rangle$ and $\sigma$
I set up the integral and got a result for A, (I did a substitution and then a change of variables to polar coordinates) and since $1 = \int^{+\infty}_{+\infty}\rho(x)\,dx$ I ended up with $A=\sqrt{\frac{\lambda}{\pi}}$. So far so good.
Then I set up the integral with that value for A. In this case $$\langle x \rangle = \int^{+\infty}_{+\infty}x\rho(x)\,dx=\sqrt{\frac{\lambda}{\pi}} \int^{+\infty}_{+\infty}xe^{-\lambda(x-a)^2}\,dx$$ again so far so good. Now, what I wanted to know was whether the following was permissible. I think so, but I can't shake the feeling that I am doing something wrong.
Now to be clear, I could integrate by parts as it is. But in that case I started getting repeating intgrals (I used $u=e^{-\lambda(x-a)^2}\,dx$, $du = -2\lambda e^{-\lambda(x-a)^2}\,dx$ and $dv=x\,dx$ and $v=\frac{x^2}{2}$.
SO I tried something else. I did another substitution first. I said, let $u=x-a$. That means $x=u+a$ and $dx=du$. That gets me the following: $$\int^{+\infty}_{+\infty}(u+a)e^{-\lambda(u)^2}du=\int^{+\infty}_{+\infty}ue^{-\lambda(u)^2}du+\int^{+\infty}_{+\infty}ae^{-\lambda(u)^2}du$$
which is a LOT easier to do. From there I get $$\left[\frac{e^{-\lambda u^2}}{-2\lambda}\right]^{+\infty}_{-\infty}+a\int^{+\infty}_{+\infty}e^{-\lambda u^2}du$$ Now, the second term is a famous integral- it's the same one that if I do yet anothr substitution to turn it into polar coordinates I would get $a\sqrt{\frac{\pi}{\lambda}}$ and that means: $$\langle x \rangle = a\sqrt{\frac{\pi}{\lambda}}$$ because the first term has to go to zero.
So, I am basically just asking if this was the correct thing to do. I can't see anything mathematically wrong but I like to make sure I didn't delude myself somewhere.