>
section 3 of 1312 min read

3. Op-Amp Linear Applications: The Two Golden Rules

This is the crown jewel of analog electronics. With two simple rules and a piece of paper, we can analyze 90% of op-amp circuits without ever thinking about the transistors inside.

3.1 The two golden rules of an op-amp with negative feedback

  1. The output does whatever it must to make V+=VV_+ = V_-. Whatever current it has to source or sink, whatever voltage it has to produce, the output drives so as to equalize the inputs. This works because of high open-loop gain: any imbalance gets multiplied by 10510^5 and shoves the output until the imbalance is gone.

  2. No current flows into the inputs. Or: a vanishingly small current. Real op-amps have nanoamps to femtoamps of bias current, but for design we treat it as zero.

These rules are exact in the limit of infinite gain plus negative feedback. Real op-amps approximate them to within a fraction of a percent in well-designed circuits.

A subtlety. The first rule is conditional: it only holds if the feedback is negative. If you wire the feedback to the V+V_+ input instead of VV_-, the loop has positive feedback, and the output races to one rail and stays there. That is not "V+=VV_+ = V_-"; that is a comparator (Section 4) or a Schmitt trigger or an oscillator. Always check that your feedback path goes back to the inverting input before invoking the rule.

"Servo" intuition. A car's cruise control compares your set speed (the V+V_+) to the actual speed (the VV_- via a tachometer). If V+>VV_+ > V_- it presses the gas; if V+<VV_+ < V_- it lets up. The car asymptotically achieves V+=VV_+ = V_-. The "output" of the controller is the throttle position, doing whatever it must to make set-speed equal actual-speed. This is exactly the op-amp servo.

3.2 Inverting amplifier

plaintext
                  R_f
              ┌──[==]──┐
              │        │
   V_in ─[R_in]── V- ──●
                  │\│  │
                  │ \  │
                  │  ●─●─── V_out
                  │ /
              GND─│+/
                  │/

V+V_+ is grounded. By Rule 1, V=V+=0V_- = V_+ = 0 ("virtual ground"). The VV_- node sits at zero volts even though no wire connects it to ground; the op-amp servos to keep it there.

KCL at the VV_- node, using Rule 2 (no current into the input pin):

Vin0Rin+Vout0Rf=0\frac{V_{in} - 0}{R_{in}} + \frac{V_{out} - 0}{R_f} = 0

Solve:

Vout=RfRinVin\boxed{V_{out} = -\frac{R_f}{R_{in}}\, V_{in}}

The closed-loop gain is set entirely by the ratio of two resistors. Stable, predictable, independent of the op-amp's actual gain (as long as it is high). The negative sign reminds you the output is inverted: positive in, negative out.

This single derivation, three lines long, is the most-used result in all of analog electronics. Internalize it.

"Virtual ground" anticipates confusion. Beginners sometimes ask: "if VV_- is at ground, why isn't current flowing through RinR_{in} into ground? Why doesn't the input load me?" The answer: the current from VinV_{in} does flow through RinR_{in} into the VV_- node, but it does not stop there. It continues through RfR_f to the output, sourced or sunk by the op-amp. The VV_- node is at zero volts, but it is not tied to ground; it is held at zero by the servo. The input impedance seen by VinV_{in} is exactly RinR_{in}, because VinV_{in}'s drop is across RinR_{in} to a virtual ground. This is why an inverting amp loads the source: a 1 kΩ RinR_{in} presents a 1 kΩ input impedance, period.

3.3 Non-inverting amplifier

plaintext
   V_in ─────│+\
             │  \
             │   ●─────────●── V_out
             │  /          │
        ┌────│-/          [R_f]
        │    │/            │
        ●─────────────────●

       [R_g]

       GND

VinV_{in} goes to V+V_+. Feedback divider Rf/RgR_f / R_g from VoutV_{out} to VV_-. By Rule 1, V=V+=VinV_- = V_+ = V_{in}. The voltage at the Rf/RgR_f / R_g junction is VinV_{in}, so the divider tells us:

V=VoutRgRf+Rg=VinV_- = V_{out} \cdot \frac{R_g}{R_f + R_g} = V_{in}

Solve:

Vout=(1+RfRg)Vin\boxed{V_{out} = \left(1 + \frac{R_f}{R_g}\right) V_{in}}

