# What is the general solution of the differential equation? :  dy/dx = x+2y

Feb 9, 2018

The General Solution is:

$y = - \frac{1}{2} x - \frac{1}{4} + C {e}^{2 x}$

#### Explanation:

We can use an integrating factor when we have a First Order Linear non-homogeneous Ordinary Differential Equation of the form;

$\frac{\mathrm{dy}}{\mathrm{dx}} + P \left(x\right) y = Q \left(x\right)$

We have:

$\frac{\mathrm{dy}}{\mathrm{dx}} = x + 2 y$

Which we can write as:

$\frac{\mathrm{dy}}{\mathrm{dx}} - 2 y = x$ ..... [A]

This is a First Order Ordinary Differential Equation in Standard Form. So we compute and integrating factor, $I$, using;

$I = {e}^{\int P \left(x\right) \mathrm{dx}}$
$\setminus \setminus = \exp \left(\int \setminus - 2 \setminus \mathrm{dx}\right)$
$\setminus \setminus = \exp \left(- 2 x\right)$
$\setminus \setminus = {e}^{- 2 x}$

And if we multiply the DE [A] by this Integrating Factor, $I$, we will have a perfect product differential;

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

$\therefore \frac{d}{\mathrm{dx}} \left(y {e}^{- 2 x}\right) = x {e}^{- 2 x}$

This has transformed our initial ODE into a Separable ODE, so we can now "separate the variables" to get::

$y {e}^{- 2 x} = \int \setminus x {e}^{- 2 x} \setminus \mathrm{dx}$

We can proceed via an application of integration by Parts

Let $\left\{\begin{matrix}u & = x & \implies \frac{\mathrm{du}}{\mathrm{dx}} & = 1 \\ \frac{\mathrm{dv}}{\mathrm{dx}} & = {e}^{- 2 x} & \implies v & = - \frac{1}{2} {e}^{- 2 x}\end{matrix}\right.$

Then plugging into the IBP formula:

$\int \setminus \left(u\right) \left(\frac{\mathrm{dv}}{\mathrm{dx}}\right) \setminus \mathrm{dx} = \left(u\right) \left(v\right) - \int \setminus \left(v\right) \left(\frac{\mathrm{du}}{\mathrm{dx}}\right) \setminus \mathrm{dx}$

We have:

$\int \setminus \left(x\right) \left({e}^{- 2 x}\right) \setminus \mathrm{dx} = \left(x\right) \left(- \frac{1}{2} {e}^{- 2 x}\right) - \int \setminus \left(- \frac{1}{2} {e}^{- 2 x}\right) \left(1\right) \setminus \mathrm{dx}$
$\therefore \int \setminus x {e}^{- 2 x} \setminus \mathrm{dx} = - \frac{1}{2} x {e}^{- 2 x} + \frac{1}{2} \setminus \int \setminus {e}^{- 2 x} \setminus \mathrm{dx}$
$\text{ } = - \frac{1}{2} x {e}^{- 2 x} - \frac{1}{4} {e}^{- 2 x} + C$

Using this result, we can write the DE Solution as :

$y {e}^{- 2 x} = - \frac{1}{2} x {e}^{- 2 x} - \frac{1}{4} {e}^{- 2 x} + C$

$\therefore y = - \frac{1}{2} x - \frac{1}{4} + C {e}^{2 x}$