Here current through the resistance R1 is
I1=εr+R1
and current through the resistance R2 is
I2=εr+R2.
Also, the heat produced due to passage of current through both the resistances is same.
Hence, Q=I21R1=I22R2
Using the values of I1 and I2 in above equation we get (εr+R1)2R1=(εr+R2)2R2
where, ε is the emf and r is the internal resistance of battery.
ε2R1(r+R1)2=ε2R1(r+R1)2
r2(R1−R2)=R1R2((R1−R2)
r2=R1R2
∴r=√R1R2