Solve the boundary value problem
y^{\prime\prime}+y=0,\quad y(0)=1,\quad y(\pi)=a, (10)
where a is a given number.
The general solution of this differential equation is
y=c_{1}\cos x+c_{2}\sin x, (11)
and from the first boundary condition we find that c_{1} = 1. The second boundary condition now requires that −c_{1} = a. These two conditions on c_{1} are incompatible if a ≠ −1, so the problem has no solution in that case. However, if a = −1, then both boundary conditions are satisfied provided that c_{1} = 1, regardless of the value of c_{2}. In this case there are infinitely many solutions of the form
y=\cos x+c_{2}\sin x,
where c_{2} remains arbitrary. This example illustrates that a nonhomogeneous boundary value problem may have no solution—and also that under special circumstances it may have infinitely many solutions.