Can $\int_{x=0}^{\infty} x\mathrm{e}^{-\alpha x^2}\,\mathrm {d}x$ be evaluated by parts to show that $\int_{x=0}^{\infty} x\mathrm{e}^{-\alpha x^2}\,\mathrm {d}x= \frac{1}{2\alpha}$
I know that this can be done without parts by means of the substitution $-\alpha x^2=u \Rightarrow -2\alpha x\, \mathrm {d}x=\mathrm {d}u$, then $x\mathrm dx=\frac {-1}{2\alpha}\mathrm du$; such that
$\displaystyle\int_{x=0}^{\infty} xe^{-\alpha x^2}\,dx=\frac {-1}{2\alpha}\displaystyle\int_{x=0}^{\infty} e^u \mathrm du= \left [ \frac {-1}{2\alpha}\displaystyle e^{-\alpha x^2} \right]_{x=0}^{\infty}=\frac{1}{2\alpha}$
However; Can it be done like this?
$\color{blue}{I}$ $=\displaystyle\int_{x=0}^{\infty} xe^{-\alpha x^2}\,dx= x\int_{x=0}^{\infty}e^{-\alpha x^2} - \int_{x=0}^{\infty}\left(\int_{x=0}^{\infty}e^{-\alpha x^2}\mathrm dx\right)\mathrm{d}x$
Now $$\int_{x=0}^{\infty}e^{-\alpha x^2}\mathrm dx= \frac{1}{2}\left(\frac{\pi}{\alpha}\right)^\frac{1}{2}\tag{1}$$
Now by insertion of $(1)$ into $\color{blue}{I}$ yields,
$\color{blue}{I}=\displaystyle\int_{x=0}^{\infty} xe^{-\alpha x^2}\,\mathrm{d}x=\underbrace{ \left [ x\frac{1}{2}\left(\frac{\pi}{\alpha}\right)^\frac{1}{2} \right ]_{x=0}^{\infty} - \int_{x=0}^{\infty} \frac{1}{2}\left(\frac{\pi}{\alpha}\right)^\frac{1}{2} \mathrm {d}x}_{\large\text{$\color{red}{\mathrm{Undefined}}$}}\ne \frac{1}{2\alpha}$ which is clearly a contradiction.
I realize that this may be blatantly obvious to many of you why this will never work, but it is not clear to me.
What I can't understand is that if asked to evaluate say $\int x\sin x\,\mathrm{d}x$ by parts I would do the following: $\int x\sin x\,\mathrm dx= x\int \sin x\,\mathrm dx-\int\left(\int \sin x\,\mathrm dx\right)\mathrm{d}x= \sin x -x\cos x$ + C. But the method does not work for $\int_{x=0}^{\infty} x\mathrm{e}^{-\alpha x^2}\,\mathrm dx$ by parts as shown above. Why is this?
Could someone please explain to me why I cannot perform this integral by parts to get the answer $\dfrac{1}{2\alpha}$?
One typical way to write integration by parts is to identify your original integral as $\int u \, dv$ and then we can use the identity $$\int u \, dv = uv - \int v \, du$$ Where we form $du$ from $u$ by differentiating $u$ with respect to the independent variable, and we form $v$ from $dv$ by antidifferentiating.
In your case, if I am taking you rightly you have $u = x$ and $dv = e^{-\alpha x^2} dx$. To proceed you need to find $v$, which would be an antiderivative of $e^{-\alpha x^2}$. You won't be able to find a closed form for this, but you can at least write $v(x) = \int_0^x e^{-\alpha t^2} \, dt$, thanks to the Fundamental Theorem of Calculus.
This would change your proposed integration by parts result. You would end up with an antiderivative for your original integrand of: $$x \int_0^x e^{-\alpha t^2} \, dt - \int \int_0^x e^{-\alpha t^2} \,dt\, dx$$
Now, when you are attempting to do a definite integral by parts, I typically prefer to first compute an antiderivative (indefinite integral) by parts and then simply use FTC. So to adapt your example, if I wished to know $\int_0^{\pi} x \sin x \, dx$, I might first use integration by parts as you did to find an antiderivative and then I would have $$\int_0^{\pi} x \sin x \, dx = \left.\sin x - x \cos x\right|_0^{\pi} = 0 - (-\pi) - (0 - 0)$$ But, you can do (proper) definite integrals by parts just by using the same endpoints on the resulting integral, and evaluating the "uv" part across those endpoints. Your integral is improper though, so this introduces an extra step: $$\int_0^{\infty} x e^{-\alpha x^2} \, dx = \lim_{b \to \infty} \int_0^bx e^{-\alpha x^2} \, dx $$ Applying the above and abusing notation, $$\int_0^bx e^{-\alpha x^2} \, dx = \left.\left( x \int e^{-\alpha x^2} \, dx \right)\right|_0^b - \int_0^b \left(\int e^{-\alpha x^2} \, dx \right) \, dx$$
If we go on to use $F(x) = \int_0^x e^{-\alpha t^2} \, dt$ as our antiderivative, this would yield $$\int_0^bx e^{-\alpha x^2} \, dx = \left. x F(x) \right|_0^b - \int_0^b F(x) \, dx$$
But unfortunately this does not lead anywhere helpful. The first term becomes $bF(b) - 0 = bF(b)$. As you have observed, as $b \to \infty$ $F(b) \to \frac{1}{2}\left(\frac{\pi}{\alpha}\right)^{\frac{1}{2}}$, but since there is a factor of $b$ the first term simply goes to $\infty$. The second term I think is a bit difficult to analyze. Maybe there is a clever way to address it but I don't know it.
I think you are going to be unsatisfied with the ultimate answer here because where this is going is this: you found by a simpler method that this integral has a finite value. You used integration by parts (made a mistake) but arrived at an expression of the type $\infty - \infty$. That is actually where this method would lead regardless of the mistake. The final answer is that this is not a contradiction with your original answer. Limits of the type $\infty - \infty$ are indeterminate, which means it could be anything! It could be infinite, or finite. Further analysis is required to find the answer. As it happens, you had already done the further analysis and found the answer was $\frac{1}{2\alpha}$.