Output is in phase with input. The gain is always 1\geq 1. The input impedance is the op-amp's own input impedance, typically megohms or more, because VinV_{in} goes straight into the high-impedance V+V_+ pin. High input impedance, gain set by resistor ratio.

3.4 Voltage follower (unity-gain buffer)

Take the non-inverting amp with Rf=0R_f = 0 (short) and Rg=R_g = \infty (open):

Vout=VinV_{out} = V_{in}

A buffer. Gain of 1, very high input impedance, very low output impedance. Used as the first stage after any high-impedance source: pH electrodes, photodiodes (followed by transimpedance), high-impedance voltage references. Nothing in the world loads the source; the output drives whatever load comes next.

In RF lingo this is sometimes called a "presence amplifier" because it makes the source's voltage present at the output without consuming any current from the source.

3.5 Summing amplifier

plaintext
                          R_f
                      ┌───[==]───┐
                      │          │
   V_1 ─[R_1]─┐       │          │
              │       │          │
   V_2 ─[R_2]─●── V- ─●          │
              │       │\│        │
   V_3 ─[R_3]─┘       │ \●───────●─── V_out
                      │ /
                  GND─│+/
                      │/

Multiple inputs through resistors converge at the virtual ground. Apply KCL at VV_-, again using both golden rules:

V1R1+V2R2+V3R3+VoutRf=0\frac{V_1}{R_1} + \frac{V_2}{R_2} + \frac{V_3}{R_3} + \frac{V_{out}}{R_f} = 0

Solve:

Vout=Rf(V1R1+V2R2+V3R3)V_{out} = -R_f\left(\frac{V_1}{R_1} + \frac{V_2}{R_2} + \frac{V_3}{R_3}\right)

If all input resistors are equal (R1=R2=R3=RR_1 = R_2 = R_3 = R), this simplifies to a sign-flipped sum:

Vout=RfR(V1+V2+V3)V_{out} = -\frac{R_f}{R}(V_1 + V_2 + V_3)

If Rf/R=1/3R_f / R = 1/3, that is the negative of the average. Different input resistors produce a weighted sum. Audio mixers use this (each channel through its own gain pot to a virtual ground); analog computers in the 1960s did matrix arithmetic with banks of summing amps; the input stage of a weighted-resistor DAC (Section 8) is exactly this.

3.6 Subtracting / difference amplifier

A single op-amp circuit that computes Vout=K(V2V1)V_{out} = K(V_2 - V_1). Two resistors R1R_1 feed the inputs, two resistors RfR_f on each side: R1R_1 from V1V_1 to VV_-, RfR_f in feedback; on the other side, R1R_1 from V2V_2 to V+V_+, and RfR_f from V+V_+ to ground. With matched resistors:

Vout=RfR1(V2V1)V_{out} = \frac{R_f}{R_1}(V_2 - V_1)

Trade-offs: the input impedance on each side is just R1R_1 (low), and the CMRR depends critically on resistor matching. A 1% mismatch sets CMRR to about 40 dB. For real precision you use the instrumentation amplifier, next.

3.7 Instrumentation amplifier with full derivation

The "in-amp" is the gold standard for amplifying small differential signals from sensors with high CMRR and high input impedance on both sides. It is built from three op-amps and seven resistors:

plaintext
                                 R_f
                              ┌──[==]──┐
                              │        │
   V_1 ───┤+\                 │        │
          │  A1 ──────────────●── V_x ─┴──┐
       ┌──┤-/                                │
       │   │                                  │
       │   ●─── R_g ───●                      │     ┌── R ──┐
       │               │                      │     │       │
       │   ●           │                  V_x ●─[R]─●── V- ─●── V_out (A3)
       │   │           │                            │\│
       └──┤+\          │                            │ \
          │  A2 ──┬────●── V_y ──────────────●─[R]──● ●─────●─── V_out
   V_2 ──┤-/      │                                 │/
          │       │                          V_y ───●── V+ ──[R]── GND
          │       │  R_f                            
          │       └──[==]──┐                  (A3 = unity-gain
          │                │                   difference amp)
          └────────────────┘

Conceptually: A1 and A2 are two non-inverting buffers tied together through one gain-setting resistor RgR_g, with RfR_f in feedback on each. A3 is a unity-gain difference amp that converts the differential signal VyVxV_y - V_x into a single-ended output.

