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}$?

  • 8,119
  • 13
  • 45
  • 91
  • 3
    $\infty - \infty \neq 0$, it's undefined – jameselmore Aug 06 '15 at 16:53
  • @jameselmore Thanks changed it now – BLAZE Aug 06 '15 at 16:54
  • 6
    Your integration by parts is not right. You need an antiderivative for $e^{-\alpha x^2}$. Your supplied $\int_0^{\infty} e^{-\alpha x^2}$ is not an antiderivative. – Jason Knapp Aug 06 '15 at 16:55
  • @JasonKnapp Thanks for your response, can you explain in more detail please as I still don't understand sorry – BLAZE Aug 06 '15 at 16:57
  • ∞−∞ isn't undefined so much as it is indeterminate (though you could say it is undefined in that it is not well defined but I digress). Essentially ∞−∞ could be anything depending on the specific expressions involved. I could create a problem where something that "looks like ∞−∞" but equals 2 or -e or anything I want if I get creative enough. – nurdyguy Aug 06 '15 at 17:02
  • @JasonKnapp Can you tell me why I need an antiderivative for $e^{-\alpha x^2}$? – BLAZE Aug 06 '15 at 17:51
  • @BLAZE Just wondering did you look at my answer? I tried to fill that thought out a bit. – Jason Knapp Aug 06 '15 at 17:57
  • @JasonKnapp Hi yes looked at it and added comment thanks – BLAZE Aug 06 '15 at 18:03

4 Answers4


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}$.

Jason Knapp
  • 1,609
  • 11
  • 10
  • 2
    Well done. You might mention that $\int_0^x e^{-at^2}dt =\sqrt{\frac{\pi}{4a}}\text{erf}\left(\sqrt{a}\,x\right)$ in terms of the well-known error function. – Mark Viola Aug 06 '15 at 17:17
  • @JasonKnapp Okay, now we're getting somewhere and yes $u = x$ and $dv = e^{-\alpha x^2} dx$ in my case, when I use by parts I use 1st times integral of second - integral(integral of second times differential of first) where first is $x$ and second is $ e^{-\alpha x^2}$ – BLAZE Aug 06 '15 at 18:00
  • @JasonKnapp What I can't understand is that if asked to evaluate say $\int x\sin x$ by parts I would do the following: $\int x\sin x\mathrm dx= x\int \sin x\mathrm dx-\int\int \sin x\mathrm dx= \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? – BLAZE Aug 06 '15 at 18:53
  • 1
    @BLAZE I'm sorry because this is hard to talk about in writing. You have to be very careful with your language because when you say "integral" it matters if you mean indefinite (family of antiderivatives) or definite (representing a real number). This can create mistakes here. When in your first comment you say "integral of second," keep in mind that is an antiderivative! To adapt that to your second example, $dv = \sin x \, dx$ so $v = -\cos x$ because $-\cos$ is an antiderivative of $\sin x$. What is your antiderivative of $e^{-\alpha x^2}$? – Jason Knapp Aug 06 '15 at 18:56
  • @JasonKnapp Yes you're right, sorry for the ambiguity, I am still lost however as to why the method breaks down for $\int_{x=0}^{\infty} x\mathrm{e}^{-\alpha x^2}\mathrm dx$ but works perfectly for $\int x\sin x\mathrm dx= x\int \sin x\mathrm dx-\int\int \sin x\mathrm dx= \sin x -x\cos x$ + C? I acknowledge that you have tried you're best to explain this to me. – BLAZE Aug 06 '15 at 19:03
  • @JasonKnapp Is the antiderivative of $e^{-\alpha x^2}$ undefined? I still need to know why we need antiderivatives to integrate by parts? – BLAZE Aug 06 '15 at 19:09
  • 1
    @BLAZE No, but it is a bit unfriendly in that it doesn't have a "closed form." That is why I chose to write it in my answer as $\int_0^{x} e^{-\alpha t^2} \, dt$. Dr. MV also helpfully observed that this is related to the "error function" which has a decent wikipedia article. But a mistake you had made was in essentially writing that the antiderivative was $\int_0^{\infty} e^{-\alpha^2 x} \, dx$. – Jason Knapp Aug 06 '15 at 19:14
  • @JasonKnapp Okay Jason, I understand that my mistake was writing the antiderivative as $\int_{x=0}^{\infty} x\mathrm{e}^{-\alpha x^2}\mathrm dx$, but the question still remains: Why do we need the antiderivative instead of a definite integral inserted? Sorry to keep repeating the same question, I'm just desperate to understand this concept. – BLAZE Aug 06 '15 at 19:28
  • @BLAZE OK (extended) conversations in the comments are bad form so I've expanded my answer to try to address that specific question (why do we need an antiderivative). You also might be more interested in my final paragraph. – Jason Knapp Aug 06 '15 at 19:54

