Forces on the submerged block. With volume V and density ρ, in a liquid of density ρi the spring force balances the weight minus the upthrust:
kxi=Vρg−Vρig=Vg(ρ−ρi).
Write both experiments.
kx1=Vg(ρ−ρ1),kx2=Vg(ρ−ρ2).
Divide to remove k, V and g.
x2x1=ρ−ρ2ρ−ρ1.
Solve for ρ.
x1(ρ−ρ2)=x2(ρ−ρ1)⟹ρ(x1−x2)=ρ2x1−ρ1x2,
ρ=x1−x2ρ2x1−ρ1x2=x2−x1ρ1x2−ρ2x1.
(Sanity check: since ρ2<ρ1 the upthrust is smaller in the second liquid, so x2>x1 and the denominator is positive.)
(B)