solve $\frac{d^2}{dx^2}u+k^2u=f(x)$, $k$ is not $0$, the boundary condition is $u(0)=u(1)=0$
First I set $\frac{d^2}{dx^2}g+k^2g=\delta (x-y)$, $g$ is the green's function. the boundary condition is now $g(0,y)=g(1,y)=0$. From this boundary condition, I get $$g(x,y)= \left\{ \begin{array}{l} B_1(y)sin(kx), 0\le x\le y\le 1 \\[2ex] B_2[sin(kx)-(tan(k))cos(kx)], 0\le y\le x\le 1 \end{array} \right. $$ Also, I have the following equation from $\frac{d^2}{dx^2}g+k^2g=\delta (x-y)$ $$[\frac{\partial g}{\partial x}]_{x=y-\epsilon}^{x=y+\epsilon}+k^2\int_{x=y-\epsilon}^{x=y+\epsilon}g(x,y)dx=1 $$ However, I calculate $\frac{\partial g}{\partial x}$ and $k^2\int_{x=y-\epsilon}^{x=y+\epsilon}g(x,y)dx$ and get almost the same equation but one side is larger than another side by 1. How do I proceed to find the green's function for this problem?
You have $$\Big{[}\frac{d^{2}}{dx^{2}}+k^{2}\Big{]}u(x)=f(x)$$ With $u(0)=u(1)=0$ You set the equation for the Green's function $$\Big{[}\frac{d^{2}}{dx^{2}}+k^{2}\Big{]}G(x, y)=\delta(x-y)$$ Expand into the follwoing basis $$G(x, y)=\sum_{n}g_{n}(y)\sin{\pi{n}x}$$ This gives $$\sum_{n}\Big{[}k^{2}-(2\pi{n})^{2}\Big{]}g_{n}(y)\sin{\pi{n}x}=\delta(x-y)$$ Multiply by $$\sin{\pi{m}x}$$ And integrate over $[0, 1]$ $$\sum_{n}\Big{[}k^{2}-(\pi{n})^{2}\Big{]}g_{n}(y)\int_{0}^{1}\sin{\pi{n}x}\sin{\pi{m}x}dx=\sin{2\pi{m}y}$$ Now, using $$\int_{0}^{1}\sin{\pi{n}x}\sin{\pi{m}x}dx=\delta_{mn}$$ We have $$g_{m}(y)=\frac{\sin{\pi{m}y}}{k^{2}-(\pi{m})^{2}}$$ So that $$G(x, y)=\sum_{n}\frac{\sin{\pi{n}y}\sin{\pi{n}x}}{k^{2}-(\pi{n})^{2}}$$