For the zero initial data, the Green function of an undamped oscillator is for , and zero for . It is continuous at the source and its first derivative jumps by one. The resulting convolution is
It vanishes together with its first derivative at zero and has the required resonant forcing.
For the two-endpoint problem, write , , and . This covers both signs of the supplied nonzero . Left and right homogeneous solutions are and , with Wronskian . The Dirichlet Green function is therefore
Its endpoint values are zero and its first derivative jumps by one. Here , so the denominator does not vanish. Integrating the constant forcing gives
Equivalently . The negative interior response is consistent with the negative kernel for this short Dirichlet interval.