Let $u = a \, x^{2}$ then $du = 2 a \, x \, dx$. In the integral presented the differential unit is part of the integrand. With this in mind then \begin{align} I &= \int_{0}^{\infty} x \, e^{-a \, x^{2}} \, dx = \frac{1}{2a} \, \int_{0}^{\infty} e^{- u} \, du = \frac{1}{2a}. \end{align}

Now, if integration by parts is considered then the following is obtained. \begin{align} I &= \left[ \frac{x^{2}}{2} \, e^{-a x^{2}} \right]_{0}^{\infty} + a \, \int_{0}^{\infty} x^{3} \, e^{-a x^{2}} \, dx = a \, \int_{0}^{\infty} x^{3} \, e^{-a x^{2}} \, dx \\ &= \frac{a^{2}}{2} \, \int_{0}^{\infty} x^{5} \, e^{-a x^{2}} \, dx \\ &= \cdots. \end{align} One can define the integral as $I_{1}$ and from integration by parts show that $$I_{1} = \frac{a^{2n-1}}{(2n-1)!} \, I_{2n+1}$$ where $$I_{m} = \int_{0}^{\infty} x^{m} \, e^{-a x^{2}} \, dx.$$

In the general sense integration by parts makes integrals, of the type which can be easily calculated, more complicated, but can often be used to develop a series expansion for approximations. To demonstrate this consider the same integral with a different lower limit. \begin{align} J_{b}(a) &= \int_{b}^{\infty} x \, e^{- a x^{2}} \, dx \\ &= \left[ \frac{x^{2}}{2} \, e^{- a x^{2}} \right]_{b}^{\infty} + a \, \int_{b}^{\infty} x^{3} \, e^{- a x^{2}} \, dx \\ &= - \frac{b^{2}}{2} \, e^{-a b^{2}} - \frac{a \, b^{4}}{4} \, e^{-a b^{2}} - \frac{a^{2} \, b^{6}}{12} \, e^{-a b^{2}} - \cdots. \end{align} This presents the integral as a power series in $b$.

  • 22,756
  • 140
  • 38
  • 83
  • Hey! Hope all is well. a +1 here! ... but please explain the last statement regarding the development of a series expansion for approximations. That is not obvious to me as to where you're going with that. – Mark Viola Aug 06 '15 at 17:12
  • @Dr.MV This is a classic case of thinking one thing and typing another. – Leucippus Aug 06 '15 at 18:44
  • 1
    That is better! Good work ... small $b$ approx – Mark Viola Aug 06 '15 at 18:59

If you want to integrate by parts like (1) suggests, you must differentiate $x$ and integrate $e^{-\alpha x^2}$. The first task is clear, the second is impossible in terms of elementary functions. So what is your mistake? Well, it seems to me that you wrongly believe that a primitive of $e^{-\alpha x^2}$ is $\int_0^\infty e^{-\alpha x^2} \, dx$. This cannot be true, since $\int_0^\infty e^{-\alpha x^2} \, dx$ is a real number, and the derivative of a given real number is always zero!

  • 8,119
  • 13
  • 45
  • 91
  • 33,869
  • 3
  • 49
  • 78

