# Integrate $\left(x^2e^{x^2}\right)$

$\int\left(x^2e^{x^2}\right)$

First I integrated $$x^2e^{x^2}$$ to get $$F(x)=\frac{x^3}{3}\cdot\frac{1}{2x}\cdot e^{x^2}=\frac{x^3}{3}\cdot\frac{e^{x^2}}{2x}$$

I know this isnt correct, because when I derive $F(x)$ using the product rule I get

$$F'(x)=\frac{x^3e^{x^2}}{3}+\frac{x^2e^{x^2}}{2x}$$

which isnt equal to the function that I was integrating, $$x^2e^{x^2}$$

What did I do wrong?

• You did a couple of things wrong. First of all, the integral of product is not the product of integrals ($\int x^2 e^{x^2} \neq \int x^2 \times \int e^{x^2}$ ) ... Aug 30, 2018 at 11:43
• I'm pretty sure this function has no elementary antiderivative anyway.
– Mark
Aug 30, 2018 at 11:48
• @Mark how come? Aug 30, 2018 at 14:30
• From the answers that people wrote here you can see that if your function had an elementary antiderivative then $e^{x^2}$ would have an elementary antiderivative too. But it is a known fact that $e^{x^2}$ has no elementary antiderivative.
– Mark
Aug 30, 2018 at 15:19

Try integrating by parts;

$\int x^2 e^{x^2}dx = \int uv' - \int u'v$

$u = x, v' = xe^{x^2}$

$u'=1, v = \frac{e^{x^2}}{2}$

$= \frac{xe^{x^2}}{2} - \int\frac{e^{x^2}}{2}dx$

Now you need to use properties of the Error function to get

$= \frac{xe^{x^2}}{2} - \frac{\sqrt{\pi}}{4} \mathrm{erfi}(x)$

Have a read of the wiki page as well

https://en.wikipedia.org/wiki/Error_function

• +1. Integration by parts gives us a reduction formula, reducing $J_n=\int x^n e^{x^2}\;dx$ to $J_{n-2}=\int x^{n-2} e^{x^2}\;dx$. So any one of these can be evaluated in terms of either $J_1=\int x e^{x^2}\;dx$ or $J_0=\int e^{x^2}\;dx$. Aug 30, 2018 at 13:12
• I understand the concept of integrating by parts fairly well, but why is it that $u=x$ instead of $u=x^2$? and why is $v=\frac{e^{x^2}}{2}$? Where did the division by 2 come from. Aug 30, 2018 at 14:30
• You choose that $u$ as it allows you to get a simpler $v$ and $u'$, otherwise you have to try and integrate $e^{x^2}$. With regards to the division by 2, differentiate $v$ and you will see that you get $v'$. Does this make sense? Aug 30, 2018 at 14:35

Her is the correct way of doing this. $\int x(xe^{x^{2}})\, dx=\frac 1 2 x(e^{x^{2}})-\int \frac 1 2 e^{x^{2}}$ since $xe^{x^{2}}$ is the derivative of $e^{x^{2}}$. $\int e^{x^{2}}$ cannot be evaluated explicitly.

• What imaginary function? The answer involves the so-called error function. Aug 30, 2018 at 11:55
• Yes....That one Aug 30, 2018 at 13:01

By indeterminate coefficients:

Assume the solution to be of the form $P(x)e^{x^2}$ for some polynomial $P$. Then

$$(P(x)e^{x^2})'=(P'(x)+2xP(x))e^{x^2}.$$

For the left factor to equal $x^2$, $P$ must be of the first degree, let $ax+b$.

Now

$$P'(x)+2xP(x)=a+2x(ax+b)$$

and by identification

$$a=\frac12,b=0,a=0.$$

Hey, what is going on ? Identification is not possible, we are in a dead end. The fact is that there is no solution of the form $P(x)e^{x^2}$!

If we consider the partial solution $\dfrac x2e^{x^2}$, the derivative is

$$x^2e^{x^2}+\frac12e^{x^2}.$$

Hence we remain with the extra term $e^{x^2}$, which is known to have no closed-form antiderivative and requires the so-called error function.