<s>[INST] Solve initial value problem using Laplace Transform Use Laplace transform to solve the following initial–value problems.
I'm confused with $f(t)$ defined by cases and both $x,y$ being differentiated as shown below.

*

*$(\frac{d^2}{dt^2}-4\frac{d}{dt}+4)y=f(t)$, subject to $y(0)=-2,y'(0)=1$, with
$$f(t)=\begin{cases}
    t & \text{if }0\leq t\leq 3,\\
    t+2 & \text{if }t\geq 3.
\end{cases}$$
If we solve the two cases separately, we will get
$$y=\frac{1}{4}+\frac{t}{4}-\frac{9}{4}e^{2t}+\frac{21e^{2t}t}{4}$$
and
$$y=\frac{3}{4}+\frac{t}{4}-\frac{11}{4}e^{2t}+\frac{25e^{2t}t}{4}.$$
But, how can we proceed?

*$\frac{d^2x}{dt^2} = -2x+y,\frac{d^2y}{dt^2} = x − 2y$, subject to the initial conditions
$$x(0) = y(0) = 1,\quad x'(0) = y'(0) = 0.$$
 [/INST] The Laplace transform of $f(t)$ is given by
\begin{align}
f(t) &\doteqdot \int_{0}^{\infty} e^{-s t} \, f(t) \, dt \\
&\doteqdot \int_{0}^{3} e^{- s t} \, t \, dt + \int_{3}^{\infty} e^{-s t} \, (t + 2) \, dt \\
&\doteqdot \frac{1}{s^2} + \frac{2}{s} \, e^{- 3 s}.
\end{align}
Now the differential equation, when transformed, takes the form:
\begin{align}
y^{''} - 4 \, y^{'} + 4 \, y &= f(t) \\
(s-2)^2 \, \overline{y} &= 4 \, y(0) + y^{'}(0) - y(0) \, s + \frac{1}{s^2} + \frac{2}{s} \, e^{- 3 s} \\
\overline{y} &= \frac{4 \, y(0) + y^{'}(0)}{(s-2)^2} - \frac{y(0) \, s}{(s-2)^2} + \frac{1}{s^2 \, (s-2)^2} + \frac{2 \, e^{-3 s}}{s \, (s-2)^2}
\end{align}
which, when inverted, leads to
$$ y(t) = \frac{1}{4} \, \left[ 1 + t + ((1 + 8 \, y(0) + 4 \, y^{'}(0)) \, t - (1 + 4 \, y(0)) ) \, e^{2 t} \right] + \frac{1}{2} \, \left( 1 + (2 t -7) \, e^{2(t -3)} \right) \, H(t-3), $$
where $H(t)$ is the Heaviside step function. Applying the conditions gives
$$ y(t) = \frac{1}{4} \, \left[ 1 + t + (7 - 11 \, t) \, e^{2 t} \right] + \frac{1}{2} \, \left( 1 + (2 t -7) \, e^{2(t -3)} \right) \, H(t-3) $$
which is the same as:
$$ y(t) = \begin{cases} \frac{1}{4} \, \left[ 1 + t + (7 - 11 \, t) \, e^{2 t} \right] & t \leq 3 \\ \frac{1}{4} \, \left[ 1 + t + (7 - 11 \, t) \, e^{2 t} - 2 \, (7 - 2 \, t) \, e^{2 (t-3)} \right] & t > 3 \end{cases}. $$
</s>