# Lead compensator vs lag compensator?

I already know that lag compensator acts like PI controller and improves steady state and lead compensator acts like PD controller improves transient state but how they achieve their goal? Despite the fact that apparently both lead and lag compensator have same transfer function? How are they both different, especially in terms of poles and zeros?

$$H(s) = {K*\frac{s-z}{s-p}}\\ \\$$
when |z| < |p|, you have a lead compensator. It adds phase between a certain band, and can help you improve your phase margin. It can also increase your bandwidth. You typically use it to improve your transient as you mentionned. You can think of it as a PD controller cascaded with a low-pass filter. The gain K is optional, but if you set it to $$\frac{p}{z}$$, the DC gain is 1 which is usefull if you cascade the lead compensator to an existing controller.