Solution (source code)

= Solution

For a linear element in sinusoidal steady state, the <complex impedance> is the ratio of the <voltage> <phasor> to the <electric current> <phasor>, $Z=\widetilde V/\widetilde I$. Use the convention that the physical signal is the real part of its <phasor> times $e^{i\omega t}$. Then time <differentiation> becomes multiplication by $i\omega$.

For a <resistor>, <Ohm's law> gives $\widetilde V=R\widetilde I$. For a <capacitor>, $I=C\dot V$ gives $\widetilde I=i\omega C\widetilde V$. For an <inductor>, $V=L\dot I$ gives $\widetilde V=i\omega L\widetilde I$. Hence
$$
\boxed{Z_R=R,\qquad Z_C=\frac1{i\omega C}=-\frac{i}{\omega C},\qquad Z_L=i\omega L.}
$$
The imaginary part encodes the relative <phase> of <electric current> and <voltage>: <electric current> leads <voltage> in an ideal <capacitor> and lags it in an ideal <inductor>.