I want to solve following IVP with Laplace transformation.
\begin{align} x''(t) + 2x'(t) + x(t) &= \begin{cases} 0, & t < 0\\ 1, & t \in (0;2)\\ 3, & t > 2 \end{cases}\\ x(0) &= 0\\ x'(0)&=0\\ \end{align}
I've transformed left side of the equation like this: \begin{align} \mathcal{L}(x''(t) + 2x'(t) + x(t)) = s^2X(s) - sx(0) - x'(0) + 2(sX(s) - x(0)) + X(s) \end{align}
With conditions applied: $$ s^2X(s)+2sX(s)+X(s) $$
Then I transformed right side of the equation like this: \begin{align} \mathcal{L}(f(t)) &= F(s)\\ &= \int^0_{-\infty}0\cdot e^{-st} dt + \int^2_{0}1\cdot e^{-st} dt + \int^\infty_{2}3\cdot e^{-st} dt\\ &= 0 + \left[ - \frac{1}{s}e^{-st} \right]_{t=0}^2 + 3 \left[ - \frac{1}{s}e^{-st} \right]_{t=2}^\infty\\ &= \frac{1-e^{-2s}}{s} + 3 \frac{e^{-2s}}{s}\\ &= \frac{1+2e^{-2s}}{s} \end{align}
So, now the transformed equation with applied conditions looks like this: \begin{align} s^2X(s)+2sX(s)+X(s) &= \frac{1+2e^{-2s}}{s}\\ X(s)&= \frac{1+2e^{-2s}}{s(s^2 +2s +1)} \end{align}
Now I attempted to decompose the right side to partial fractions: \begin{align} X(s)&= \frac{1+2e^{-2s}}{s(s^2 +2s +1)}\\ &= (1+2e^{-2s})\frac{1}{s(s+1)^2}\\ &= (1+2e^{-2s})\left( \frac{A}{s} + \frac{B}{s+1} + \frac{C}{(s+1)^2} \right)\\ &= (1+2e^{-2s})\left( \frac{1}{s} - \frac{1}{s+1} - \frac{1}{(s+1)^2} \right)\\ &= \frac{1}{s} - \frac{1}{s+1} - \frac{1}{(s+1)^2} + 2\frac{1}{s}e^{-2s} - 2\frac{1}{s+1}e^{-2s} - 2\frac{1}{(s+1)^2}e^{-2s} \end{align}
Now I used Inversed Laplace Transformation (u is Heaviside unit-step function): $$ x(t) = 1- e^{-t} - te^{-t} + 2u(t-2) -2 e^{2-t}u(t-2) - 2e^{2-t}(t-2)u(t-2) $$
The problem is, that this solution doesn't work for $t < 0$:
$x''(-1) + 2x'(-1) + x(-1) = 2e -2e + 1 = 1$, but $-1 < 0$, so the result should be 0.
Can you see, what I'm doing wrong? I've tried to check my steps with WolframAlpha, but still I don't see the error.
The other situations ($t \in (0;2)$ and $t > 2$) seem to work ok.
$$ \frac{1}{s} - \frac{1}{s+1} - \frac{1}{(s+1)^2} + 2\frac{1}{s}e^{-2s} - 2\frac{1}{s+1}e^{-2s} - 2\frac{1}{(s+1)^2}e^{-2s} $$ The inverse Laplace is : $$ x(t) = u(t)- e^{-t}u(t) - te^{-t}u(t) + 2u(t-2) -2 e^{2-t}u(t-2) - 2e^{2-t}(t-2)u(t-2) $$ Then $$x(t) = 0 \forall t < 0 $$
$$ \int_{-\infty (or 0)}^{\infty} u(t) e^{-st} dt = \int_{0}^{\infty} u(t) e^{-st}dt =\int_{0}^{\infty} e^{-st} dt = \frac{e^{-st}}{-s}|_{0}^{\infty} = \frac{1}{s} $$ $$ \rightarrow \mathcal{L^{-1}}\left\{\frac{1}{s}\right\} = u(t) $$ you can do the same with the others.
Also you can check a Laplace transform table online to verify this.