---
title: Inverting, non-inverting, summing and difference amplifiers
heading: Four circuits that do most of analog's arithmetic
eyebrow: C6 · Lesson 19 · Amplifier configurations
xp: 60
---

::: hook
With the golden rules, an op amp and a few resistors can add, subtract and scale signals. A mixing desk sums microphones with an inverting summer; a sensor bridge's tiny difference is pulled out of a large common voltage by a difference amplifier; a thermocouple's millivolts are raised to volts by a non-inverting stage. This lesson is a sandbox: you'll design each one and the simulation will grade it.

::: play
- A summing amplifier: three inputs, each through its own resistor, into the virtual ground. The output is minus the weighted sum.
- Change one input resistor. Which input's weight changes?
- Make all three resistors equal to $R_f$. What does the circuit compute?
:::
:::

```sim circuit
V1 a 0 1            @ -6,-4 down 8
V2 b 0 0.5          @ -4,-2 down 6
V3 c 0 -0.2         @ -2,0 down 4
R1 a m 10k          @ 0,-4 right 4
R2 b m 10k          @ 0,-2 right 4
R3 c m 10k          @ 0,0 right 4
RF m out 10k        @ 4,-6 right 3
U1 0 m out          @ 4,1
slider: R1 1k..100k log
slider: RF 1k..100k log
scope: v(out)
time: 0..1m s
meter: v(out)
```

::: predict
## A summing amplifier has $R_f$ = 10 kΩ and inputs of 1 V through 10 kΩ and 0.5 V through 5 kΩ. What's the output?

- [ ] −1.5 V
- [x] −2 V
- [ ] +2 V
- [ ] −0.75 V

::: reveal
−2 V. Each input pushes its own current into the virtual ground: 0.1 mA and 0.1 mA. All 0.2 mA flows through $R_f$, putting the output at $-0.2\text{ mA} \times 10\text{ kΩ} = -2$ V. Because the summing node sits at 0 V, the inputs don't interact: each one's weight is just $R_f/R_k$.
:::
:::

::: nameit
## The four workhorses

**Inverting:** $v_o = -\frac{R_f}{R_\text{in}}v_\text{in}$. Input impedance $R_\text{in}$.

**Non-inverting:** $v_o = \left(1 + \frac{R_f}{R_g}\right)v_\text{in}$. Input impedance very high.

**Summing (inverting):** each input through its own resistor into the virtual ground:

$$v_o = -R_f\left(\frac{v_1}{R_1} + \frac{v_2}{R_2} + \cdots\right)$$

The inputs are isolated from each other by the virtual ground.

**Difference amplifier:** $v_2$ through $R_1$ to the $+$ input, with $R_2$ from there to ground; $v_1$ through $R_1$ to the $-$ input, with $R_2$ as feedback. With matched ratios:

$$v_o = \frac{R_2}{R_1}(v_2 - v_1)$$

It ignores whatever voltage the two inputs share (the **common-mode** voltage), as long as the resistor ratios match. A 1% mismatch lets about 1% of the common-mode voltage through, which is why precision versions use laser-trimmed resistor networks, or a three-op-amp **instrumentation amplifier** with buffered inputs.

**Choosing resistor values.** Gain is set by ratios, so any scale works in principle. In practice: above about 1 kΩ so the op amp isn't loaded, below about 1 MΩ so input bias currents and noise don't matter.
:::


::: example
## A summing amplifier with three 10 kΩ inputs and $R_f$ = 10 kΩ receives 1 V, 0.5 V and −0.2 V. What is its output?

::: solution
1. **Sum the inputs.** With every resistor equal, each input has a gain of −1:
   $$\begin{aligned} v_o &= -(1 + 0.5 - 0.2) \\ &= -1.3\ \text{V} \end{aligned}$$
2. **Why they don't interact.** Each input's current flows into the virtual ground independently.

**Answer:** the output is −1.3 V.
:::
:::

