= Solution
The same <variation of parameters> construction works on $[0,\pi]$. All solutions satisfying the <boundary condition> at zero have the form
$$
y(x)=e^{-2x}\left[C\sin x+\int_0^xe^{2t}\sin(x-t)f(t)\,dt\right].
$$
At $x=\pi$, the homogeneous term vanishes for every $C$; it can no longer be chosen to correct the final boundary value. Since $\sin(\pi-t)=\sin t$, that boundary value is zero exactly when
$$
\boxed{\int_0^\pi e^{2t}\sin t\,f(t)\,dt=0.}
$$
This condition is necessary by the displayed general solution, and sufficient by the same formula. When it holds, the full answer is
$$
\boxed{y(x)=e^{-2x}\left[C\sin x+\int_0^xe^{2t}\sin(x-t)f(t)\,dt\right],\qquad C\in\mathbb R.}
$$
For complex-valued forcing, allow $C\in\mathbb C$ instead. The freedom is addition of the nonzero homogeneous Dirichlet solution $e^{-2x}\sin x$. At this endpoint separation, the homogeneous boundary problem has a nonzero solution. The resulting <Fredholm solvability condition> restricts the forcing to the compatible functions described above. In the language of the <Fredholm alternative>, the condition is orthogonality to the adjoint null solution $e^{2x}\sin x$ of $D^2-4D+5$ with zero endpoint values.
Back to article page