Separable 1st Order Differential Equations with Integrating factors

Strategy: to separate out the dy and dx terms and then integrate both sides of the equation to solve for y

(Ex 1) Find the general solution to the following differential equation:

$$y' + \frac{y}{x} = 3cos(2x)\quad(1)$$

Recall that for a 1st order differential equation of the form:

$$\frac{dy}{dx}+p(x)y=g(x)$$

We can obtain an integrating factor {u(x)} using the following:

$$u(x)=e^{\int_{}^{}p(x) dx} $$

...and in our example the integrating factor is:

$$u(x)= e^{\int_{}^{}\frac{1}{x} dx}$$

$$u(x)= e^{ln |x|}$$

$$u(x)= x$$

We now multiply equation (1) by our integrating factor u(x):

$$x[y' + \frac{y}{x}] = x[3cos(2x)]\quad(2)$$

$$x\frac{dy}{dx} + y = 3xcos(2x)\quad(3)$$

Now recall that if we were to use the product rule for derivatives (in reverse) we can rewrite the left side of the equation as:

$$\frac{d}{dx}xy$$

If that last part seems confusing, try using the product rule to take the derivative of xy with respect to x and you will see that it equals the left side of equation number 3

So we now have:

$$\frac{d}{dx}xy = 3xcos(2x)\quad(4) $$

Now integrate both sides with respect to x

$$\int_{}^{}\frac{d}{dx} xy \>dx = 3\int_{}^{}xcos(2x)\> dx$$

Using integration by parts (or the tabular method) for the right side of the equation and we arrive at:

$$xy = \frac{3x}{2}sin(2x)+\frac{3}{4}cos(2x)+C $$

Finally, solving for y gives us the following general solution:

$$y = \frac{3}{2}sin(2x)+\frac{3}{4x}cos(2x)+\frac{C}{x} $$