# exact solution?

If you have thge differential equation (dy/dx)=x + y, with initial condition Y(0)=1, how do you find the exact solution?

I can find the approximation using Euler's Method, but how do you solve that differential to solve the initial-value problem exactly?

Relevance

another way is to write it as a linear equation

(dy/dx) - y =x

P = -1 , Q = x

integrating factor = e^{integral P dx} = e^(-x)

solution is y*(I.F.) = integral {Q*(I.F.)}

that is y*{e^(-x)} = integral {x * e^(-x)}

using integration by parts,

y*{e^(-x)} = { -x * e^(-x)} - { e^(-x)} + C

or multiplying by e^x

y = -x -1 +C e^x

now apply the given condition y = 1 when x =0

to get C =2

• dy/dx-y=x

Let g=e^(-x). Multiply by g:

g dy/dx - gy = gx

g dy/dx + y dg/dx = gx

This is simply the product rule applied to gy. So:

d(gy)/dx = gx

gy = ∫gx dx

ye^(-x) = ∫xe^(-x) dx

Apply integration by parts:

ye^(-x) = -xe^(-x) +∫e^(-x) dx

ye^(-x) = -xe^(-x) - e^(-x) + C

Divide by g:

y = -x - 1 + Ce^x

Plug in the initial condition:

1=-1+C

C=2

Thus the explicit solution is:

y= -x - 1 +2e^x