JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

The Op-Amp & the Magic of Negative Feedback

Take a transistor amplifier and crank its gain to a hundred thousand or more — so high it is almost useless on its own. Then wrap a wire of [[negative-feedback|negative feedback]] around it and something magical happens: the wild beast becomes a precision instrument whose behaviour you set with two resistors. This is the [[operational-amplifier|op-amp]], the single most useful building block in all of analog electronics, and once you learn its two golden rules you can read half the schematics in the world.

An amplifier so good it is useless

In rung 5 you built a common-emitter amplifier and discovered the central tension of analog design: a single transistor gives you maybe a gain of 50, but that gain drifts with temperature, varies from part to part, and changes with the signal level. You can have gain or you can have predictability, but it is hard to have both. The op-amp solves this with a trick that feels like cheating.

An operational amplifier is just a many-transistor amplifier with two inputs — a non-inverting input (marked +) and an inverting input (marked −) — and one output. Its job is breathtakingly simple to state: it multiplies the *difference* between its two inputs by an enormous number called the open-loop gain, A. For a classic part like the venerable µA741, A is around 200,000. For a modern precision part it can exceed 10 million.

          V+  o------|+\
                     |  \
                     |   >----o  Vout = A * (V+  -  V-)
                     |  /
          V-  o------|-/        A ~ 200,000  (open-loop)

  Power rails (often omitted in schematics): +Vs at top, -Vs at bottom.
  Output can only swing between the two supply rails.
The op-amp symbol and its defining equation. The gain A is so large it is best thought of as 'practically infinite'.

Negative feedback: taming the beast

The fix is one of the great ideas of engineering. Take a sliver of the output and feed it *back* to the inverting (−) input, so that the output always works to *oppose* changes at the input. This is negative feedback, and it is the same principle a thermostat uses: when the room gets too warm, the furnace turns down. The system is constantly correcting itself toward a target.

