# Electronics

## Opamp tutorial

### The inverting amplifier

In part 1 we saw how to make a unity gain amplifier. Now we're going to do some actual amplification, starting with the inverting amplifier.

Again we can explain its operation starting from the transfer function of the ideal opamp: $$ \bbox[10px,border:2px solid #96BFCB]{ \large{ V_{OUT} = G \cdot (V_+ - V_-) }} $$ $V_+$ is 0 V, but for $V_-$ we'll have to resort to Ohm's Law and KCL (Kirchhoff's Current Law). Since the input current of the opamp is zero, the current through R1 is the same as that through R2. We get $$ I = \dfrac{V_- - V_{IN}}{R1} = \dfrac{V_{OUT} - V_-}{R2} $$ which we can write as a function of $V_-$ as $$ \begin{array} {rcl} \left(\dfrac{1}{R1} + \dfrac{1}{R2}\right) V_- & = & \dfrac{1}{R1} V_{IN} + \dfrac{1}{R2} V_{OUT} \\ \dfrac{R1 + R2}{R1 \cdot R2} V_- & = & \dfrac{1}{R1} V_{IN} + \dfrac{1}{R2} V_{OUT} \\ V_- & = & \dfrac{R1 \cdot R2}{R1 + R2} \left(\dfrac{1}{R1} V_{IN} + \dfrac{1}{R2} V_{OUT}\right) \\ V_- & = & \dfrac{R2}{R1 + R2} V_{IN} + \dfrac{R1}{R1 + R2} V_{OUT} \end{array} $$ Filling this value in in the open loop amplifier's transfer function gives us $$ V_{OUT} = G \cdot \left( 0 - \left(\dfrac{R2}{R1 + R2} V_{IN} + \dfrac{R1}{R1 + R2} V_{OUT} \right) \right) $$ So that $$ \left(1 + G \dfrac{R1}{R1 + R2} \right) V_{OUT} = - G \dfrac{R2}{R1 + R2} V_{IN} $$ Again, since $G \gg 1$ we can ignore the $1$, so that we get $$ G \dfrac{R1}{R1 + R2} V_{OUT} = - G \dfrac{R2}{R1 + R2} V_{IN} $$ where the $G$ and the denominators cancel out: $$ R1 \cdot V_{OUT} = - R2 \cdot V_{IN} $$ or $$ \bbox[10px,border:2px solid #96BFCB]{ \large{ V_{OUT} = - \dfrac{R2}{R1} V_{IN} }} $$ So the closed loop gain is determined by the ratio between R2 and R1, and it's inverting. Again notice that the actual open loop gain $G$ cancels out, so it doesn't really matter whether that's 100 000 or 1 000 000.

**Important notice**

Here and there on the Internet you'll find much shorter and seamingly easier ways to get to this result. These always rely on the fact that for the inverting amplifier $V_- = V_+$. But that's a *result* of the above calculation; you can't use that as a premise for the calculation. You can't prove something by assuming it in the first place. It's a common fallacy in mathematical proofs. The above derivation is the only correct one.