# Math Help - differential equation...

1. ## differential equation...

4) Solve: $\frac{dy}{dx} + y = x$
I don't even know what I'm supposed to do on this one...

2. Originally Posted by jangalinn
4) Solve: $\frac{dy}{dx} + y = x$
I don't even know what I'm supposed to do on this one...
This equation is in the form $y'+P(x)y = Q(x)$, thus we have to use the 'Integrating Factor' method.

$IF = e^{\int 1 \ \mathrm{d}x} = e^{x}$

Can you continue?

Spoiler:
1.) Multiply the original equation with the integrating factor.
2.) Solve both sides of the equation. (By Integration).

This website has a pdf file which explains the Integrating Factor method. However, it also has the solution to your question. It also has many other question which you could practice. Link

3. Originally Posted by jangalinn
4) Solve: $\frac{dy}{dx} + y = x$
I don't even know what I'm supposed to do on this one...
Since you are given an equation, I imagine you are supposed to find the general solution!

There are two ways to do this:
1) Find an integrating factor. That is, find some function u(x) so that multiplying the equation by u(x) makes the left side an "exact differential"- so that $u(x)\frac{dy}{dx}+ u(x)y= \frac{d(u(x)y)}{dx}$. Using the product rule on the right side of that, $\frac{d(u(x)y)}{dx}= u(x)\frac{dy}{dx}+ \left(\frac{du}{dx}\right)y$ so our requirement on u(x) becomes $u(x)\frac{dy}{dx}+ u(x)y= u(x)\frac{dy}{dx}+ \left(\frac{du}{dx}\right)y$. That means we must have $\frac{du}{dx}y= u(x)y$ or $\frac{du}{dx}= u$, a separable equation for u. It "separates" as $\frac{du}{u}= dx$ which integrates to $ln(u)= x+ C$. Taking exponentials of both sides, $u(x)= C'e^x$. We don't need the general solution so take C'= 1, $u(x)= e^x$.

Now $e^x (\frac{dy}{dx}+ y)= \frac{d(e^xy)}{dx}= xe^x$
integrating the left sides just gives $e^xy$ while we can integrate the right side using "integration by parts": Let u= x, $dv= e^x$ so that du= dx and $v= e^x$. $\int xe^x dx= xe^x- \int e^xdx= xe^x- e^x= e^x(x- 1+ C$. So $e^xy= e^x(x-1)+ C$ and $y= x- 1+ Ce^{-x}$

2) Separate into "homogeneous" and "non-homogeneous" parts. That is, first find the general solution to the "homogeneous" part, $\frac{dy}{dx}+ y= 0$. That is the same as $\frac{dy}{dx}= -y$ which separates to $\frac{dy}{y}= -dx$. Integrating both sides, ln(y)= -x+ C so $y= C' e^{-x}$ where $C'= e^C$.

Now try to find a "specific", single, solution to $\frac{dy}{dx}+ y= x$. Since we are only trying to find a single solution rather than the general solution we can try "guessing". (educated guessing, of course!) Since the right hand side of the equation is "x", try y= Ax+ B. Then $\frac{dy}{dx}= A$ and the equation becomes A+ Ax+ B= x. Since that must be true for all x, taking x= 0, we get A+ B= 0 or B= -A. Replacing B by -A gives Ax= x and, taking x= 1, A= 1 so B= -1. y(x)= x- 1 satisfies the differential equation $\frac{dy}{dx}+ y= x$

Finally, we add the general solution to the homogenous equation to the specific solution to the non-homogeneous equation to get the general solution to the entire equation: $y(x)= C'e^{-x}+ x- 1$ as before.

The second method is easier but requires more theory.