A differential amplifier is an op amp circuit which is designed to amplify the difference input available and reject the common-mode voltage. It is used for suppressing the effect of noise at the output. Since the noise present will be having the same amplitude at the two terminals of the op-amp. So when the difference between terminals is taken, the noise will cancel each other. The differential amplifier output is proportional to the difference of the input terminals. Hence the output is free from noise.
Differential amplifier
Figure 1 shows the basic differential amplifier. The two input signal V1 and V2 are applied to the op amp.

Working
Apply superposition theorem to find out the output voltage. First of all, deactivate V2 and connect it to ground as shown in figure 2.

Applying voltage division method
(1)
Since the op-amp is ideal and negative feedback is present, the voltage of the inverting terminal (V−) is equal to the voltage of the non-inverting terminal (V+), according to the virtual short concept.
V− = V+
The currents entering both terminals of the op-amp are zero since the op-amp is ideal.
(2)
(3)
Apply KCL at node P
(4)
From equations (2), (3) and (4), we have
From equation 1, we have
(5)
Now deactivate V1 and connect it to ground as shown in figure 3.

As we can see that the voltage across R4 is zero. Therefore V+ = 0 V. Since the op-amp is ideal and negative feedback is present, the voltage of the inverting terminal (V−) is equal to the voltage of the non-inverting terminal (V+ = 0), according to the virtual ground concept.
V− = V+ = 0 Volt
The currents entering both terminals of the op-amp are zero since the op-amp is ideal.
(6)
(7)
Apply KCL at node P
(8)
From equations (6), (7) and (8), we have
(9)
Adding equations (5) and (9), we get the output voltage Vo
(10)
(11)
Case-1: when
then
The output Vo is
Now
and
The output Vo is given by
where Ad = differential gain and Ac = common mode gain
As
Therefore, we have

so
Common mode rejection ratio (CMRR)
using above value of Ad and Ac, we have
Note: Ideally CMRR is infinite. So CMRR value for this circuit to be infinite,
Case2: when
since
and
then we can write it as
and
Therefore equation (10) becomes
(12)
(13)
Comparing equation (12) and (13), we have
and
Then CMRR is given as
Note:
Note: For a better differential amplifier, CMRR should be as high as possible.
Note: CMRR depends upon the circuit and not depend upon the applied input.