I'm solving a first order differential equation.


I multiplied by the integration factor to get the equation in the form $f\left(x\right)\frac{dy}{dx}+f'\left(x\right)y=f\left(x\right)Q$






I know the easiest and correct way to do this is by using a u substitution for $e^{x^{2}}$ but I tried using integration by parts and I got a completely different answer to using a u sub.

I got $$y=\frac{1}{2}-\frac{1}{4x^{2}}+\frac{c}{e^{x^{2}}}$$

The correct answer using u sub is $$y=\frac{1}{2}+\frac{c}{e^{x^{2}}}$$

I don't understand why I'm getting a different answer.

If I take $u = x$ and $\frac{dv}{dx} = e^{x^{2}}$

Using integration by parts I get $$\int{xe^{x^{2}}}=x\left(\frac{1}{2x}e^{x^{2}}\right)-\int\frac{1}{2x}e^{x^{2}}dx$$

Can anyone explain what am I doing wrong, or why this is getting me different answer? Or why can I not use to it to get the same answer?

Thank you to whoever can tell me what I'm doing wrong.

  • $\begingroup$ Well for one, $\frac{d}{dx}\left(\frac{1}{2x}e^{x^2}\right)\neq e^{x^2}$. In fact, there is no expression for $v$ such that $\frac{dv}{dx}=e^{x^2}$. $\endgroup$
    – Angelica
    Nov 26, 2021 at 4:34
  • 4
    $\begingroup$ @Angelica it's not true that "there is no expression" for a function with derivative $e^{x^2}$. For instance, $v(x) = \int_0^x e^{t^2}\,dt$ is an expression such that $dv/dx= e^{x^2}$. What $e^{x^2}$ lacks is an elementary antiderivative in the technical sense of elementary functions. It does not lack a derivative at all. Indeed, one way of describing the fundamental theorem of calculus is that it shows every continuous function on an interval has an antiderivative on that interval (like the continuous function $e^{x^2}$ on $(-\infty,\infty)$). $\endgroup$
    – KCd
    Nov 26, 2021 at 4:39
  • 1
    $\begingroup$ The error comes from the integration of $e^{x^2}$, indeed, the integral of that function does not have a closed form in terms of elementary functions. $\endgroup$
    – Tom Keen
    Nov 26, 2021 at 4:42
  • $\begingroup$ @KCd That's what I meant, I guess I should have been more specific that any expression for $v$ is probably not going to be useful for integrating $\endgroup$
    – Angelica
    Nov 26, 2021 at 4:45
  • $\begingroup$ Insisting that a tool as fundamental as integration by parts gives one the wrong answer is typically indicative of a fault of the user and "probably" not the tool $\endgroup$ Nov 26, 2021 at 5:21

4 Answers 4


As mentioned in the comments, you make a mistake when you assume

$$\frac{dv}{dx}=e^{x^2} \implies v=\frac{e^{x^2}}{2x}$$

This is not true (use the quotient rule and check for yourself!). $e^{x^2}$ has no elementary antiderivatives: in other words, you can't integrate it and get a result in terms of elementary functions, like polynomial functions, trigonometric functions, exponential functions, etc.

I attempted to perform the integration by parts with $\frac{dv}{dx}=x$ and $u=e^{x^2}$, and unless I made a mistake somewhere in my calculations, you end up subtracting an integral that has $e^{x^2}$ multiplied by higher powers of $x$, so you get nowhere*. I would suggest the $u$-substitution method instead as you have described it.

* Actually, I just found this answer which manages to do it, but only through the use of infinite series. So it is possible, but I doubt this is really worth all that work.

  • $\begingroup$ Thank you sm man. I guess my assumption was completely flawed but now that you say it it makes a lot of sense. I wonder if e to the power of all powers of x do not have an elementary integral. I'm only in highschool so I'm still learning. I'll definitely try to discover this myself. $\endgroup$ Nov 27, 2021 at 6:04

$$\int x e^{x^2}dx $$

Is immediate being the integrand in the form $f' e ^f$.

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


You have, $$ e^{x^2}y=\int xe^{x^2}dx=\frac{1}{2}\int d(e^{x^2})=\frac{1}{2}(e^{x^2}+C) $$ where $C$ is the constant of integration. Therefore, $$ y= \frac{1}{2}(1+ Ce^{-x^2}) $$ which satisfies the differential equation.


I will just add, that you can solve this ordinary differential equation in a simpler way. This ordinary differential equation is separable.

$$\dfrac{dy}{dx} = x -2xy$$ $$\dfrac{dy}{dx} = x(1-2y)$$ $$\dfrac{dy}{1-2y}=xdx$$ $$-\dfrac{1}{2}\ln (1-2y) = \dfrac{1}{2}x^2 - \dfrac{1}{2}c$$ $$\ln(1-2y)=c-x^2$$ $$1-2y=\exp(c)\exp(-x^2)$$ $$y=\dfrac{1-\exp(c)\exp(-x^2)}{2}$$ $$y=\dfrac{1}{2}-c_0\exp(-x^2)$$

Our solution implies $1-2y>0 \implies y<1/2$. Hence, $c_0>0$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .