Tutorial 7 C  The Difference Amplifier
Learning Objectives
draw and recognise the single opamp difference amplifier circuit and describe its applications;
use the formula Vout = (V_{2} – V_{1}) R_{f}
R_{1}
recall that the input resistance of each input is different and comparatively low;
The difference amplifier amplifies the difference between the voltage applied to the inverting input and the noninverting input as shown in the circuit.
We will derive the equation for the output voltage. It is long and tedious, so if you want to skip this, click here.
Derivation (Extension only)
Let us apply a voltage of V_{1} volts to the inverting input () of the amplifier, and zero volts to the noninverting input (+). We know that the potential at the inverting input is almost zero (virtual earth). We also know that the input resistance of the inverting input is very high indeed, so we can assume that no current goes into the input. So the current flows like this.
From Ohm's Law:
I = V_{1}/R_{1}
Since this is a series circuit, the current through R_{f} is also I, so we can work out the voltage across R_{f}. Since the current passes the virtual earth, it is now going up the potential hill, so the voltage across R_{f} is negative.
V_{f} = IR_{f} = R_{f}(V_{1}/R_{1})
The voltage V_{f} is the same as the voltage V_{out}, so we can write:
V_{out} = V_{1}R_{f}/R_{1}
Now we can rewrite this in terms of the gain:
Gain = V_{out} /V_{1} = R_{f}/R_{1}
Now let's apply a voltage of V2 volts to the noninverting input (+) and zero volts to the inverting input. The current flows like this.
Now the noninverting input will NOT be at zero volts. Instead we have a voltage divider which will give us the voltage, V_{3}, at the noninverting input.
The voltage difference between the noninverting input and the inverting input is very little, so we can say that the voltage at the inverting input is V_{3}.
Since the voltage across R1 is going up the potential hill to the inverting input, we can say that the voltage across the R_{1} resistor is V_{3}. So V_{1} = V_{3}.
We know for the noninverting the Vout expression was:
V_{out} = V_{1}R_{f}/R_{1}
The noninverting input can be considered to be a source of potential difference. Normally this is 0, so we can write:
V_{out} = 0 + V_{1}R_{f}/R_{1}
In this case, we have a definite value for potential difference, V_{3}. Also we know that V_{1} = V_{3}. This gives us:
V_{out} = V_{3} + V_{3}R_{f}/R_{1}
Now we can write an expression for V_{out}.
We also know that:
This gives us:
This rearranges to:
Now suppose we put a voltage across both inputs. The currents do this.
We can combine the two equations to give us:
The above equation looks pretty horrible, but we can simplify it by making R_{1} and R_{2} the same, and R_{f} and R_{3} the same. The equation you need to use is:
A Difference amplifier has input V_{1} set at 2 V and input V_{2} set at 4 V. The two input resistances are both 50 ohms and the R_{f} and R_{3} are 100 ohms.
Show that the output voltage is 4 V. 
In many difference amplifiers, all the resistors have the same value.
Write an expression for V_{out} if R_{1} = R_{2} = R_{3} = R_{f}. 
The difference amplifier has the disadvantage that the input resistance is quite low, and may differ between inputs. Differences in resistance are eliminated if R_{1} and R_{2} the same, and R_{f} and R_{3} the same. This is the way that the amplifier is normally set up.
The difference amplifier is used to amplify very small differences between two voltages, for example the voltages given off by probes investigating nerve activity in an athlete when he is doing exercise. With the athlete on a cycling machine or treadmill, probes are attached to the arms and the legs. The voltage differences (of about 10^{2} V) are amplified and fed to a computer that can monitor a number of physiological parameters as he exercises.
Photo: Steven Fruitsmaak, Wikimedia Commons
If there are spurious voltages that are affecting both probes due to, for example, mains hum, the difference amplifier blocks these off. This is because each spurious voltage has the same value, and the difference is zero. We say that the spurious signals have been rejected, and electronic engineers call this property the Common Mode Rejection Ratio (CMRR)
If the values of the input resistances are different, the spurious signals will be amplified.
Links 

Difference opamp circuit 

Hyperphysics tutorial 

Video tutorial 