Z1 = -I (L1/w) w1box;
a1=1;
b1=0;
c1=1/Z1;
d1 =1;
S21 =2/(a1+b1/z0+c1*z0+d1);
kext1 = (z0/(2 L1));
result =FullSimplify[S21-1];
A1=(( w kext1 )/(I w1box -  w  kext1 ));
FullSimplify[result-A1]

Z2 = -I (L2/w) w2box;
a2=1;
b2=0;
c2=1/Z2;
d2=1;
kext2 = (z0/(2 L2));
Phase =kl;
M1 = {{a1,b1},{c1,d1}} ;
M2 = {{Cos[Phase],-I*z0*Sin[Phase]},{-I/z0*Sin[Phase],Cos[Phase]}} ;
M3= {{a2,b2},{c2,d2}};
M = M1. M2.M3; 
MatrixForm[M1]
MatrixForm[M2]
MatrixForm[M3]
MatrixForm[M]

a3 = Part[M,1,1];
b3 = Part[M,1,2];
c3 = Part[M,2,1];
d3 = Part[M,2,2];
S12Coupling = FullSimplify[2(a3*d3-b3*c3)/(a3+b3/z0+c3*z0+d3)];
S21Coupling =FullSimplify[2/(a3+b3/z0+c3*z0+d3)]
FullSimplify[S21Coupling-S12Coupling]
S21pi = FullSimplify[S21Coupling -1];
S21pical= (( ((E^(I kl))-1)w1box +I w (((  kext2 (E^(I kl)) (-w1box  +I w kext1  (E^(I kl))))/(w2box+I kext2 w))- kext1) )/(( w1box+I w kext1 ) +(E^(2 I kl)) (w^2) kext1 kext2((1/(w2box+I kext2 w)))));
FullSimplify[S21pi-S21pical]