This method is Kelvin's method of determining resistance of galvanometer by Wheatstone bridge circuit. Deflection in galvanometer G is same with switch S open or closed. It means that there is no current through S. This happens when the potentials at the two ends of S are
same.
This is the condition of balanced Wheatstone bridge. ∴IP=IQ and IR=IG.