Now watch what the enormous gain buys us. Suppose the inverting input creeps 1 microvolt *above* the non-inverting input. The output, multiplying that difference by 200,000, drops by 0.2 V. Through the feedback wire, some of that drop pushes the inverting input back *down*. The op-amp will keep adjusting its output until the two inputs are driven to within a *whisker* of each other — because if any meaningful difference remained, the colossal gain would have already blown the output to a rail. The system settles at the unique output voltage that makes the inputs nearly equal.

  1. Golden Rule 1 — the virtual short. The op-amp drives its output to make the two inputs equal: V₊ = V₋. No current actually flows between them, but for analysis they sit at the same voltage. If the + input is tied to ground, the − input behaves as a 'virtual ground' — 0 V, yet not actually connected to ground.
  2. Golden Rule 2 — no input current. The inputs draw essentially zero current (a real op-amp's input bias current is picoamps to nanoamps). So whatever current flows into a node at the input must flow straight out through the feedback components.

The inverting amplifier: gain from two resistors

Let us cash in the golden rules on the most common op-amp circuit of all. Tie the + input to ground. Connect the signal source through a resistor R_in to the − input, and connect a feedback resistor R_f from the output back to that same − node. Nothing else.

              R_in          R_f
  Vin  o----[====]----+----[====]----+----o Vout
                      |              |
                      |   |\         |
                      +---|-\        |
                          |  >-------+
                  GND o---|+/
                          |/

  Node X (the - input) is a VIRTUAL GROUND: V_X = V+ = 0 V
The inverting amplifier. The − input sits at a virtual ground even though no wire connects it to 0 V.

Now the analysis is almost embarrassingly short. By Rule 1 the − node is a virtual ground at 0 V. So the current pushed through R_in by the source is simply I = (Vin − 0) / R_in. By Rule 2 none of that current enters the op-amp, so all of it must continue through R_f to the output. The voltage drop across R_f is I × R_f, and since the node it starts from is at 0 V, the output sits *below* ground by exactly that amount:

  I_in  = (Vin - 0) / R_in          (current into the node)
  Vout  = 0 - I_in * R_f            (current out through R_f)

  =>  Vout = - (R_f / R_in) * Vin

  Example:  R_f = 100 kOhm, R_in = 10 kOhm
            Gain = -100k/10k = -10
            Vin = 0.2 V  ->  Vout = -2.0 V
Inverting gain depends ONLY on the ratio of two resistors — not on the op-amp's open-loop gain A.

The non-inverting amplifier & the buffer

What if you want a positive gain, and you do not want the input to load the source through a resistor? Feed the signal straight into the + input instead. Keep the feedback network — R_f from output to the − node, and R_g from the − node to ground — exactly as before.

  Vin o------|+\
             |  >----+----o Vout
        +----|-/      |
        |    |/       |
        |   [R_g]   [R_f]
        |    |        |
        +----+--------+
             |
            GND

  Rule 1:  V- = V+ = Vin
  The R_g/R_f pair is a voltage divider FROM Vout, and its tap = Vin:
      Vin = Vout * R_g / (R_g + R_f)
  =>  Vout = Vin * (1 + R_f / R_g)
Non-inverting amplifier. Gain is always ≥ 1, and the input draws virtually no current from the source.

Apply the rules again. Rule 1 says V₋ = Vin. The resistors R_f and R_g form a voltage divider from the output down to ground, and its midpoint *is* the − node — which we just said equals Vin. Solve the divider and you get Vout = Vin × (1 + R_f/R_g). Same prize as before: a clean gain set by a resistor ratio, A nowhere in sight, but now positive and ≥ 1.

Open-loop: the comparator

We spent this whole guide taming the op-amp's enormous gain. But sometimes that hair-trigger sensitivity is *exactly* what you want. Remove the feedback entirely — run the op-amp open-loop — and the golden rules no longer apply. The output now simply asks one yes/no question: is V₊ greater than V₋? If yes, the output slams to the positive rail; if no, it slams to the negative rail. You have built a comparator, a one-bit analog-to-digital decision maker.

  Vref ---|-\
          |  >---- Vout       Vin > Vref  ->  Vout = +Vsat (HIGH)
  Vin  ---|+/                  Vin < Vref  ->  Vout = -Vsat (LOW)

   Vin /\      /\       /\
      /  \    /  \     /  \     <- analog input crossing Vref
  --/----\--/----\---/----\--  Vref (threshold)

  Vout  __----____----______----   <- clean digital high/low
An op-amp used open-loop as a comparator: a smooth analog input becomes a crisp two-level digital output.

This is the bridge between the analog and digital worlds: a temperature sensor crossing a setpoint, an audio signal crossing zero, a battery voltage dropping below a threshold. In practice you use a *dedicated* comparator chip rather than a general-purpose op-amp — comparators are built to switch fast and to drive logic levels, whereas op-amps are optimised to stay linear and would respond sluggishly when bashed against the rails.

What feedback costs, and what comes next

Negative feedback feels like free precision, but there is no free lunch. The open-loop gain A is only enormous at DC; it falls off as frequency rises. A real op-amp obeys a constant called the gain–bandwidth product (GBW): closed-loop gain × bandwidth ≈ a fixed number. A µA741 has a GBW of about 1 MHz, so a gain of 10 leaves you 100 kHz of bandwidth, and a gain of 100 leaves only 10 kHz. You spend gain to buy bandwidth, or bandwidth to buy gain — pick one.

There is a second speed limit. No matter how small the signal, the output cannot ramp faster than a fixed volts-per-microsecond — its slew rate. Ask a 741 (slew rate ~0.5 V/µs) to reproduce a fast, large swing and it cannot keep up: a sine wave that should be smooth comes out as a lopsided triangle. GBW limits *small* signals; slew rate limits *large, fast* ones. Real designs must respect both.

You now hold the master key to analog circuits. Swap the feedback resistors for capacitors and the op-amp integrates or differentiates; arrange them in frequency-dependent networks and you get active filters that shape a signal's spectrum; wrap feedback around a power transistor and you get a voltage regulator that holds an output rock-steady. That is exactly where the next rung goes — filters and regulators — built from the very same two golden rules you learned today.