Complex number sine-cosine simplification: I can't understand this step. Good evening, I'm working on this step coming from a differential equation.
I have:
$A\cos(\frac{kL}{2})+Ai\sin(\frac{kL}{2})+B\cos(\frac{kL}{2})-Bi\sin(\frac{kL}{2})=0$
$(A+B)\cos(\frac{kL}{2})+(A-B)i\sin(\frac{kL}{2})=0$
This expression is set equal to:
$A\cos(\frac{kL}{2})+B\sin(\frac{kL}{2})=0$
$A$ and $B$ are constants (may be complex, not specified for this). $L$ is a real number. Obvioulsy this should be solved for variable $k$.
I can't explain which rules has been used to write down this step. Many thanks.

We have:
$$A\cos\left(\frac{kL}{2}\right)+Ai\sin\left(\frac{kL}{2}\right)=Ae^{i\frac{kL}{2}}$$
$$B\cos\left(\frac{kL}{2}\right)-Bi\sin\left(\frac{kL}{2}\right)=Be^{-i\frac{kL}{2}}$$
Looking at this I would assume that the step made was redefining one of the constants, since we cannot get from this line to the one stated
