Boundary value problem $\frac{d^2 y}{dx^2}+\pi ^2 y=f(x)$ Solve the boundary value problem
$$\frac{d^2y}{dx^2}+\pi^2y=f(x),\ \ \ y(0)=y \left( \frac{1}{2}\right)=0 $$
How can I solve this if I have the unknown function $f(x)$ in the differential equation? And what happens if I leave out the $\pi^2y$ term?
 A: Use Laplace Transform:
$$\frac{\text{d}^2y(x)}{\text{d}x^2}+\pi^2y(x)=f(x)\Longleftrightarrow$$
$$y''(x)+\pi^2y(x)=f(x)\Longleftrightarrow$$
$$\mathcal{L}_{x}\left[y''(x)+\pi^2y(x)\right]_{(s)}=\mathcal{L}_{x}\left[f(x)\right]_{(s)}\Longleftrightarrow$$
$$\mathcal{L}_{x}\left[y''(x)\right]_{(s)}+\mathcal{L}_{x}\left[\pi^2y(x)\right]_{(s)}=\mathcal{L}_{x}\left[f(x)\right]_{(s)}\Longleftrightarrow$$
$$\mathcal{L}_{x}\left[y''(x)\right]_{(s)}+\pi^2\mathcal{L}_{x}\left[y(x)\right]_{(s)}=\mathcal{L}_{x}\left[f(x)\right]_{(s)}\Longleftrightarrow$$
$$s^2y(s)-sy(0)-y'(0)+\pi^2y(s)=f(s)\Longleftrightarrow$$

Use $y(0)=0$:

$$s^2y(s)-y'(0)+\pi^2y(s)=f(s)\Longleftrightarrow$$
$$y(s)\left[s^2+\pi^2\right]=f(s)+y'(0)\Longleftrightarrow$$
$$y(s)=\frac{f(s)+y'(0)}{s^2+\pi^2}\Longleftrightarrow$$
$$\mathcal{L}_{s}^{-1}\left[y(s)\right]_{(x)}=\mathcal{L}_{s}^{-1}\left[\frac{f(s)+y'(0)}{s^2+\pi^2}\right]_{(x)}\Longleftrightarrow$$
$$y(x)=\mathcal{L}_{s}^{-1}\left[\frac{f(s)}{s^2+\pi^2}\right]_{(x)}+\mathcal{L}_{s}^{-1}\left[\frac{y'(0)}{s^2+\pi^2}\right]_{(x)}\Longleftrightarrow$$
$$y(x)=\mathcal{L}_{s}^{-1}\left[\frac{f(s)}{s^2+\pi^2}\right]_{(x)}+\frac{y'(0)\sin\left(\pi t\right)}{\pi}$$
A: EDIT: I got myself completely turned around yesterday and although I got the right answer, my exposition of Green's function methods was lacking, to say the least. I have fixed this now.  
I would try a Green's function. We want a function $G(x,t)$ such that
$$\frac{\partial^2G}{\partial x^2}+\pi^2G=\delta(x-t)$$
and $G(0,t)=G(\frac12,t)=0$. Then we will be able to express $y(x)$ as
$$y(x)=\int_0^{\frac12}G(x,t)f(t)dt$$
A loose explanation of why this works is
$$\frac{d^2y}{dx^2}+\pi^2y=\int_0^{\frac12}\left(\frac{\partial^2G}{\partial x^2}+\pi^2G\right)f(t)dt=\int_0^{\frac12}\delta(x-t)f(t)dt=f(x)$$
and
$$y(0)=\int_0^{\frac12}G(0,t)f(t)dt=\int_0^{\frac12}(0)f(t)dt=0$$
With similar results for $y(\frac12)$.  
Since $\delta(x-t)=0$ for $x\ne t$, for $x\ne t$ we must have
$$\frac{\partial^2G}{\partial t^2}+\pi^2G=0$$
So $G(x,t)=C_1(t)\cos\pi x+C_2(t)\sin\pi x$. Since $G(0,t)=0$, $C_1(t)=0$ for $0<x<t$. Since $G(\frac12,t)=0$, $C_2(t)=0$ for $t<x<\frac12$. To get that $\delta$-function, $\frac{\partial G}{\partial x}$ must have a jump discontinuity of magnitude $1$ at $x=t$ while $G$ itself must be continuous there. Thus
$$C_2(t)\sin\pi t=C_1(t)\cos\pi t$$
$$-\pi C_1(t)\sin\pi t-\pi C_2(t)\cos\pi t=1$$
So $C_1(t)=-\frac1{\pi}\sin\pi t$ and $C_2(t)=-\frac1{\pi}\cos\pi t$, and we have our Green's function,
$$G(x,t)=\left\{\begin{matrix}-\frac1{\pi}\cos\pi x\sin\pi t, & 0<t<x<\frac12\\
-\frac1{\pi}\sin\pi x\cos\pi t, & 0<x<t<\frac12\end{matrix}\right.$$
(It was OK before the edit from here on out.) Now we just integrate to get the solution:
$$y(x)=\int_0^{\frac12}G(x,t)f(t)dt=-\frac1{\pi}\cos\pi x\int_0^x\sin\pi tf(t)dt-\frac1{\pi}\sin\pi x\int_x^{\frac12}\cos\pi tf(t)dt$$
We might want to check that $y(0)=y(\frac12)=0$, and on differentiating,
$$\begin{align}y^{\prime}(x) =\, & \sin\pi x\int_0^x\sin\pi tf(t)dt-\frac1{\pi}\cos\pi x\sin\pi xf(x)-\\
 & \cos\pi x\int_x^{\frac12}\cos\pi tf(t)dt+\frac1{\pi}\sin\pi x\cos\pi xf(x)\end{align}$$
$$\begin{align}y^{\prime\prime}(x) =\, & \pi\cos\pi x\int_0^x\sin\pi tf(t)dt+\sin\pi x\sin\pi xf(x)+\\
 & \pi\sin\pi x\int_x^{\frac12}\cos\pi tf(t)dt+\cos\pi x\cos\pi xf(x)\\
 = & -\pi^2y(x)+f(x)\end{align}$$
