Solving first order differential equations

So for this one I'm having trouble isolating for y. If its not possible then in the form with dy with the y variable and x with the x variable.

$$\frac{dy}{dx}-2xy=e^{x^{2}}.$$

• This isn't a separable equation. A better strategy is to look for an integrating factor. – Semiclassical Sep 18 '14 at 5:13

If you have a differential equation of the form $$\frac{dy}{dx} + a(x) y(x) = b(x) \tag{1}$$ we call the equation a first-order linear ODE and we can obtain it's solution using the following method. First, we multiply both sides of $(1)$ by a function $f(x)$ (called the integrating factor) and we obtain $$f y' + fay = fb \tag{2}$$ Using the product rule $(fy)' = fy' + f'y$, we can rewrite $(2)$ as $$(fy)' - f'y + fay = fb \Longrightarrow (fy)' + y \left(f' + fa \right) = fb \tag{3}$$

If it is the case that $f' + fa = 0$, then the LHS of $(3)$ is just $(fy)'$, and integrating both sides would yield an expression for $fy$. So let's solve for the $f$ that guarantees that $f' + fa = 0$. Solving this separable differential equation for $f$, we get that $$\frac{df}{dx} = f'(x) = -f(x)a(x) \Longrightarrow \frac{df}{f(x)} = a(x) dx \Longrightarrow \log(f(x)) = \int a(x) dx \Longrightarrow f(x) = e^{\int a(x) dx}$$

Using the $f$ we just found, $(3)$ therefore reduces to $$(fy)' = fb \Longrightarrow fy = \int fb \: dx \Longrightarrow y = \frac{\int fb \: dx}{f}$$

Plugging in our formula for $f(x)$, we get that the solution to $(1)$ is $$y(x) = \displaystyle\frac{\displaystyle\int \left(b(x) \: e^{\int a(x) dx} \right) dx}{e^{\int a(x) dx}}$$

Now, noting that $a(x) = -2x$ and $b(x) = e^{x^2}$ in your example, we see that $$y(x) = \displaystyle\frac{\displaystyle\int \left(e^{x^2} \: e^{\int -2x dx} \right) dx}{e^{\int -2x dx}} = \frac{\displaystyle\int \left(e^{x^2} e^{-x^2}\right)dx}{e^{x^2}} = \frac{\int e^0 dx}{e{x^2}} = \frac{x+c}{e^{x^2}} \Longrightarrow \boxed{y(x) = xe^{-x^2} + c e^{-x^2}}$$

Hint : Multiply throughout by the integrating factor, $e^{\int -2x dx} = e^{-x^2}$.

Then notice that \begin{align}\frac{d}{dx}(e^{-x^2}y) &= e^{-x^2}\frac{dy}{dx} - 2e^{-x^2}xy\\&=LHS\end{align}

Rewrite the equation like this:

$$e^{-x^2}\frac{dy}{dx}-2xe^{-x^2}y=1$$

Notice that if we apply the product rule in differentiating $ye^{-x^2}$ with respect to $x$, that we get exactly the left hand side. In other words, the equation is equivalent to:

$$\frac{d(e^{-x^2}y)}{dx}=1$$

Integrating both sides yields:

$$e^{-x^2}y=x+c\implies y=xe^{-x^2}+ce^{-x^2}.$$

This kind of technique can be generalised to the method of 'integrating factors', however it happens to work out nicely enough here that you can just follow your nose.

Hint

Because of the rhs, suppose that you define $y(x)=z(x)e^{x^2}$; then the differential equation write $$x z'(x)+z(x)=0$$ which is quite easy to integrate for $z(x)$.

I am sure that you can take from here.