the difference amplifier
The difference amplifier amplifies the difference between two signals and ignores whatever is common to both. Built from one op-amp and four resistors, it is the tool you reach for when a small signal of interest is riding on top of a large shared offset or shared noise, and you want only the small part.
In the classic circuit, input A enters the minus side through R1 with R2 as feedback, while input B enters the plus side through R1 with R2 from the plus node to ground. When the two resistor ratios match, the output is Vout equals (R2 over R1) times (VB minus VA). The part common to both inputs cancels, leaving only their difference, scaled by R2 over R1. For example, R1 of 10 kilohm and R2 of 100 kilohm give a gain of 10 applied to the difference.
This is the heart of measuring differential sensors, sensing current across a shunt resistor, and rejecting noise picked up equally on two wires. The catch: how well the common part cancels (the common-mode rejection) depends entirely on how closely the resistors match. With 1 percent resistors the rejection is limited, and the two inputs present different, modest input impedances. When you need high performance, an instrumentation amplifier, which buffers both inputs first, is the right upgrade.
Measure the small voltage across a current-sense shunt that floats near 12 V. The difference amp subtracts the two 12-ish V node voltages and amplifies only their tiny difference, turning a few millivolts of drop into a readable output.
It pulls a small differential signal out from on top of a big common voltage.
Common-mode rejection is only as good as the resistor matching; mismatched resistors leak the common part into the output. For high performance use an instrumentation amplifier.