Maximum Power Transfer in an AC Circuit
The reference is Desoer &amp; Kuh, Basic Circuit Theory. 

First, notation and an expression for average power Pav.  For a sinusoidal voltage v and current i at the same frequency:
$$v(t)=V_m cos(\omega t + \measuredangle{V})= Re(Ve^{j \omega t}) \text{ where } V \triangleq V_m e^{j \measuredangle{V}}$$
$$i(t)=I_m cos(\omega t + \measuredangle{I})= Re(Ie^{j \omega t}) \text{ where } I \triangleq I_m e^{j \measuredangle{I}}$$ 
$$p(t)=v(t)i(t)=\frac{1}{2}V_mI_m cos(\measuredangle{V}-\measuredangle{I})+\frac{1}{2}V_mI_m cos(2\omega t +\measuredangle{V}+\measuredangle{I})$$

Averaging over a period, the average power Pav is: 
$$P_{av}=\frac{1}{2}V_mI_m cos(\measuredangle{V}-\measuredangle{I})=\text{Re}(\frac{1}{2}V \overline{I})$$

If V is related to I by a complex impedance Z, V=IZ, then: 
$$P_{av}=\frac{1}{2}\text{Re}(I \overline{I} Z) = \frac{1}{2}|I|^2 \text{Re}(Z)$$

With that out of the way, on to the maximization.  With source voltage vs, load voltage vl, and current i as above, fixed source impedance Zs=Rs+jXs, and to-be-determined load impedance Zl=Rl+jXl, the average power delivered to the load Pav is: 
$$P_{av}=\frac{1}{2} |I|^2 R_l$$

Since 
$$I=\frac{V_s}{Z_s+Z_l}$$

it follows that 
$$P_{av}=\frac{1}{2} |V_s|^2 \frac{R_l}{|Z_s+Z_l|^2}=\frac{1}{2} |V_s|^2 \frac{R_l}{(R_s+R_l)^2+(X_s+X_l)^2}$$

You can now maximize this expression by separately differentiating with respect to the imaginary and real parts of Zl:


With respect to Xl, which only appears in one location, the maximum is achieved at Xl=-Xs.
With respect to Rl, which appears in two locations, the maximum is achieved at Rl=Rs.


So, for maximum power delivery, set Zl to: 
$$Z_{l,opt}= R_s-jX_s = \overline{Z_s}$$ 
The maximum average power delivered to that load is:

$$P_{av,max}=\frac{|V_s|^2}{8R_s}$$