How do I solve this differential equation?

#y'=2xy+x#

1 Answer
Mar 26, 2018

#=> y = Ce^(x^2)-1/2#

where #C# is a arbitrary integration constant.

Explanation:

#=>y' = 2xy +x#

First, get all terms with #y# or its derivatives on one side:

#=>y' - 2xy = x#

Next, construct the integrating factor:

#=>e^(\int-2xdx)=e^(-x^2)#

Now multiply both sides of the equation by the integrating factor:

#=>e^(-x^2)y' - 2xe^(-x^2)y = xe^(-x^2)#

We can now notice that the left hand side is of the form of the product rule:

#=>d/(dx)f(x)g(x)=f(x)g'(x)+f'(x)g(x)#

So we can condense the LHS to get:

#=>d/(dx)(e^(-x^2)y) = xe^(-x^2)#

Let's move the #dx# to the RHS and integrate both sides:

#=>int d(e^(-x^2)y) = int xe^(-x^2)dx#

Integrating:

#=>e^(-x^2)y = int xe^(-x^2)dx#

We can substitute #u equiv -x^2#.
This means #du = -2xdx#

Substituting:

#=>e^(-x^2)y = -1/2 int e^u du#

#=>e^(-x^2)y = -1/2 e^u + C#

#=>e^(-x^2)y = -1/2 e^(-x^2) + C#

Solving for #y#:

#=>y = -1/2 e^(-x^2)e^(x^2) + Ce^(x^2)#

#=> y = Ce^(x^2)-1/2#

where #C# is a arbitrary integration constant.