I'm terribly confused about the separation of variable method for PDE (heat eq particularly). The given conditions are:
$u_t(x,t)=u_{xx}(x,t), u(0,t)=u(L,t), u_x(0,t)=u_x(L,t), u(x,0)=f(x)$
Since I know the general cases, the general $u(x,t)$ should look like
$u(x,t)=\frac{a_0}{2}+\sum_{n=1}^{\infty} \left\{A_n\cos{\frac{2n{\pi}x}{L}+B_n}\sin{\frac{2n{\pi}x}{L}} \right\}e^{-(2n\pi)^2t}$
But I cannot reach this conclusion, and even worse, I have no idea about this part:
$X(0)=X(L), X'(0)=X'(L)$ follows
$A=X(0)=X(L)=A\cos{\sqrt{\lambda}L}+B\sin{\sqrt{\lambda}L}$
and
$\sqrt{\lambda}B=X'(0)=X'(L)=-\sqrt{\lambda}A\sin{\sqrt{\lambda}L}+\sqrt{\lambda}B\cos{\sqrt{\lambda}L}$
How can I conclude $\sqrt{\lambda}=2n\pi$ from these conditions above? It is clear when $-L\leq x\leq L$ since I can use the property of trig functions and simplify the expressions. But I have no idea when $0\leq x \leq L$.
So basically, when we plug in the boundary conditions we want a non trivial solution, such that either $A\neq0$ or $B\neq0$. If we look at the equations we can write them as $$ \underbrace{\begin{pmatrix} \cos(\sqrt{\lambda}L)-1 & \sin(\sqrt{\lambda}L)\\ -\sqrt{\lambda}\sin(\sqrt{\lambda}L)&\sqrt{\lambda}\cos(\sqrt{\lambda}L)-\sqrt{\lambda} \end{pmatrix}}_{=:M} \begin{pmatrix} A\\B \end{pmatrix}=0 $$
If we demand a nontrivial solution the determinant of $M$ shall be zero: $$ \det(M)=-2 \lambda (\cos(\lambda L)-1)\\ \Rightarrow \lambda=0\quad\lor\quad \lambda L=2\pi n, n\in\mathbb{N} $$
However for such $\lambda$ we see that is $M$ already the null matrix and therefore all $A,B$ lead to valid solutions.