Solution (source code)

= Solution

Away from the impulse, the <harmonic oscillator equation> has a <homogeneous solution>. Before $x=\pi/2$, the <initial conditions> select $y=\cos x$. The <jump condition for an impulse> requires continuity of $y$ and a unit jump in $y'$: a jump in $y$ would produce a derivative of the <Dirac delta distribution>, which is absent from the forcing, while integrating through the impulse gives $[y']=1$.

Just before the impulse, $y=0$ and $y'=-1$. Just afterwards, $y=0$ and $y'=0$, so uniqueness for the <harmonic oscillator equation> makes the subsequent solution identically zero. Equivalently the causal response is $H(x-\pi/2)\sin(x-\pi/2)$, with $H$ the <Heaviside step function>, and it cancels the original oscillation.

\b[The solution is]
$$
\boxed{y(x)=\cos x+H(x-\pi/2)\sin(x-\pi/2)=\begin{cases}\cos x,&0\leq x<\pi/2,\\0,&x\geq\pi/2.\end{cases}}
$$
The <impulse cancellation of a harmonic oscillator> produces a continuous graph with a corner at $(\pi/2,0)$, followed by a horizontal zero line.

\Image[/past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2016/ia/paper-2-impulse.png]
{title=An impulse cancels the oscillator at zero displacement}