Working principle: Potential difference across length of potentiometer wire is proportional to the length of the wire.
E=kL where, E is the emf and k is the potential gradient.
In the figure:
Cell emf, e whose internal resistance r is to be determined is connected via resistance box R.B. through key K2.
This key when open, balance is obtained at l1(AN1) .
So, e=kl1
If v is terminal potential difference, balance is obtained at length l2(AN2).
So, v=kl2
Now, e=I(R+r)
where, I is the current and v=IR
Dividing the equations.