# Homework Help: Yet another first order differential equation

1. Aug 18, 2014

### squareroot

1. The problem statement, all variables and given/known data
okey, so i got stuck at another step in the way of solving de's.I've been studying DE of this form:

y' + P(x)y = Q(x)

2. Relevant equations

3. The attempt at a solution

So, first we solve y' + P(x)y=0 for y. $$\frac{dy}{y} = -P(x)dx$$ , we integrate this and get that $$\int \frac{1}{y}\,dy = -\int P(x)\,dx$$ $$ln(y) + C= -\int P(x)\,dx$$ $$y= e^{-C-\int P(x)\,dx}$$ this is my attempt to solve but the textbook says that the answer is $$C(x)e^{-\int P(x)\,dx }$$ . I don't understand that C(x)...Isn't C just a constant?Why does it depend on x?

Thank you
1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution
1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution
1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution
1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution
1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution

2. Aug 18, 2014

### crossfire234

Well this would be extremely subtle for me as I would have done the same thing you have, but I think since you are integrating with respect to y on the left, C can be C(x) since when differentiated with respect to y it would disappear.

Thinking it over again, you would then have to differentiate to check your answer.

Differentiating the y they say is the answer would require the product and chain rules to obtain:

$$y' = C'(x)e^{-\int P(x) dx} - P(x)C(x)e^{-\int P(x) dx}$$

Now we check to see if this solves the homogeneous equation:

$$y' + P(x)y = 0$$

$$C'(x)e^{-\int P(x) dx} - P(x)C(x)e^{-\int P(x) dx} + P(x)C(x)e^{-\int P(x)dx} = 0$$

The last two terms cancel, then we divide the exponential function with the C'(x) and find that:

$$C'(x) = 0$$ which would imply that C(x) is NOT a function of x. I don't know what your book is trying to say now D:.

Good luck!

Last edited: Aug 18, 2014
3. Aug 18, 2014

### ehild

$y=Ce^{-\int P(x)\,dx }$ is solution of the homogeneous equation y' + P(x)y = 0, but you need the solution of the equation y' + P(x)y = Q(x), and you try to find a particular solution in the form $y=C(x)e^{-\int P(x)\,dx }$.

See

http://www.math.vt.edu/people/renardym/class_home/firstorder/node1.html

ehild

4. Aug 18, 2014

### pasmith

The method of solving $$y' + P(x)y = Q(x)$$ is to multiply both sides by $e^{\int P(x)\,dx}$ to obtain $$e^{\int P(x)\,dx}y' + e^{\int P(x)\,dx}P(x)y = \frac{d}{dx}\left(ye^{\int P(x)\,dx}\right) = e^{\int P(x)\,dx} Q(x).$$ Hence $$ye^{\int P(x)\,dx} = \int e^{\int P(x)\,dx} Q(x)\,dx \equiv C(x)$$

5. Aug 19, 2014

### squareroot

I ve looked over the link you posted but there they say "let C be eK , where K is a constant but in my textbook they wrote C(x) as if C depends on the value of x, but if C depends on x then C is no longer a constant...

6. Aug 19, 2014

### ehild

ehild

7. Aug 21, 2014

### rjr

pasmith has the best response so far....just to expand a bit though...

In order to solve the first order linear nonhomogenous differential equation: y'(x) + P(x)y(x) = Q(x) , you do have to solve the homogenous form of this equation, but in a slightly different way - let me explain by using the technique known as the "integrating factor" (which is essentially what pasmith did).

we start with the original nonhomogenous differential equation: y'(x) + P(x)y(x) = Q(x)

I am going to create a new variable μ(x), which will be our integrating factor, such that:

μ(x)[y'(x) + P(x)y(x) = Q(x)]

⇔ μ(x)y'(x) + μ(x)P(x)y(x) = μ(x)Q(x) {Equation 1}

1). if we differentiate μ(x)y(x) using the product rule, what do we obtain?

→ u = μ(x), u' = μ'(x), v = y(x), v' = y'(x)

so d/dx[μ(x)y(x)] = u'v + v'u

so d/dx[μ(x)y(x)] = μ(x)y'(x) + μ'(x)y(x) ...but wait doesn't this look familiar?

well if μ'(x) was equal to μ(x)P(x), then it would read: d/dx[μ(x)y(x)] = μ(x)y'(x) + μ(x)P(x)y(x) which we know from {Equation 1} must be equal to μ(x)Q(x)

2). now we want to create μ(x) such that: μ'(x) = μ(x)P(x)

and thus: d/dx[μ(x)y(x)] = μ(x)y'(x) + μ'(x)y(x) = μ(x)Q(x)

ergo, d/dx[μ(x)y(x)] = μ(x)q(x)

⇔ ∫d/dx[μ(x)y(x)]dx = ∫μ(x)q(x)dx

⇔ μ(x)y(x) = ∫μ(x)q(x)dx

∴ y(x) = [1/μ(x)] * ∫μ(x)q(x)dx

3). great, we have a value for y(x), but it's still in terms of our integrating factor...so what is this integrating factor actually equal to??

we already created μ(x) such that μ'(x) = μ(x)P(x), so now we have to FIND μ(x) such that μ'(x) = μ(x)P(x)

⇔ μ'(x) - μ(x)P(x) = 0 //this is where you solve for the "homogenous" differential equation, which you already did...this is just in terms of μ(x) instead of y(x)//

⇔ μ(x) = C * exp(∫P(x)dx) //note that this integral within e's exponent has NO constant of integration when you are actually solving//

4). so putting this all together we now have:

y(x) = [1/μ(x)] * ∫μ(x)q(x)dx where μ(x) = C * exp(∫P(x)dx)

hope this helps!

8. Aug 26, 2014

### crossfire234

Excellent! :D