# first order linear differential equation, ZillEx2.5Prob55

#### PG1995

Joined Apr 15, 2011
819
Hi

Regards
PG

#### Attachments

• 109.8 KB Views: 62

#### steveb

Joined Jul 3, 2008
2,436
Hi

Regards
PG
It's not clear what you are trying to do. The function f(x)=Q(x) is given to you as an input function. You must solve for y(x) as the output function.

The relation 2y=Q is only true when the dy/dx is zero, which is not true in general.

Your first step might be to substitute P(x) into the general solution and write y=g(x) where g(x) is a function of x that includes an integral relation. From there, you can solve for the functional form for y(x) in the different regions x>3 and x<3. With the initial condition y(0) given, it is implied that you want to find the solution for x>0 only, as I interpret it.

#### PG1995

Joined Apr 15, 2011
819
Thank you for the response.

I'm sorry but I don't your point. You want me to solve for y (in the general solution we have y on the left side) by putting the value of P, which is 2 in this case, in the general solution. But we don't know the value of Q, so what do we do about it? Could you please put the initial steps of the solution into writing so that I can see what you are saying? If not possible, then it's okay. Many thanks.

Kind regards
PG

#### steveb

Joined Jul 3, 2008
2,436
... But we don't know the value of Q, so what do we do about it?
Why do you say we don't know the value of Q?

Isn't Q(x) equal to f(x) in this case? And, isnt' f(x) fully defined for you?

f(x)=0 if x>3 and f(x)=1 if x<=3.

So, Q is very simple if we restrict ourselves to separate regions. In one region Q=0 and in the other region Q=1. You can solve for the general form of y(x) in each region and then match the initial conditions (i.e. initial condition is at x=0)and the boundary conditions (i.e. boundary is at x=3).

#### Zazoo

Joined Jul 27, 2011
114
The goal of this solution method is to write the left-hand side as the derivative of a product involving y and some integrating factor μ(x).

You wrote the equation in standard form, dy/dx + P(x)y = Q(x)

From here you calculate an integrating factor, μ(x) = exp[∫P(x)dx]
In this problem, μ(x) = exp[∫2dx] = exp[2x]

Now multiply the standard form on both sides by this integrating factor:
μ(x)dy/dx + μ(x)P(x)y = μ(x)Q(x)
exp[2x]dy/dx + exp[2x]2y = exp[2x]Q(x)