Derivation of the gain. Consider the input stage. The op-amps A1 and A2 each obey Rule 1, so the voltages at the bottoms of RgR_g on each side are exactly V1V_1 and V2V_2. The current through RgR_g is therefore:

i=V2V1Rgi = \frac{V_2 - V_1}{R_g}

That same current flows through both RfR_f resistors (Rule 2: no current into the op-amp inputs). So:

Vx=V1iRf,Vy=V2+iRfV_x = V_1 - i R_f, \quad V_y = V_2 + i R_f

The difference between the input-stage outputs:

VyVx=(V2V1)+2iRf=(V2V1)(1+2RfRg)V_y - V_x = (V_2 - V_1) + 2 i R_f = (V_2 - V_1)\left(1 + \frac{2 R_f}{R_g}\right)

The output stage A3 is a unity-gain difference amp, so:

Vout=(V2V1)(1+2RfRg)\boxed{V_{out} = (V_2 - V_1)\left(1 + \frac{2 R_f}{R_g}\right)}

The gain is set by a single external resistor RgR_g. Make RgR_g smaller and gain rises. The two input buffers handle the signal differentially without ever converting it to a single-ended representation, so common-mode signals see unity gain through them and are then rejected by the difference amp. The input impedance is the V+V_+ impedance of A1 and A2: typically gigohms.

The classic chip is the AD620 (single-supply, RgR_g external, gain 1 to 10000, CMRR 110 dB, 1.5μV/C1.5 \mu V/^\circ\text{C} offset drift). The INA128/INA126 are similar. The LT1167 is a precision in-amp with sub-microvolt offset and ultra-high CMRR. The AD8253 is digitally programmable-gain. The AD8429 is the ultra-low-noise champion.

In-amps are standard at the front of every ECG, every strain-gauge bridge, every thermocouple amplifier, every load cell. If you have ever seen a Wheatstone bridge connect to an ADC, an in-amp is in between.

3.8 V-to-I and I-to-V converters

Voltage-to-current (V-to-I). Forces an output current proportional to input voltage, into a load. Used to drive laser diodes (which are current-mode devices), 4 to 20 mA industrial sensor loops, magnetic flux through a coil. A common topology puts the load in the feedback path of an op-amp.

Current-to-voltage (I-to-V), the transimpedance amplifier (TIA). This is the op-amp circuit you reach for when you want to read a photodiode, a photomultiplier tube, an ionization chamber, or any other current-output sensor.

plaintext
                 R_f
             ┌──[==]──┐
             │        │
   I_in ─────●── V- ──●── V_out
                │\│
                │ \
                │ /
            GND─│+/
                │/

VV_- is held at virtual ground. The input current IinI_{in} has nowhere to go but through RfR_f, producing a voltage drop. So:

Vout=IinRfV_{out} = -I_{in} R_f

The "gain" is in ohms, hence "transimpedance." A photodiode delivering 1 µA of photocurrent into a TIA with Rf=1R_f = 1 MΩ produces 1 V out: a million volts per amp.

Trade-offs: the photodiode has a junction capacitance CdC_d that, together with RfR_f, creates a peak in the loop response. To stabilize it, designers add a small feedback capacitor in parallel with RfR_f (a few pF), which both rolls off the high-frequency peaking and limits the noise bandwidth. The OPA657, OPA837, ADA4817, and OPA855 are popular high-speed transimpedance amplifiers. They show up in fiber-optic receivers, LiDAR front-ends, particle detectors, and laser power monitors.

For hardware security: the TIA is in the photodiode receivers used to read out laser fault injection probes, optical fault detectors, and the photon detectors on a quantum random number generator.

3.9 Integrator

Replace the feedback resistor with a capacitor.

plaintext
                  C_f
              ┌──┤├──┐
              │      │
   V_in ─[R]──●── V-─●── V_out
                 │\│
                 │ \
                 │ /
             GND─│+/
                 │/

KCL at VV_- (virtual ground):

VinR+CfdVoutdt=0\frac{V_{in}}{R} + C_f \frac{d V_{out}}{dt} = 0

Solve for VoutV_{out}:

