How to derive the differential amplifier equation?

Just playing with circuit theory and tried to derive the equation for the differential amplifier:

$$V_{out} = \frac{R_f}{R_1}(V_2 - V_1) \\ R_f/R_1 = R_g/R_2$$

I've seen the solutions based on superposition and based on virtual ground, but I wanted to derive using the ideal op amp equation:

$$V_{out} = A(V_+ - V_-) \\ V_+ = \frac{R_g}{R_2+R_g}V_2 \\ V_- = \frac{R_1}{R_1+R_f}(V_{out} - V_1) \\$$

So I went:

$$\frac{V_{out}}{A} = \frac{R_g}{R_2+R_g}V_2 - \frac{R_1}{R_1+R_f}(V_{out} - V_1) \\ \frac{V_{out}}{A} + \frac{R_1}{R_1+R_f}V_{out}= \frac{R_g}{R_2+R_g}V_2 + \frac{R_1}{R_1+R_f}V_1$$

Here, A goes to infinity:

$$\frac{R_1}{R_1+R_f}V_{out}= \frac{R_g}{R_2+R_g}V_2 + \frac{R_1}{R_1+R_f}V_1 \\ V_{out}= \frac{R_1+R_f}{R_1}\frac{R_g}{R_2+R_g}V_2 + V_1$$

and it's now obvious I've gone wrong somewhere because the equation doesn't look like the expected answer above. There should be a subtraction between V2 and V1, but I have addition instead.

I've tried this style of derivation on a number of op-amp configurations and it seems to work. This derivation of this differential amp should be possible using just the op-amp's equations. Where did I go wrong?

• Correct me if I'm wrong, but I think your equation for V- might be incorrect. Using the voltage divider equation is one approach, but you need to be careful where "ground" is referenced in this case because Vout is not = 0V, so the middle of the divider is not referenced to 0V in this case. -- Try re-writing it starting with V- = V1 - (I * R1) where I is the current through R1 and RF. Dec 14, 2020 at 23:50
• @MattEgan you hit submit before I did. If you want to answer, I will delete mine. Dec 14, 2020 at 23:57
• Yeah, that's it. Sorry guys, I had forgotten the voltage divider is always w.r.t. ground. I thought it was just w.r.t. the voltage difference.
– Roxy
Dec 15, 2020 at 0:03
• No worries @MathKeepsMeBusy! I didn't have time to write a full answer so was just leaving a comment :) Dec 15, 2020 at 17:40

I think your equation for $$\V_-\$$ is incorrect. If $$\V_{out}=V_1\$$ then $$\V_-\$$ should equal $$\V_{out}\$$. However, the equation you have gives 0.

• Yep, should've been $V_- = \frac{R_1}{R_1+R_f}(V_{out} - V_1) + V_1$. Thanks!
– Roxy
Dec 15, 2020 at 0:18

The equations for voltages at the inverting and non-inverting terminals can be derived using nodal analysis and voltage divider rule respectively.

Suppose that there are $$\n\$$ voltage sources passing through $$\n\$$ resistors and meeting up in one point ($$\x\$$).

simulate this circuit – Schematic created using CircuitLab

The voltage in that point, $$\V_x\$$ can be expressed as:

$$V_x = \dfrac{1}{\sum_\limits{i=1}^{n} \dfrac{1}{R_i}} \cdot \left[ \sum_\limits{i=1}^{n} \dfrac{V_i}{R_i} \right]$$

Therefore, the voltage on the inverting input pin is:

$$V_- = \dfrac{R_1 R_f}{R_1 + R_f} \left[ \dfrac{V_1}{R_1} + \dfrac{V_o}{R_f} \right] = \dfrac{R_f V_1 + R_1 V_o}{R_f + R_1}$$

I am copy pasting $$\V_+\$$ from your message:

$$V_+ = \frac{R_g}{R_2+R_g}V_2$$

Put these two expression for $$\V_-\$$ and $$\V_+\$$ into $$\V_o = A \left( V_+ - V_- \right)\$$ to find:

$$\dfrac{R_f + R_1}{A R_1} V_o + V_o = \dfrac{R_g}{R_1} \dfrac{R_f + R_1}{R_2 + R_g} V_2 - \dfrac{R_f}{R_1} V_1$$