Combining a sine and cosine, with complex coefficients, into a single sine with a phase shift In section 13.4 of Townsend's Modern Approach to Quantum Mechanics on the partial wave expansion for scattering, the author discusses the asymptotic expansion of the spherical Bessel functions. He writes, for the wavefunction $\psi$ at large $r$,
$$\begin{align}
\psi(\vec r)&\rightarrow \sum_l \left[A_l\frac{\sin(kr-l\pi/2)}{kr}-B_l\frac{\cos(kr-l\pi/2)}{kr}\right]P_l(\cos\theta)\\
&=\sum_l C_l \frac{\sin(kr-l\pi/2+\delta_l(k))}{kr}P_l(\cos\theta)\\
\end{align}$$
where $P_l$ are the Legendre polynomials. I am puzzled by the operation going from the first to the second line. The books says "in the last step we have combined the sine and cosine into a sine with its phase shifted by $\delta_l(k)$".
I would know how to do this is $A_l$ and $B_l$ were real, but as far as I can tell, they are complex. I do not see how to do this with complex $A_l$ and $B_l$.
In particular, $C_l$ is also complex and $\delta_l$ is real. So it appears as if somehow an expression with 4 real parameters has been turned into an expression with only 3 real parameters. Could someone explain this to me?
 A: Let us consider the reverse transform
$C \sin (x+\delta) = C (\sin x \cos\delta + \cos x \sin\delta)$, then 
$A = C\cos\delta$ and $B = C\sin\delta$, and 
$C \sin (x+\delta) = A\sin x  + B\cos x$. You still have two parameters on both sides. 
If they are complex on one side, it is highly likely they will be complex on the other side. However, I guess that the original A and B are complex conjugates, otherwise, it seems to be difficult to normalize $\psi$. So there are three independent real parameters on both sides.
A: Write
$$
A_l\sin(kr-l\pi/2)-B_l\cos(kr-l\pi/2)=A_l\frac{e^{ikr-il\pi/2}-e^{-ikr+il\pi/2}}{2i}-B_l\frac{e^{ikr-il\pi/2}+e^{-ikr+il\pi/2}}{2}.
$$
This yields
$$
-\frac{1}{2}(iA_l+B_l)e^{ikr-il\pi/2}-\frac{1}{2}(-iA_l+B_l)e^{-ikr+il\pi/2}=-\frac{1}{2}(iA_l+B_l)\left[e^{ikr-il\pi/2}+\frac{-iA_l+B_l}{iA_l+B_l}e^{-ikr+il\pi/2}\right].
$$
Now, notice that, by normalization of the wave function one should have
 $\sum_l|A_l|^2+|B_l|^2=1$ and 
$$(-iA_l+B_l)(-iA_l^*+B_l^*)=|B_l|^2-|A_l|^2-2i[\operatorname{Re}(A_l)\operatorname{Re}(B_l)+\operatorname{Im}(A_l)\operatorname{Im}(B_l)].$$ 
Due to the normalization condition, we can choose $|B_l|^2=\cos^2\delta_l$ and $|A_l|^2=\sin^2\delta_l$. What really counts here is the relative phase between $A_l$ and $B_l$ because the wavefunction is defined aside an overall phase. We can choose $\operatorname{Im}(B_l)=0$. This finally gives
$$
e^{ikr-il\pi/2}+\frac{-iA_l+B_l}{iA_l+B_l}e^{-ikr+il\pi/2}=
e^{ikr-il\pi/2}+e^{-2i\delta_l}e^{-ikr+il\pi/2}
$$
as required. The key points of the proof are the normalization condition and an arbitrary phase available due to the properties of the wavefunction.
