gain margin & phase margin
Gain margin and phase margin measure how close a stable loop is to the edge of instability — they're the safety buffer between 'works fine' and 'breaks into oscillation.' The danger condition is when the open-loop response has a gain of exactly 1 (0 dB) and a phase of exactly −180° at the same frequency, because then the feedback reinforces itself instead of cancelling. The two margins each ask: how much one of those quantities could change before you reach that fatal point.
Phase margin is the extra phase lag you could add at the gain-crossover frequency (where |G| = 1) before phase hits −180° — typically you want at least 45°, ideally 60°, which corresponds to a well-damped response with modest overshoot. Gain margin is the extra gain you could pile on at the phase-crossover frequency (where phase = −180°) before gain reaches 0 dB — usually you want at least 6 dB (a factor of 2). Skimpy margins mean a twitchy loop that rings and barely tolerates the inevitable real-world surprises: a slightly slower sensor, a hotter component, extra delay in the software. Generous margins mean a calm, robust loop — at the cost of some speed.
Rough rule of thumb: phase margin ≈ 100·ζ in degrees for a typical second-order loop, so a 60° phase margin lands you near ζ ≈ 0.6 — fast yet barely overshooting. It's the most-used single design target in classical control.