Which method is correct? To solve this equation  $X''+k^2X=0$  we look to the solution in the form $X(x)=e^{rx}$ which has roots $r=\pm i k $
My question is? 
If we need to apply the BCs $X(\pm l)=X(0)$
which one of the following approch is correct.
First write the solution in the form $X(x)=A cos(k x) + B \sin(k x)$
then apply boundary conditions which become $A \cos(kl) \pm B \sin(kl)=A$
Second approach is that write the solution in this form $X(x)=A e^{ikx}+B e^{-ikx}$
Then apply BCS to get $A e^{\pm ikl}+B e^{\mp i kl}=A+B$
I am so confused, Which one is correct?
 A: Since $\frac{e^{ikl}+e^{-ikl}}{2}=\cos(kl)$ and $\frac{e^{ikl}-e^{-ikl}}{2i}=\sin(kl)$ they are equivalent and both OK.
A: There are special cases that can arise in studying such equations, such as when $k=0$. The general theorems of existence and uniqueness are nice when you choose fixed conditions for the function and the derivative. Then it turns out that the special cases are handled as limiting cases. For example, you want $X(0)=0$. Further normalize by setting $X'(0)=1$. The solution of
$$
                   X''+k^{2}X = 0,\\
                   X(0)=0,\;\; X'(0)=1
$$
is
$$
                  X(x)=\frac{\sin{kx}}{k}
$$
If you use the $X''+kX=0$ instead of $k^{2}$, the solution is still guaranteed to have a power series expansion in the parameter $k$, which means that the correct solution at $k=0$ is a limit. (It is interesting that $\frac{\sin(\sqrt{k}x)}{\sqrt{k}}$ has an everywhere convergent power series in $k$, but it must from general considerations; in this case it works because the function has only even power of $\sqrt{k}$, which is the only way that could work out.) Using limit calculus,
$$
                \lim_{k\rightarrow 0}\frac{\sin(kx)}{k}=x.
$$
Notice that $x$ is the correct solution of $X''=0$ with $X(0)=0$, $X'(0)=1$. That's a big advantage if you don't want to deal with special cases.
Once you have the left endpoint condition satisfied, then you can impose the second and solve for values of $k$ that will work:
$$
                 \frac{\sin{kl}}{k}=0 \implies kl = \pm \pi,\pm 2\pi,\cdots.
$$
Notice that $k=0$ is ruled out because this limiting case gives you $l=0$, which is also what you get if you evaluate $x$ at $l$.