::: example
## A difference amplifier with $R_1$ = 10 kΩ and $R_2$ = 100 kΩ receives 2.5 V and 2.6 V. What is its output?

::: solution
1. **Output.**
   $$\begin{aligned} v_o &= \frac{100}{10}(2.6 - 2.5) \\ &= 1.0\ \text{V} \end{aligned}$$
2. **Common mode.** The 2.5 V common to both is rejected.

**Answer:** the output is 1.0 V.
:::
:::

::: example
## A 4-bit DAC is a summing amplifier with $R_f$ = 10 kΩ and inputs of 10, 20, 40 and 80 kΩ, driven by 5 V logic. What does it output for the code 1011, and what's one step?

::: solution
1. **Each bit's weight.** Each input contributes $-5\ \text{V}\,\frac{R_f}{R_k}$: the most significant bit gives −5 V, then −2.5, −1.25 and −0.625 V.
2. **Code 1011.** The first, third and fourth bits are on:
   $$\begin{aligned} v_o &= -(5 + 1.25 + 0.625) \\ &= -6.875\ \text{V} \end{aligned}$$
3. **One step and full scale.** One step is the least significant bit's −0.625 V, and full scale (1111) is −9.375 V.
4. **Wider converters.** Binary-weighted resistors need a 2ⁿ spread, which is why wider converters use the R–2R ladder instead.

**Answer:** the code 1011 gives −6.875 V, and one step is −0.625 V.
:::
:::

::: check
kind: design
given: G = 5 | 10 | 22
choose: RF
goal: dc(v(out)) = -G*0.1 ± 2%
solution: RF = G*1000

## An inverting amplifier with $R_\text{in}$ = 1 kΩ has 0.1 V in. Choose $R_f$ for a gain of −{G}.

```sim circuit
V1 in 0 0.1         @ 0,0 down 2
R1 in m 1k          @ 0,0 right
RF m out 1k         @ 2,-2 right 3
U1 0 m out          @ 2,1
scope: v(out)
time: 0..1m s
meter: v(out)
```

::: right
Right. $R_f = G \times R_\text{in}$.
:::
:::

::: check
kind: design
given: G = 2 | 5 | 11
choose: RF
goal: dc(v(out)) = G*0.2 ± 2%
solution: RF = (G - 1)*1000

## A non-inverting amplifier with $R_g$ = 1 kΩ has 0.2 V in. Choose $R_f$ for a gain of {G}.

```sim circuit
V1 in 0 0.2         @ 0,2 down 2
U1 in m out         @ 2,1 flip
RF m out 100        @ 2,-1 right 3
RG m 0 1k           @ 2,-1 up 2
scope: v(out)
time: 0..1m s
meter: v(out)
```

::: right
Right. $1 + R_f/R_g = G$, so $R_f = (G - 1)R_g$.
:::
:::

::: check
kind: design
choose: R1, R2
goal: dc(v(out)) = -2.5 ± 2%
solution: R1 = 10k; R2 = 5k

## Mix two inputs into a summer with $R_f$ = 10 kΩ so that the output is $-(v_1 + 2v_2)$, with $v_1$ = 0.5 V and $v_2$ = 1 V. Choose $R_1$ and $R_2$.

```sim circuit
V1 a 0 0.5          @ -4,-2 down 6
V2 b 0 1            @ -2,0 down 4
R1 a m 1k           @ 0,-2 right 4
R2 b m 1k           @ 0,0 right 4
RF m out 10k        @ 4,-4 right 3
U1 0 m out          @ 4,1
scope: v(out)
time: 0..1m s
meter: v(out)
```

::: right
Right. Weights $R_f/R_1 = 1$ and $R_f/R_2 = 2$.
:::
:::

::: check
given: R1 = 10 | 22; R2 = 47 | 100; v1 = 2 | 2.5; v2 = 2.1 | 2.6
answer: R2/R1*(v2 - v1)
unit: V
tolerance: 0.5%

## A difference amplifier has matched ratios $R_2/R_1$ = {R2} kΩ/{R1} kΩ. Its inputs are $v_1$ = {v1} V and $v_2$ = {v2} V. What's the output?

