Solve the boundary value problem
y^{\prime\prime}+2y=-x,\quad y(0)=0,\quad y(1)+y^{\prime}(1)=0.
This particular problem can be solved directly in an elementary way and has the solution
y={\frac{\sin\left({\sqrt{2}}x\right)}{\sin{\sqrt{2}}+{\sqrt{2}}\cos{\sqrt{2}}}}-{\frac{x}{2}}. (15)
The method of solution described below illustrates the use of eigenfunction expansions, a method that can be employed in many problems not accessible by elementary procedures.
We begin by rewriting the differential equation as
-y^{\prime\prime}=2y+x (16)
so that it will have the same form as equation (1).
L[y]=-{(p(x)y^{\prime})}^{\prime}+q(x)y=\mu r{(x)}y+f{(x)}, (1)
We seek the solution of the given problem as a series of normalized eigenfunctions \phi_{n} of the corresponding homogeneous problem
y^{\prime\prime}+\lambda y=0,\quad y(0)=0,\quad y(1)+y^{\prime}(1)=0. (17)
These eigenfunctions were found in Example 2 of Section 11.2 and are
\phi_{n}(x)=k_{n}\sin\left({\sqrt{\lambda_{n}}}x\right), (18)
where
k_{n}=\left(\frac{2}{1+\cos^{2}\sqrt{\lambda_{n}}}\right)^{1/2} (19)
and the eigenvalue \lambda_{n} satisfies
\sin\sqrt{\lambda_{n}}+\sqrt{\lambda_{n}}\cos\sqrt{\lambda_{n}}=0. (20)
Recall that in Example 1 of Section 11.1, we found that
\lambda_{1}\cong4.11586,\quad\lambda_{2}\cong24.13934,\quad\lambda_{3}\cong63.65911,\quad\lambda_{4}\cong122.88916,\\\lambda_{n}\cong\frac{(2n-1)^{2}\pi^{2}}{4},\quad\mathrm{for}\,n=5,6,\ \dots\,.
We assume that y is given by equation (4)
y=\sum_{n=1}^{\infty}b_{n}\phi_{n}(x),
and it follows that the coefficients b_{n} are found from equation (12)
b_{n}=\frac{c_{n}}{\lambda_{n}-\mu},\quad n=1,2,3,\,\ldots\,, (12)
b_{n}={\frac{c_{n}}{\lambda_{n}-2}},
where the c_{n} are the expansion coefficients of the nonhomogeneous term f(x) = x in equation (16) in terms of the eigenfunctions \phi_{n}. These coefficients were found in Example 3 of Section 11.2 and are
c_{n}={\frac{2\sqrt{2}\sin\sqrt{\lambda_{n}}}{\lambda_{n}(1+\cos^{2}\sqrt{\lambda_{n}})^{1/2}}}. (21)
Putting everything together, we finally obtain the solution
y=4\sum_{n=1}^{\infty}{\frac{\sin{\sqrt{\lambda_{n}}}}{\lambda_{n}(\lambda_{n}-2)(1+\cos^{2}{\sqrt{\lambda_{n}}})}}\sin\biggl({\sqrt{\lambda_{n}}}x\biggr). (22)
Although equations (15) and (22) are quite different in appearance, they are actually two different expressions for the same function. This follows from the uniqueness part of Theorem 11.3.1 or 11.3.2, since λ = 2 is not an eigenvalue of the homogeneous problem (17). Another alternative to show the equivalence of equations (15) and (22) is to expand the right-hand side of equation (15) in terms of the eigenfunctions \phi_{n}(x).
The series (22) converges rapidly to the exact solution. Figure 11.3.1(a) shows the exact solution and the first term of series (22). (With two or more terms of the series the two solution curves are indistinguishable.) Figures 11.3(b) and (c) show the difference between the exact solution (15) and the first three and fifteen terms of the series solution (22).
For this problem, it is fairly obvious that equation (15) is a more convenient expression for the solution than equation (22). However, we emphasize again that in other problems we may not be able to obtain the solution except by series (or numerical approximation) methods.