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?

Since $\frac{e^{ikl}+e^{-ikl}}{2}=\cos(kl)$ and $\frac{e^{ikl}-e^{-ikl}}{2i}=\sin(kl)$ they are equivalent and both OK.