You can integrate by parts, but it will probably lead to a more difficult integral. For example, $$ \begin{align} \int_0^\infty xe^{-ax^2}\,\mathrm{d}x &=\frac12\int_0^\infty\overbrace{\ e^{-ax^2}\ }^{\large u}\,\overbrace{\ \ \mathrm{d}x^2\ \ \vphantom{e^{-ax^2}}}^{\large\mathrm{d}v}\\ &=\frac12\left[x^2e^{-ax^2}\right]_0^\infty-\frac12\int_0^\infty\overbrace{\ \ \ x^2\ \ \ \vphantom{\mathrm{d}e^{-ax^2}}}^{\large v}\,\overbrace{\mathrm{d}e^{-ax^2}}^{\large\mathrm{d}u}\\[9pt] &=a\int_0^\infty x^3e^{-ax^2}\,\mathrm{d}x \end{align} $$

  • 326,069
  • 34
  • 421
  • 800
  • thanks for your reply, the question I'm asking here is why we need an antiderivative to evaluate $\int_{x=0}^{\infty} x\mathrm{e}^{-\alpha x^2}\mathrm dx$ to obtain $\frac{1}{2\alpha}$ by parts instead of integrating by parts with a definite integral? Any ideas? – BLAZE Aug 06 '15 at 19:34
  • I am not quite sure what you are asking. The way that I would approach this integral is by substitution with $u=x^2$. Then the integral would become $$\frac12\int_0^\infty e^{-au}\,\mathrm{d}u=\frac1{2a}$$ – robjohn Aug 06 '15 at 19:50
  • In your question, you have the formula $$x\int_0^\infty e^{-ax^2} - \int_0^\infty\int_0^\infty e^{-ax^2}\,\mathrm{d}x$$ What does that mean? The integrals have one more integration sign than $\mathrm{d}$-something, and there is a free $x$ to the left of the first integral. You can't use a definite integral like a variable since a definite integral is just a constant. – robjohn Aug 06 '15 at 20:20
  • The formula $\displaystyle\int u\frac{dv}{dx}dx= u\int dv -\int dv \frac{du}{dx}dx$ is exactly equivalent to $\displaystyle\int u \frac{dv}{dx}dx= u\int \frac{dv}{dx}dx - \int \int\ (\frac{dv}{dx}\frac{du}{dx} dx)$ if asked to evaluate say $\int x\sin x$ by parts I would do the following: $\int x\sin x\mathrm dx= x\int \sin x\mathrm dx-\int\int \sin x\mathrm dx= \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, do you have any idea why this is? Thanks again. – BLAZE Aug 06 '15 at 21:12
  • 1
    @BLAZE: with *indefinite* integrals, yes. Not with *definite* integrals. However, there is still a $\mathrm{d}$-something missing in your double integrals in the comment, too. – robjohn Aug 06 '15 at 21:14
  • Okay that's a useful answer, now can you please explain why not for _definite_ integrals? Thanks – BLAZE Aug 06 '15 at 21:16
  • As I said before, a definite integral is a number, whereas an indefinite integral is a function. For a fixed $a$, $\mathrm{d}\int_0^\infty e^{-ax}\,\mathrm{d}x=0$ – robjohn Aug 06 '15 at 21:17
  • You're almost there, you've explained that it only works for indefinite integrals but have not fully justified why yet. – BLAZE Aug 06 '15 at 21:20
  • The formula for integration by parts is $$\int u\,\mathrm{d}v=uv-\int v\,\mathrm{d}u$$ using *indefinite* integrals. After we have applied this formula, we can take the difference at two limits, thereby turning the indefinite integrals into definite integrals and the $uv$ term into a difference of products. The formula does not apply to definite integrals, though we can turn the indefinite integrals into definite ones by evaluation after we have applied integration by parts. – robjohn Aug 06 '15 at 21:30