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?