# Assistance needed for this ODE problem

#### heaviside

##### New member
Hi,

The problem I am trying to solve is in a section on first order ODEs. It is problem 25 in section 2.1 of Boyce & DiPrima's Elementary Diff Eq (5th Ed). The problem serves as an introduction to the variation of parameters, but again, it is in the first section of the book that introduces first order ODEs.

Find A(x) from (i). Then substitute for A(x) in (ii). Verify that the solution verifies with (iii).

(i)
$$\displaystyle A'(x) = g(x) \exp \lbrack \int p(x)\,dx \rbrack$$

(ii)
$$\displaystyle y = A(x) \exp \lbrack -\int p(x)\,dx \rbrack$$

(iii)
$$\displaystyle y = \frac{\int \mu(x)g(x)dx + c}{\mu(x)}$$

This is what I have so far:

Integrate (by parts) equation (i):
$$\displaystyle \int udv = uv-\int vdu$$
Let
$$\displaystyle u = \exp \lbrack \int p(x)\,dx \rbrack$$
$$\displaystyle du = p(x) \exp \lbrack \int p(x)\,dx \rbrack$$
$$\displaystyle v = g(x)$$
$$\displaystyle dv=g'(x)$$

This yields:
$$\displaystyle A(x)=g(x) \exp \lbrack \int p(x)\,dx \rbrack - \int g(x)p(x) \exp \lbrack \int p(x)\,dx \rbrack dx$$

Putting this into equation (ii), yields:
$$\displaystyle y = \lgroup g(x) \exp \lbrack \int p(x)\,dx \rbrack - \int g(x)p(x) \exp \lbrack \int p(x)\,dx \rbrack dx \rgroup \bullet \exp \lbrack - \int p(x)\,dx \rbrack$$
and thus (iv)
$$\displaystyle y = g(x) - \lgroup \int g(x)p(x) \exp \lbrack \int p(x)\,dx \rbrack dx \rgroup \bullet \exp \lbrack - \int p(x)\,dx \rbrack$$

Now, I perform integration by parts again on the term in round brackets above:
Let
$$\displaystyle u = g(x)$$
$$\displaystyle du = g'(x)$$
$$\displaystyle v = \exp \lbrack \int p(x)\,dx \rbrack$$
$$\displaystyle dv = p(x) \exp \lbrack \int p(x)\,dx \rbrack$$

This yields:
$$\displaystyle g(x)\exp \lbrack \int p(x)\,dx \rbrack - \int g'(x) \exp \lbrack \int p(x)\,dx \rbrack dx$$