::: right
Right. $\frac{R_2}{R_1}(v_2 - v_1)$ = {answer}: the shared voltage is ignored.
:::

::: misses
- [R2/R1*(v1 - v2)] It's $v_2 - v_1$, with $v_2$ on the + input.
- [R2/R1*(v2 + v1)] It amplifies the difference.
- [any] Not yet. $v_o = (R_2/R_1)(v_2 - v_1)$.
:::
:::

::: check
kind: parts
given: V = 3.3 | 5; Rf = 5 | 10; b = 5 | 9 | 13

## A 4-bit binary-weighted DAC has $R_f$ = {Rf} kΩ and inputs of $R_f$, $2R_f$, $4R_f$ and $8R_f$, driven by {V} V logic.

::: part
answer: -V*(floor(b/8) + floor(b/4 - 2*floor(b/8))/2 + floor(b/2 - 2*floor(b/4))/4 + (b - 2*floor(b/2))/8)
unit: V
tolerance: 0.5%

### What does it output for the code {b} (in binary, most significant bit on the $R_f$ input)?

::: misses
- [V*(floor(b/8) + floor(b/4 - 2*floor(b/8))/2 + floor(b/2 - 2*floor(b/4))/4 + (b - 2*floor(b/2))/8)] A summing amplifier inverts.
- [any] Add $-V\frac{R_f}{R_k}$ for each bit that's on.
:::
:::

::: part
answer: -V/8
unit: V
tolerance: 0.5%

### What's one step?

::: misses
- [any] The least significant bit, through $8R_f$.
:::
:::
:::

::: check
kind: derivation
vars: a = 1000..100000, c = 1000..100000, e = 1000..1000000, x = -10..10, y = -10..10

## A difference amplifier has $R_1$ = a and $R_2$ = c on both sides; a summing amplifier has $R_f$ = e with inputs x and y through a and c.

::: step
answer: c/a*(y - x)

### What's the difference amplifier's output for inputs x (inverting) and y?
:::

::: step
answer: -e*(x/a + y/c)

### What's the summing amplifier's output?
:::

::: right
Right. Both follow from the virtual ground and the currents into it.
:::
:::

::: explain
## Why don't the inputs of an inverting summing amplifier interfere with each other?

::: model
Every input resistor connects to the op amp's inverting input, which negative feedback holds at 0 V, a virtual ground. So each input's current is just its voltage divided by its own resistor, whatever the other inputs are doing: none of them sees the others' voltages. The op amp sends the total of those currents through the feedback resistor, producing an output proportional to their weighted sum.
:::
:::

::: practice

::: check
given: Rf = 10 | 20; R1 = 5 | 10; v1 = 0.5 | 1; R2 = 10 | 20; v2 = 0.2 | 0.4
answer: -Rf*(v1/R1 + v2/R2)
unit: V
tolerance: 0.5%

## Summer: $R_f$ = {Rf} kΩ; {v1} V through {R1} kΩ; {v2} V through {R2} kΩ. Output?

::: misses
- [Rf*(v1/R1 + v2/R2)] It's inverting.
- [any] $-R_f\sum v_k/R_k$.
:::
:::

::: check
given: G = 2 | 5 | 10; Rg = 1 | 4.7
answer: (G - 1)*Rg
unit: kΩ
tolerance: 0.5%

## Non-inverting gain {G} with $R_g$ = {Rg} kΩ. $R_f$?

::: misses
- [G*Rg] That gives a gain of G + 1.
- [any] $(G - 1)R_g$.
:::
:::

::: check
given: R1 = 1 | 10; R2 = 10 | 100; vd = 1 | 5
answer: R2/R1*vd
unit: mV
tolerance: 0.5%

## Difference amplifier, $R_2/R_1$ = {R2}/{R1}, input difference {vd} mV. Output?

::: misses
- [any] $(R_2/R_1)\Delta v$.
:::
:::
:::
