Solve Linear ODE with Discontinuous f(x)

  • Thread starter Thread starter 1s1
  • Start date Start date
  • Tags Tags
    Linear Ode
Click For Summary

Homework Help Overview

The discussion revolves around solving a linear ordinary differential equation (ODE) with a piecewise discontinuous function defined for different intervals of x. The equation presented is of the form dy/dx + y = f(x), where f(x) takes the value of 1 for 0 ≤ x < 1 and 0 for x ≥ 1.

Discussion Character

  • Mixed

Approaches and Questions Raised

  • Participants explore the use of integrating factors to solve the ODE for both cases of f(x). There is an attempt to apply initial conditions, but confusion arises regarding the validity of these conditions for the second piece of the function. Some participants suggest reconsidering the initial conditions based on the definition of continuity at the transition point.

Discussion Status

The discussion has evolved with participants providing insights and clarifications regarding the initial conditions and the continuity of the solution. There is acknowledgment of alternative methods for solving the ODE, such as separation of variables, which may simplify the approach. However, no explicit consensus has been reached on the best method to apply.

Contextual Notes

Participants note the importance of the initial conditions and the implications of the piecewise nature of the function on the solution. There is also mention of the potential for multiple methods to solve the ODE, indicating a broader exploration of techniques in differential equations.

1s1
Messages
20
Reaction score
0

Homework Statement



$$\frac{dy}{dx}+y=\left\{\begin{matrix}1, \ 0\leq x< 1
\\
0, \ x\ge1 \ \ \ \ \ \ \
\end{matrix}\right.$$

Homework Equations





The Attempt at a Solution


$$P(x)=1$$
Integrating factor ##=e^{x}##

For ##f(x)=1##:
$$\frac{d}{dx}[e^{x}y]=e^{x}$$
Integrating both sides:
$$e^{x}y=e^{x}+C$$
$$y=1+\frac{C}{e^{x}}, y(0)=1$$
$$C=0$$
$$\fbox{y=1}$$

For ##f(x)=0##:
$$\frac{d}{dx}[e^{x}y]=0$$
Integrating both sides:
$$e^{x}y=C$$
$$y=\frac{C}{e^{x}}, y(0)=1$$
$$C=1$$
##y=\frac{1}{e^{x}}## <-- This one is coming back incorrect

I have worked through this problem multiple times, but my WeBWorK assignment keeps saying the second solution, the one for ##f(x)=0## is incorrect. I can't figure out what I'm doing wrong?! Any help would be greatly appreciated!
 
Physics news on Phys.org
1s1 said:

Homework Statement



$$\frac{dy}{dx}+y=\left\{\begin{matrix}1, \ 0\leq x< 1
\\
0, \ x\ge1 \ \ \ \ \ \ \
\end{matrix}\right.$$

Homework Equations





The Attempt at a Solution


$$P(x)=1$$
Integrating factor ##=e^{x}##

For ##f(x)=1##:
$$\frac{d}{dx}[e^{x}y]=e^{x}$$
Integrating both sides:
$$e^{x}y=e^{x}+C$$
$$y=1+\frac{C}{e^{x}}, y(0)=1$$
$$C=0$$
$$\fbox{y=1}$$

For ##f(x)=0##:
$$\frac{d}{dx}[e^{x}y]=0$$
Integrating both sides:
$$e^{x}y=C$$
$$y=\frac{C}{e^{x}}, y(0)=1$$
$$C=1$$
##y=\frac{1}{e^{x}}## <-- This one is coming back incorrect

I have worked through this problem multiple times, but my WeBWorK assignment keeps saying the second solution, the one for ##f(x)=0## is incorrect. I can't figure out what I'm doing wrong?! Any help would be greatly appreciated!

Look at this :

$$y=\frac{C}{e^{x}}, y(0)=1$$

You're claiming ##x=0## for the initial condition, but ##x## is defined to be greater than or equal to 1.
 
Good point! I suppose I would need a different initial condition for this function?
 
Figured it out ... thanks Zondrina!

Have to appeal to the definition of continuity at a point.

So, you can say that ##Ce^{-1}=1##
$$C=e$$
And the solution for ##x \geq 0##
$$y=\frac{e}{e^{x}}$$

Thanks!
 
Sounds like there must be some fresh Prof. very keen on integrating factors and his students are coming here this last day or so using them where they're not needed!

You have a couple of nearly the most simple ode's there are!
 
Ha, ha good point! I suppose simple separation of variables would be SO much simpler. By the way, I'm new to working with ODE's, is using integrating factors pretty typical or are there alternative methods that are more common? Guess I'll probably find out more as I learn more about diffEq.
 
1s1 said:
Ha, ha good point! I suppose simple separation of variables would be SO much simpler. By the way, I'm new to working with ODE's, is using integrating factors pretty typical or are there alternative methods that are more common? Guess I'll probably find out more as I learn more about diffEq.

There are lots of different methods for solving first order linear ODEs. Some first order linear ODEs have more than one method which can be applied to find the correct answer ( As was in this case actually. You could have separated variables or used an integrating factor ). You're probably going to learn more methods along the way, but integrating factors and variable separation are very prominent methods.
 
I mean to say it is just two equations; the second equation is just dy/dx = -y → dy/y = -dx
→ d(ln y) = -dx
and the first is d(y - 1)/dx = - (y - 1) , dealt with in same way.
 

Similar threads

Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
Replies
4
Views
3K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K