So I was wondering, just how to voltage regulators (like the 7805) work? The most in depth answer I got was that they compare the output to the source and use the difference to keep it stable but how exactly do they regulate voltage?
A linear voltage regulator is a feedback control system using an op amp.
The output voltage of an opamp is given as
Vout = A(V2 - V1)
where
A = voltage gain
V2 and V1 are the non-inverting and inverting inputs.
If you pick off the output voltage of the regulator and feed it back into the V1 input of the opamp (negative feedback) you can make the opamp regulate its output.