My Coding > Mathematics > First order ordinary differential equations > Solving y' + 2xy = x

# Solving y' + 2xy = x

In this lecture, I will show you how to solve the $$y\prime + 2xy = x$$ equation.

As you can see, this is a first-order differential equation, which needs to be solved with an integration factor. We can apply existing formulas to do this, but As I've told you many times, it is better to derive this formula for every equation you are dealing with - this will help you to avoid a lot of simple errors. Therefore I will show you how to do it properly. But first of all, I will show you how to use existing equations for solving.

## Using final formula for solving $$y\prime + 2xy = x$$

$y\prime + 2xy = x \Rightarrow P = 2x; Q = x$

$y = \frac{\int IQ\mathop{dx} + C}{I}; I = e^{\int P\mathop{dx}}$

$\boxed{y = \frac{\int Qe^{\int P\mathop{dx}}\mathop{dx} + C}{e^{\int P\mathop{dx}}}}$

Now use all our real data and:

$y = \frac{\int xe^{\int 2x\mathop{dx}}\mathop{dx} + C}{e^{\int 2x\mathop{dx}}} = frac{1}{2} + Ce^{-x^2}$

as simple as that.

## Proper long solution of $$y\prime + 2xy = x$$

So now let's solve it from scratch without using any fancy equation, and in fact, let's derive this equation once again

$y\prime + 2xy = x$

Multiply by integration factor:

$Iy\prime + 2xIy = Ix$

product rule:

$(Iy)\prime = Iy\prime + I\prime y$

Make orbitrary equal this product rule component to our equation:

$2xIy = I\prime y; (Iy)\prime = Ix$

$2xI = I\prime$

Now we can solve it agains I:

$\frac{\mathop{dI}}{\mathop{dx}} = 2Ix \Rightarrow \frac{\mathop{dI}}{I} = 2x\mathop{dx}$

$\int \frac{\mathop{dI}}{I} = \int 2x\mathop{dx}$

$\ln{\left|I\right|} = x^2 + C$

$e^{\ln{\left|I\right|}} = e^{x^2 + C} \Rightarrow \boxed{I = e^{x^2}}$

$(Iy)\prime = xI$

$\frac{\mathop{d}}{\mathop{dx}}(Iy) = xI$

$\mathop{d}(Iy) = xI\mathop{dx}$

$\int \mathop{d}(Iy) = \int xI\mathop{dx}$

$Iy + C_1 = \int xe^{x^2}\mathop{dx} = \frac{1}{2}e^{x^2} + C_2$

$ye^{x^2} = \frac{1}{2}e^{x^2} + C$

$\boxed{y = \frac{1}{2} + Ce^{-x^2}}$

For more details, how to solve $$y\prime + 2xy = x$$, please watch this video:

Published: 2023-05-14 02:31:57
Updated: 2023-05-14 02:32:42

### 9 popular artitles

© 2020 MyCoding.uk -My blog about coding and further learning. This blog was writen with pure Perl and front-end output was performed with TemplateToolkit.