Solve the initial value problem $$ y'-y = \left\lbrace \begin{aligned} &1 & & \text{when}\quad 0<t<1 \\ &0 & & \text{when}\quad t>1 \end{aligned} \right. ,\qquad y(0)=0 \, . $$
So I understand that $p(t)=-1$ and $g(t)$ is $1$ and $0$ (depending on the $t$ value), and that I'm supposed to solve it as two separate DEs. I got for the first case that $y=-1$ and for the second case that $y=0$.
- Is this correct?
- Is this the solution? Or do I have to do something with the initial value $y(0)=0$?
Any help is appreciated !!
For the first case $(t<1)$, you should have: $$y'-y=1$$ $$\int \dfrac {dy}{1+y}=t+K$$ $$\ln(y+1)=t+K$$ $$(y+1)=e^{t+K}=Ke^t$$ $$y=Ke^t-1$$ Since $y(0)=0 \implies K=1$ $$\boxed{y=e^t-1}$$