# Thread: 1st order linear differential equation

1. ## 1st order linear differential equation

can anyone explain me the principle to solve:

$\displaystyle y' + 2y = x^2$

2. This equation is first-order linear. There's a procedure called variation of parameters, or the integrating factor method, that you can use to solve this equation. Take a look here for detailed instructions on solving these equations, along with some examples.

3. Consider a DE of the form

$\displaystyle \displaystyle \frac{dy}{dx} + P\,y = Q$ where $\displaystyle \displaystyle y, P, Q$ are all functions of $\displaystyle \displaystyle x$ and you hope to solve the DE for $\displaystyle \displaystyle y$. We call this type of DE First-Order Linear.

What we aim to do is to find a function of $\displaystyle \displaystyle x$, which we will call $\displaystyle \displaystyle I$ (I use $\displaystyle \displaystyle I$ because it's called the Integrating Factor) which will enable us to write the LHS as a single derivative.

Let's say we had multiplied both sides by $\displaystyle \displaystyle I$. That would give

$\displaystyle \displaystyle I\,\frac{dy}{dx} + I\,P\,y = I\,Q$.

Now let's take a closer look at the product rule.

If you wished to find the derivative of $\displaystyle \displaystyle f\,y$, where $\displaystyle \displaystyle f$ and $\displaystyle \displaystyle y$ are functions of $\displaystyle \displaystyle x$. Using the product rule this would give

$\displaystyle \displaystyle \frac{d}{dx}(f\,y) = f\,\frac{dy}{dx} + \frac{df}{dx}\,y$.

The LHS of your DE (after multiplying by $\displaystyle \displaystyle I$) looks suspiciously similar. In fact, if $\displaystyle \displaystyle I = f$ and $\displaystyle \displaystyle I\,P = \frac{df}{dx}$, then it IS in fact a product rule expansion. Note that if $\displaystyle \displaystyle I=f$ then $\displaystyle \displaystyle \frac{dI}{dx} = \frac{df}{dx}$.

Substituting gives $\displaystyle \displaystyle I\,P = \frac{dI}{dx}$, which is separable, and solving for $\displaystyle \displaystyle I$ gives

$\displaystyle \displaystyle P = \frac{1}{I}\,\frac{dI}{dx}$

$\displaystyle \displaystyle \int{P\,dx} = \int{\frac{1}{I}\,\frac{dI}{dx}\,dx}$

$\displaystyle \displaystyle \int{P\,dx} = \int{\frac{1}{I}\,dI}$

$\displaystyle \displaystyle \int{P\,dx} + C = \ln{|I|}$

$\displaystyle \displaystyle Ae^{\int{P\,dx}} = I$ where $\displaystyle \displaystyle A = \pm e^C$.

Any value of $\displaystyle \displaystyle A$ will work when we multiply the DE by the integrating factor, so we choose $\displaystyle \displaystyle A = 1$ for simplicity.

So you will need to multiply through by your integrating factor, which is of the form $\displaystyle \displaystyle e^{\int{P\,dx}}$, and that will reduce your LHS into a product rule expansion, which will then make the function integrable.

$\displaystyle \displaystyle \frac{dy}{dx} + 2y = x^2$.

Notice that your $\displaystyle \displaystyle P = 2$, thus your integrating factor is $\displaystyle \displaystyle e^{\int{2\,dx}} = e^{2x}$.

Multiplying through by your integrating factor gives

$\displaystyle \displaystyle e^{2x}\,\frac{dy}{dx} + 2e^{2x}y = x^2e^{2x}$

$\displaystyle \displaystyle \frac{d}{dx}(e^{2x}y) = x^2e^{2x}$ (check using the product rule...)

$\displaystyle \displaystyle e^{2x}y = \int{x^2e^{2x}\,dx}$

$\displaystyle \displaystyle e^{2x}y = \frac{1}{2}x^2e^{2x} - \int{x\,e^{2x}\,dx}$

$\displaystyle \displaystyle e^{2x}y = \frac{1}{2}x^2e^{2x} - \left(\frac{1}{2}x\,e^{2x} - \int{\frac{1}{2}e^{2x}\,dx}\right) + C$

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

$\displaystyle \displaystyle y = \frac{1}{2}x^2 - \frac{1}{2}x + \frac{1}{4} + Ce^{-2x}$.

4. thanks a lot for your explanation