# Logan's question at Yahoo! Answers involving an IVP with a linear 1st order ODE

Staff member

#### MarkFL

Staff member
Hello Logan,

We are given the first order linear IVP to solve:

$$\displaystyle 2\frac{dy}{dx}-4xy=8x$$ where $$\displaystyle y(0)=12$$

To find the general solution to the ODE, I would first divide through by 2 to obtain:

$$\displaystyle \frac{dy}{dx}-2xy=4x$$

Next, let's compute the integrating factor:

$$\displaystyle \mu(x)=e^{-2\int x\,dx}=e^{-x^2}$$ which gives us:

$$\displaystyle e^{-x^2}\frac{dy}{dx}-2xe^{-x^2}y=4xe^{-x^2}$$

Now we may rewrite the left side as the differentiation of a product:

$$\displaystyle \frac{d}{dx}\left(e^{-x^2}y \right)=4xe^{-x^2}$$

Integrate with respect to $x$:

$$\displaystyle \int\,d\left(e^{-x^2}y \right)=-2\int e^{-x^2}(-2x\,dx)$$

$$\displaystyle e^{-x^2}y=-2e^{-x^2}+C$$

Multiply through by $$\displaystyle e^{x^2}$$:

$$\displaystyle y(x)=-2+Ce^{x^2}$$

Now, use initial conditions to determine the parameter $C$:

$$\displaystyle y(0)=-2+Ce^{0^2}=12\implies C=14$$

and so the solution satisfying the IVP is:

$$\displaystyle y(x)=14e^{x^2}-2$$

To Logan and any other guests viewing this topic, I invite and encourage you to post other ODE problems in our Differential Equations forum.

Best Regards,

Mark.

#### LLand314

##### Member
Could you explain how you computed the integral factor some more? For example how did you know and come up with μ(x)=e−2∫xdx=e−x2 ?

Thanks

#### MarkFL

Staff member
It is the standard method used to compute the integrating factor, which makes it possible to rewrite the left side as the product of a differentiation.

Consider the linear ODE in standard form:

$$\displaystyle \frac{dy}{dx}+P(x)y=Q(x)$$

Now, if we multiply through by the integrating factor $$\displaystyle \mu(x)=e^{\int P(x)\,dx}$$ we get:

$$\displaystyle e^{\int P(x)\,dx}\frac{dy}{dx}+e^{\int P(x)\,dx}P(x)y=e^{\int P(x)\,dx}Q(x)$$

Observe now that:

$$\displaystyle \frac{d}{dx}\left(e^{\int P(x)\,dx}y \right)=e^{\int P(x)\,dx}\frac{dy}{dx}+e^{\int P(x)\,dx}P(x)y$$

and so the ODE may be written:

$$\displaystyle \frac{d}{dx}\left(e^{\int P(x)\,dx}y \right)=e^{\int P(x)\,dx}Q(x)$$

Integrating with respect to $x$, we have:

$$\displaystyle \int\,d\left(e^{\int P(x)\,dx}y \right)=\int e^{\int P(x)\,dx}Q(x)\,dx$$

$$\displaystyle e^{\int P(x)\,dx}y=\int e^{\int P(x)\,dx}Q(x)\,dx$$

Solving for $y$, we obtain:

$$\displaystyle y(x)=e^{-\int P(x)\,dx}\int e^{\int P(x)\,dx}Q(x)\,dx$$

#### LLand314

##### Member
Ok so if its in this form
dydx+P(x)y=Q(x)

I will always compute the integral with
μ(x)=e∫P(x)dx ?

Or only then because of P(x) in the problem

Thanks so much!

#### MarkFL

Staff member
Ok so if its in this form
dydx+P(x)y=Q(x)

I will always compute the integral with
μ(x)=e∫P(x)dx ?

Or only then because of P(x) in the problem

Thanks so much!
Without using $\LaTeX$, I would write the integrating factor as either:

μ(x)=exp(∫P(x)dx ) or μ(x)=e^(∫P(x)dx)

Yes, this is how it is computed because of the special nature of the derivative of the exponential function with $e$ as the base. Did you understand how it allows the left side of the ODE in standard linear form to be simplified as the derivative with respect to $x$ of the product $y(x)\cdot\mu(x)$?

#### LLand314

##### Member
Without using $\LaTeX$, I would write the integrating factor as either:

μ(x)=exp(∫P(x)dx ) or μ(x)=e^(∫P(x)dx)

Yes, this is how it is computed because of the special nature of the derivative of the exponential function with $e$ as the base. Did you understand how it allows the left side of the ODE in standard linear form to be simplified as the derivative with respect to $x$ of the product $y(x)\cdot\mu(x)$?

O ok sorry I just tried to copy and paste the information, I haven't learned Latex yet. I think I kind of understand it just need to do some more problems.

moderator edit: I have moved your new question into its own topic here:

http://www.mathhelpboards.com/f17/solving-first-order-linear-initial-value-problem-4051/

Last edited by a moderator:

#### MarkFL

Staff member
Hey no worries, I was just showing you a better way to write the integrating factor, just for clarity.

I am happy you have registered and are participating here!

Last edited:

#### Prove It

##### Well-known member
MHB Math Helper
Just in case you're wondering why the Integrating Factor is $$\displaystyle \displaystyle e^{P(x)\,dx}$$, let's look at a general first order linear DE in more detail...

$$\displaystyle \frac{dy}{dx} + P\,y = Q$$, where P, Q and y are functions of x.

What we would like is to write the LHS as a single derivative, because then we would be able to solve for y by integrating. To do this, we make use of the Product Rule $$\displaystyle \displaystyle \frac{d}{dx} \left[ f\,g \right] = f\,\frac{dg}{dx} + g\,\frac{df}{dx}$$. At the moment, the LHS doesn't look like a product rule expansion, but it's possible to multiply by a function to make this so. Call this function I. Then

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

Now in order for the LHS to be a product rule expansion, then that would mean

\displaystyle \begin{align*} \frac{dI}{dx} &= I\,P \\ \frac{1}{I}\,\frac{dI}{dx} &= P \\ \int{\frac{1}{I}\,\frac{dI}{dx}\,dx} &= \int{P\,dx} \\ \int{\frac{1}{I} \,dI } &= \int{P\,dx} \\ \ln{|I|} &= \int{P\,dx} \\ I &= A\,e^{\int{P\,dx}} \end{align*}

So any value of the constant A will give an integrating factor that works, so we usually just choose the principal value with A = 1. So if we multiply both sides of the DE by $$\displaystyle \displaystyle e^{\int{P\,dx}}$$ we find

\displaystyle \displaystyle \begin{align*} e^{\int{P\,dx}}\,\frac{dy}{dx} + e^{\int{P\,dx}}\,P\,y &= e^{\int{P\,dx}}\,Q \\ \frac{d}{dx} \left( e^{\int{P\,dx}}\,y \right) &= e^{\int{P\,dx}}\,Q \\ e^{\int{P\,dx}}\,y &= \int{e^{\int{P\,dx}}\,Q\,dx} \\ y &= e^{-\int{P\,dx}}\int{e^{\int{P\,dx}}\,Q\,dx} \end{align*}

Hope that helps...