Initial value problem with piecewise right hand side

2k Views Asked by At

I am not familiar at all with initial value problems that involve piecewise functions. The problem given is:

Solve the initial value problem with piecewise right hand side $\left\lbrace\begin{array}{l} \dfrac{dy}{dx} + y = f(x) \\ y(0) = -9 \end{array}\right.$

where $ f(x) = \left\lbrace\begin{array}{lcl} -3 & \text{if} & 0 \leq x < 9 \\ 8 & \text{if} & 9 \leq x \end{array}\right.$

It also mentions that the solution should be continuous at $x=9$. As such, I am supposed to find $y(x)$ for $0 \leq x < 9$ and for $x \geq 9$, but I do not know how to approach this problem. Any tips would be much appreciated!

1

There are 1 best solutions below

0
On BEST ANSWER

It helps to look at piecewise functions as two separate differential equations in this case. Since you are given $f(x)=-3$ and $f(x)=8$, you can then rewrite the differential equations as first order linear:

$\frac{dy}{dx}+y=-3$

$\frac{dy}{dx}+y=8$

Then you can look for an integrating factor to solve these two equations.