Vout(t)=1RCf0tVin(τ)dτ\boxed{V_{out}(t) = -\frac{1}{R C_f} \int_0^t V_{in}(\tau)\, d\tau}

A real-time analog integrator. Apply a constant DC voltage and the output ramps linearly. Apply a sine and you get a cosine (90° phase shift, with attenuation rising as 1/ω1/\omega).

Where they live:

  • Analog computers (1960s, mostly historical, but actively revived for some hardware ML).
  • Dual-slope and sigma-delta ADCs (Section 8). Both architectures rely on integrators.
  • Active filters (each integrator stage is one pole; we will see Sallen-Key in Section 5).
  • PID controllers (the I term).
  • CRT sweep generators, where a constant input current charges a capacitor to produce a linear time base.
  • Power converters, where an integrator makes the loop respond to error history rather than instantaneous error.

A practical wrinkle: with no DC blocking, op-amp offset and bias current cause the integrator to ramp toward the rails over time even with zero input. Real implementations add a large parallel resistor RpR_p across CfC_f to provide a slow DC reset path, turning the perfect integrator into a low-pass filter at very low frequency.

3.10 Differentiator

Swap the integrator's resistor and cap:

plaintext
                 R_f
              ┌─[==]──┐
              │       │
   V_in ──┤├──●── V-─●── V_out
              C_in
                 │\│
                 │ \
                 │ /
             GND─│+/
                 │/

KCL gives:

Vout=RfCindVindtV_{out} = -R_f C_{in} \frac{d V_{in}}{dt}

A real-time analog differentiator. It outputs the rate of change of the input. Useful for edge detection, but plagued by noise sensitivity: differentiation amplifies high frequencies (gain proportional to frequency), so any high-frequency noise on the input becomes huge at the output. Practical differentiators add a series resistor with CinC_{in} to limit the high-frequency gain, sacrificing some of the ideal differentiator behavior in exchange for a usable circuit.

3.11 AC-coupled (AC) amplifiers

Take an inverting amp and add a series capacitor at the input:

Vout=RfRinVinat AC; DC blockedV_{out} = -\frac{R_f}{R_{in}}\, V_{in}\quad\text{at AC; DC blocked}

The cap blocks any DC offset on the source so that the op-amp does not amplify the source's DC bias. Useful for audio, where the source might have a random DC offset that you do not want amplified into clipping. The cap and RinR_{in} form a high-pass filter at fL=1/(2πRinC)f_L = 1/(2\pi R_{in} C); choose CC large enough that fLf_L is below your signal's lowest frequency.

3.12 Logarithmic and antilog amplifiers

Use a transistor's exponential V-I curve in feedback to compute the log of the input.

plaintext
                         (collector grounded)
                       ┌── Q ──┐
                       │       │ (V_BE drop)
   V_in ─[R]──●── V- ──●       ●── V_out
              │   │\│
              │   │ \
              │   │ /
            GND ──│+/
                  │/

A transistor in feedback whose collector is grounded, base in the feedback path, emitter to VV_-. The diode equation gives IE=ISexp(VBE/VT)I_E = I_S \exp(V_{BE}/V_T). The op-amp servos VBEV_{BE} to whatever value makes the emitter current equal to the input current Iin=Vin/RI_{in} = V_{in}/R:

VBE=VTln(VinRIS)V_{BE} = V_T \ln\left(\frac{V_{in}}{R I_S}\right)

So Vout=VBEV_{out} = -V_{BE} is proportional to lnVin\ln V_{in}. A log amp.

Reverse the role of resistor and transistor (transistor at the input, resistor in feedback) and you get an antilog amp: Voutexp(Vin)V_{out} \propto \exp(V_{in}).

Why bother? Three classic uses.

  • Analog multipliers. loga+logb=log(ab)\log a + \log b = \log(ab), then antilog: log + sum + antilog = multiply. The Gilbert cell (1968) is a more efficient four-quadrant analog multiplier, but the log/antilog approach was the first.
  • Audio compressors and VCAs. The exponential mapping matches our perception of loudness.
  • Photodiode amplifiers spanning many decades. Light intensity in nature spans 10 orders of magnitude; a log amp compresses that into a single-decade voltage swing readable by a normal ADC.

In hardware security, log amps appear in side-channel power-trace AGC stages, where the dynamic range of a chip's current draw can span four orders of magnitude across an algorithm.