= Solution
Use the causal <Green function>: it vanishes before the forcing time $t'$. For $t>t'$ it solves the homogeneous equation, is <continuous> at $t=t'$ with value zero, and has first-derivative jump one. These conditions give
$$
\boxed{G(t,t')=\begin{cases}\sinh(k(t-t'))/k,&t\geq t',\\0,&t<t'.\end{cases}}
$$
Indeed the right <derivative> at the forcing time is one and the left <derivative> is zero, so $(\partial_t^2-k^2)G=\delta(t-t')$ distributionally. If $k=0$, use the <continuous> limit $G(t,t')=(t-t')$ on its causal support.
For $k\ne0$, differentiating the <integral> solution gives
$$
\dot x(t)=\int_0^t\cosh(k(t-t'))f(t')\,dt',\qquad
\ddot x(t)=f(t)+k^2\int_0^t\frac{\sinh(k(t-t'))}{k}f(t')\,dt'.
$$
Both initial values vanish and $\ddot x-k^2x=f$. This verifies the requested representation and its sign. The $k=0$ formula similarly gives $\ddot x=f$.
Back to article page