When the two way key is switched off, then
The current flowing in the resistors
R and
X is
I=1A...(i)
When the key between the terminals 1 and 2 is plugged in, then
Potential difference across
R=IR=kℓ1...(ii)
where
k is the potential gradient across the potentiometer wire
When the key between the terminals 1 and 3 is plugged in, then
Potential difference across
(R+X)=I(R+X)=kℓ2 .....(iii)
From equation (ii), we get
R===kℓ1Ω From equation (iii), we get
R+X===kℓ1 Using (i)
X=kℓ2−R =kℓ2−kℓ1 =k(ℓ2−ℓ1)Ω