Solve the boundary value problem
y^{\prime\prime}+2y=0,\quad y(0)=1,\quad y(\pi)=0. (7)
The general solution of the differential equation (7) is
y=c_{1}\cos\left({\sqrt{2}}x\right)+c_{2}\sin\left({\sqrt{2}}x\right). (8)
The first boundary condition requires that c_{1} = 1. The second boundary condition implies that c_{1}\cos\Bigl(\sqrt{2}\pi\Bigr)+c_{2}\sin\Bigr(\sqrt{2}\pi\Bigr)=0, so c_{2}=-\cot\left({\sqrt{2}}\,\pi\right)\cong-0.2762. Thus the solution of the boundary value problem (7) is
y=\cos\left({\sqrt{2}}x\right)-\cot\left({\sqrt{2}}\pi\right)\sin\left({\sqrt{2}}x\right). (9)
This example illustrates the case of a nonhomogeneous boundary value problem with a unique solution.