Note that the left hand side is now just the product rule for derivateves, (i.e.
d/dx(exp[2x]y) = exp[2x]dy/dx + exp[2x]2y
So,
d/dx(exp[2x]y) = exp[2x]Q(x)

From here integrate both sides and solve for y.

Q(x) is a given in this problem, it is f(x), which has a value of 1 or 0 depending on the value of x. You will need to find two solutions, based on each interval.

Initial conditions are used to find the constant of integration, C.

#### PG1995

Joined Apr 15, 2011
819
Thank you very much, Steve, Zazoo.

Why do you say we don't know the value of Q?

Isn't Q(x) equal to f(x) in this case? And, isnt' f(x) fully defined for you?

f(x)=0 if x>3 and f(x)=1 if x<=3.

So, Q is very simple if we restrict ourselves to separate regions. In one region Q=0 and in the other region Q=1. You can solve for the general form of y(x) in each region and then match the initial conditions (i.e. initial condition is at x=0)and the boundary conditions (i.e. boundary is at x=3).
I was able to solve for f(x)=1. But I think when f(x)=Q(x)=0 we can't use general solution method for linear first order differential equation because we essentially don't have Q(x); i.e. y' + 2y =0. The general solution for linear differential equation requires us to have a Q(x). Actually I tried to solve for it and ended up with y=c*e^(-2x) and when I applied initial condition y(0)=0 I ended up with c=0. So, we can solve it by using separation of variables technique.

Many thanks for the help.

Best wishes
PG

#### steveb

Joined Jul 3, 2008
2,436
... Actually I tried to solve for it and ended up with y=c*e^(-2x) and when I applied initial condition y(0)=0 I ended up with c=0. So, we can solve it by using separation of variables technique.
This solution of y=c*e^(-2x) seems correct to me, but I'm not clear on why you want to apply y(0)=0 to that solution. The case of Q=0 is for x>3. Hence, you want to apply the boundary condition at x=3 to this solution, not the initial condition.

You said you got the solution with Q=1, so you should be able to match this to the initial condition, and then determine the value at the boundary of x=3.

#### PG1995

Joined Apr 15, 2011
819
For, 0 <= x <= 3, y=1/2{1-e^(-2x)}.
For, x > 3, y=c*e^(-2x)

Sorry. I once again fail to understand your point. If I shouldn't use initial condition to find 'c', then how do I get its value? Could you please explain it a little bit more? Many thanks.

Regards
PG

#### Zazoo

Joined Jul 27, 2011
114
The initial condition given is for the first equation, on the interval from 0 to 3.
The "initial condition" for the second equation is the value of the first equation at the boundary point, when x=3.

#### steveb

Joined Jul 3, 2008
2,436
For, 0 <= x <= 3, y=1/2{1-e^(-2x)}.
For, x > 3, y=c*e^(-2x)

Sorry. I once again fail to understand your point. If I shouldn't use initial condition to find 'c', then how do I get its value? Could you please explain it a little bit more? Many thanks.

Regards
PG
Yes, zazoo has it correct. That's what I was trying to say.

As far as I can tell with a glance, it seems you have the correct pieces of the solution in place. Your first function for 0<=x<=3 seems to be of the correct form and it does match the initial condition. Your second function for x>3 also seems to be of the correct form and requires only that you find the correct value of the constant c.

The key thing about the final solution for y is that the total function must be continuous. That's why we try to match the values at the initial condition and at the boundary x=3.

By the way, do you understand why the function must be continuous? Consider the differential equation in a different form.

dy/dx=f(x)-2y

This tells you that the slope (dy/dx is slope) is always a finite value as long as f(x) and y are finite values. Since y starts at a finite value and f(x) is defined to always be finite, the derivative must be finite and hence the solution for y can not change by a sudden jump, but must change gradually as x changes.

Last edited:

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
There are two types of system mainly 1st and 2nd order but not sure what system are there in real..?

#### PG1995

Joined Apr 15, 2011
819
Thanks a lot, Steve, Zazoo. Actually I didn't come back to the forums for almost three days that's why my thanks are little delayed.

Please have a look on this problem which I have tried to solve. This is the solution given in the manual. As you can see both values of 'y' I have ended with don't match with the given values for 'y' in the manual. Please help me with it. Thank you.

#### Attachments

• 100.4 KB Views: 34
• 18.6 KB Views: 34

#### steveb

Joined Jul 3, 2008
2,436
As you can see both values of 'y' I have ended with don't match with the given values for 'y' in the manual.

#### PG1995

Joined Apr 15, 2011
819
I'm so sorry. I should have checked it more carefully. The different forms of the given answers led me to believe that my solutions aren't correct. Thanks a lot for confirming it.

Best wishes
PG

#### steveb

Joined Jul 3, 2008
2,436
I'm so sorry. I should have checked it more carefully. The different forms of the given answers led me to believe that my solutions aren't correct. Thanks a lot for confirming it.

Best wishes
PG
No need to be sorry. Sometimes it's hard to see the equivalence.

When doing integration, you can sometimes come up with equivalent forms that look absolutely completely different and you swear there is no way they can be the same.

Take a look at the trig identity mik3 helped me with years ago. I obtained these two solutions that look completely different, yet they are the same.

I've seen even more bizarre things than this, where the forms are so different, the only way to know they are the same is to plot them. This is something to be aware of particularly when doing anything involving integration.

#### Attachments

• 54.1 KB Views: 17

#### PG1995

Joined Apr 15, 2011
819
Oh, what you have in that attachment is amazing!

Thanks for this.

#### PG1995

Joined Apr 15, 2011
819
Hi

This is about this post. Here f(x)=Q(x). As you can see in the linked post I said that we can't apply general solution when f(x)=0 because we don't have Q(x) instead we have a "0" in its place. But now I think a constant can also be considered a polynomial because I was able to apply the general solution with Q(x)=f(x)=0.

Regards
PG

#### Attachments

• 166.3 KB Views: 23
Last edited:

#### steveb

Joined Jul 3, 2008
2,436
Hi

This is about this post. Here f(x)=Q(x). As you can see in the linked post I said that we can't apply general solution when f(x)=0 because we don't have Q(x) instead we have a "0" in its place. But now I think a constant can also be considered a polynomial because I was able to apply the general solution with Q(x)=f(x)=0.

Regards
PG
I'm a little confused. Your attachment seems to be a different question than the one you mention here about Q(x)=0 or a constant. Anyway, Q(x) can be zero or a constant and that method can work fine. You already did this because the f(x) =0 and f(x)= 1 in the two regions considered in that problem.

The attachment is making use of Euler's formula, which says exp(ix)=cos(x)+isin(x)

http://en.wikipedia.org/wiki/Euler's_formula

Last edited:

#### PG1995

Joined Apr 15, 2011
819
Thank you.

Yes that Q(x) query didn't have anything to do with the attachment in the previous posting. Sorry, I wasn't clear enough.

C1*e^(ix) + C2*e^(-ix) = C1{cos(x) + isin(x)} + C2{cos(x) - isin(x)} = cos(x){C1+C2} + isin(x){C1-C2} = c1*cos(x) + c2*isin(x) [replacing C1+C2 and C1-C2 with c1 and c2 respectively]

Best wishes
PG