I've learned in school to calculate gain margin by first finding the phase crossover frequency at -180 deg, but sometimes I see people calculate gain margin by finding the phase crossover frequency at 0 deg which doesn't make sense to me. I'm confused as to why that method is used? I can't find any explanations online so any help is appreciated.
What causes instability problems is positive feedback, i. e., feedback with the same (or close to the same) phase as the input. In other words, 0˚ for the loop gain.
So where does the 180˚ come from?
Typically, it's assumed that the feedback signal is subtracted from the input signal to create the error signal. The negative sign implicit in the subtraction represents a phase rotation of 180˚. So, if you're looking at the phase shift of the loop gain without taking the subtraction into account, then you want to avoid phase shifts close to 180˚ instead.