Now (iv) becomes
$$\displaystyle y = g(x) - \lgroup g(x)\exp \lbrack \int p(x)\,dx \rbrack - \int g'(x) \exp \lbrack \int p(x)\,dx \rbrack dx \rgroup \exp \lbrack - \int p(x)\,dx \rbrack$$
Simplifying:
$$\displaystyle y = \frac{\int g'(x)\exp \lbrack \int p(x)\,dx \rbrack dx}{\exp \lbrack \int p(x)\,dx \rbrack}$$

Now the book defines
$$\displaystyle \mu(x) = \exp \lbrack \int p(x)\,dx \rbrack$$

Therefore, what I have is:
$$\displaystyle y=\frac{\int \mu(x)g'(x)dx + c}{\mu(x)}$$

Compare this to (iii) - you will see I have $$\displaystyle g'(x)$$ instead of $$\displaystyle g(x)$$.

So my question is: where did I go wrong. I've been looking over this for hours.

Thanks,
heaviside

#### Ackbach

##### Indicium Physicus
Staff member
Re: Assistance needed for this ODE problame

Hi,

The problem I am trying to solve is in a section on first order ODEs. It is problem 25 in section 2.1 of Boyce & DiPrima's Elementary Diff Eq (5th Ed). The problem serves as an introduction to the variation of parameters, but again, it is in the first section of the book that introduces first order ODEs.

Find A(x) from (i). Then substitute for A(x) in (ii). Verify that the solution verifies with (iii).

(i)
$$\displaystyle A'(x) = g(x) \exp \lbrack \int p(x)\,dx \rbrack$$

(ii)
$$\displaystyle y = A(x) \exp \lbrack -\int p(x)\,dx \rbrack$$

(iii)
$$\displaystyle y = \frac{\int \mu(x)g(x)dx + c}{\mu(x)}$$

This is what I have so far:

Integrate (by parts) equation (i):
$$\displaystyle \int udv = uv-\int vdu$$
Let
$$\displaystyle u = \exp \lbrack \int p(x)\,dx \rbrack$$
$$\displaystyle du = p(x) \exp \lbrack \int p(x)\,dx \rbrack$$
$$\displaystyle v = g(x)$$
$$\displaystyle dv=g'(x)$$
I'm assuming you meant $dv = g'(x) \, dx$. Remember the Golden Rule of Differentials: if you have a differential on one side of an equation, you must have a differential on the other side as well.

This is not what you have in your integral. For by-parts, the integral you start with has to be the $\displaystyle \int u \, dv$. So you're saying, by setting up the by-parts this way, that your original integral is $\displaystyle \int g'(x) e^{ \int p(x) \, dx} \, dx$. But it isn't. Your original integral is $\displaystyle \int g(x) e^{ \int p(x) \, dx} \, dx$.

Try propagating this correction through your derivations, and see if it comes out right.

This yields:
$$\displaystyle A(x)=g(x) \exp \lbrack \int p(x)\,dx \rbrack - \int g(x)p(x) \exp \lbrack \int p(x)\,dx \rbrack dx$$

Putting this into equation (ii), yields:
$$\displaystyle y = \lgroup g(x) \exp \lbrack \int p(x)\,dx \rbrack - \int g(x)p(x) \exp \lbrack \int p(x)\,dx \rbrack dx \rgroup \bullet \exp \lbrack - \int p(x)\,dx \rbrack$$
and thus (iv)
$$\displaystyle y = g(x) - \lgroup \int g(x)p(x) \exp \lbrack \int p(x)\,dx \rbrack dx \rgroup \bullet \exp \lbrack - \int p(x)\,dx \rbrack$$

Now, I perform integration by parts again on the term in round brackets above:
Let
$$\displaystyle u = g(x)$$
$$\displaystyle du = g'(x)$$
$$\displaystyle v = \exp \lbrack \int p(x)\,dx \rbrack$$
$$\displaystyle dv = p(x) \exp \lbrack \int p(x)\,dx \rbrack$$

This yields:
$$\displaystyle g(x)\exp \lbrack \int p(x)\,dx \rbrack - \int g'(x) \exp \lbrack \int p(x)\,dx \rbrack dx$$

Now (iv) becomes
$$\displaystyle y = g(x) - \lgroup g(x)\exp \lbrack \int p(x)\,dx \rbrack - \int g'(x) \exp \lbrack \int p(x)\,dx \rbrack dx \rgroup \exp \lbrack - \int p(x)\,dx \rbrack$$
Simplifying:
$$\displaystyle y = \frac{\int g'(x)\exp \lbrack \int p(x)\,dx \rbrack dx}{\exp \lbrack \int p(x)\,dx \rbrack}$$

Now the book defines
$$\displaystyle \mu(x) = \exp \lbrack \int p(x)\,dx \rbrack$$

Therefore, what I have is:
$$\displaystyle y=\frac{\int \mu(x)g'(x)dx + c}{\mu(x)}$$

Compare this to (iii) - you will see I have $$\displaystyle g'(x)$$ instead of $$\displaystyle g(x)$$.

So my question is: where did I go wrong. I've been looking over this for hours.

Thanks,
heaviside

#### heaviside

##### New member
That's it!!

I just went through it again, with the change you suggested, and with more care. And the solution came out.

Thank you Ackbach!

#### Ackbach

##### Indicium Physicus
Staff member
That's it!!

I just went through it again, with the change you suggested, and with more care. And the solution came out.

Thank you Ackbach!
You're very welcome! Have a good one.