Suppose we have a system of three joined strings, of different linear mass densities and subjected to a constant tension force, such that the velocity of propagation is $v_1$ in the string 1 (at $x <0$) and string 3 (at $x> L$), and $v_2$ on string 2 (from $x = 0$ to $x = L$). A plane wave of wave number $k_1$, frequency $ω$, and amplitude $A$ propagates to the right on string 1.
We have to calculate the reflected wave's final amplitude $A_r$ (on string 1), and the transmission wave amplitude $A_t$ on string 3, supposing that at first there is only one incident wave moving towards the positive X axis on string 1. Then, once this part is done, we have to show that the reflection and transmission coefficients ($R = |A_r/A|^2$ and $T = |A_t/A|^2$, respectively) are:
$$R = \frac{(k_2^2-k_1^2)^2\sin^2(k_2L)}{4k_1^2k_2^2+(k_2^2-k_1^2)^2\sin^2(k_2L)}$$
$$T = \frac{4k_1^2k_2^2}{4k_1^2k_2^2+(k_2^2-k_1^2)^2\sin^2(k_2L)}$$
Attempt:
(a) In the $x<0$ region, we have an incident ondulatory movement (OM) and a reflected one at $x=0$, that spread with velocity $v_1$:
$$y_1(x,t) = Ae^{i(k_1x-\omega t)} + Be^{-i(k_1x+\omega t)}$$
(b) In the $0<x<L$ region, we have a transmitted OM and a reflected one at $x=L$, that spread with velocity $v_2$:
$$y_2(x,t) = Ce^{i(k_2x-\omega t)} + De^{-i(k_2x+\omega t)}$$
(c) In the $L<x$ region, we have a transmitted OM that spreads with velocity $v_1$:
$$y_3(x,t) = Ee^{i(k_1x-\omega t)}$$
Where $B = A_r$ and $E = A_t$
The boundary conditions at $x=0$ and $x=L$ are:
1 - The string is continuous in $x=0$:
$$y_1(0,t)=y_2(0,t) \Longrightarrow A+B=C+D$$
2 -
$$\left[ \frac{\partial{y_1}}{\partial{x}} \right]_{x=0} = \left[ \frac{\partial{y_2}}{\partial{x}} \right]_{x=0} \Longrightarrow k_1(A-B) = k_2(C-D)$$
3 - The string is continuous in $x=L$:
$$y_2(L,t)=y_3(L,t) \Longrightarrow Ce^{ik_2L} + De^{-ik_2L} = Ee^{ik_1L}$$
4 -
$$\left[ \frac{\partial{y_2}}{\partial{x}} \right]_{x=L} = \left[ \frac{\partial{y_3}}{\partial{x}} \right]_{x=L} \Longrightarrow k_2(Ce^{ik_2L} - De^{-ik_2L}) = k_1Ee^{ik_1L}$$
Then, solving that 4 unknown equation system in terms of A, we obtain the following results:
$$B=A_r=\frac{i\left(\frac{k_1^2-k_2^2}{k_1k_2}\right)\sin{k_2L}}{2\cos{k_2L}-i\left( \frac{k_1^2+k_2^2}{k_1k_2} \right)\sin{k_2L}}A$$
$$E=A_t=\frac{2Ae^{-ik_1L}}{2\cos{k_2L}-i\left( \frac{k_1^2+k_2^2}{k_1k_2} \right)\sin{k_2L}}$$
So far I think these results are fine. However, when I try to do the second part of the exercise and I try to calculate the R and T coefficients, I don't know what to do with the imaginary parts of both expressions because the R and T coefficients are only real.
Please, could anyone tell me which would be the next step to obtain R and T?
Thanks in advance!