The operation of a voltage regulator is based on automatic control theory. A voltage regulator works by comparing the output voltage to an internal reference. The difference (the error) is amplified and the result is used to increase or decrease the output voltage, to minimize the error, in what is called a closed loop feedback circuit. The output is kept at the set value, even with variations in Vin or load.