# Differential Equations with Discontinuous Forcing Functions

1. Nov 24, 2014

### _N3WTON_

1. The problem statement, all variables and given/known data
Solve the given initial value problem:
$y'' + y = u(t-\pi) - u(t-2 \pi)$
$y(0) = 0$
$y'(0) = 1$

2. Relevant equations

3. The attempt at a solution
First I took the Laplace transform of both sides:
$\mathcal{L}[y'' + y ] = \mathcal{L}(u(t-\pi)) - \mathcal{L}(u(t-2 \pi))$
$(s^{2}Y(s) - sy(0) - y'(0)) + Y(s) = \frac{e^{-\pi s}}{s} - \frac{e^{-2 \pi s}}{s}$
$s^{2}Y(s) - 1 + Y(s) = \frac{e^{-\pi s}-e^{-2 \pi s}}{s} + 1$
$Y(s)(s^{2}+1) = \frac{e^{-\pi s}-e^{-2 \pi s}+s}{s}$
$Y(s) = \frac{e^{-\pi s}-e^{-2 \pi s} + s}{s(s^{2}+1)}$
At this point I get stuck, I tried doing a partial fraction decomp, but that didn't seem to get me anywhere closer to the solution..

2. Nov 24, 2014

### LCKurtz

I haven't checked your algebra, but assuming it is correct you need to use the formula$$\mathcal Lf(t-a)u(t-a) = e^{-as}\mathcal L(f(t)) = e^{-as}F(s)$$So if you have a transform $F(s)$ that is multiplied by $e^{-as}$ all you have to do is invert the $F(s)$ to $f(t)$ then truncate and translate it go get $f(t-a)u(t-a)$. So just break up your problem into three fractions and work them separately.

3. Nov 24, 2014

### _N3WTON_

ah, ok.. So I'll have something like:
$Y(s) = \frac{e^{-\pi s}}{s(s^{2}+1)} - \frac{e^{-2\pi s}}{s(s^{2}+1)} + \frac{1}{s^{2}+1}$
Then I would do a decomposition on this last fraction and then apply the inverse Laplace?

4. Nov 24, 2014

### LCKurtz

Yes. Use the formula on each of the first two and do the third one by itself. Then add the three answers.

5. Nov 24, 2014

### _N3WTON_

ok...I'm getting a lot of terms so I wanted to make sure I'm doing this correctly. For my decomposition I found:
$\frac{1}{s(s^{2}+1)} = \frac{1}{s} - \frac{s}{s^{2}+1}$
Therefore, I found the following:
$Y(s) = \frac{e^{-\pi s}}{s} - \frac{se^{-\pi s}}{s^{2}+1} - \frac{e^{-2\pi s}}{s} + \frac{se^{-2\pi s}}{s^{2}+1} - \frac{1}{s^{2}+1}$
So after applying the inverse Laplace I get:
$y(t) = u(t - \pi)-\cos (t-\pi)u(t-\pi) - u(t -2\pi)+\cos (t-2\pi)u(t-2\pi)+\sin t$
The above answer can probably be simplified, but I'll worry about that later :)

Last edited: Nov 24, 2014
6. Nov 24, 2014

### LCKurtz

That's the idea. Hopefully it's starting to look more like your given solution.

7. Nov 24, 2014

### _N3WTON_

It definitely looks close, the given solution is:
$\sin t + u(t-\pi)(1-\cos (t-\pi)) - u(t-2\pi)(1-\cos (t -2\pi))$
I need to check and make sure my signs are okay, but I think I've got the hang of it, thanks for the help!