Given that two soap bubbles coalesce to constitute a bubble of radius $z$. Now from the ideal gas law, we get
$p V=p_{1} V_{1}+p_{2} V_{2}$
Hence, we have
$n R T=n_{1} R T+n_{2} R T$
So, $n=n_{1}+n_{2}$
Thus, we have
$p_{1}=p_{0}+\frac{4 T}{x}$,
$p_{2}=p_{0}+\frac{4 T}{y}$,
$p=p_{0}+\frac{4 T}{z}$
Assuming that the process is taking place in vacuum, we have
Hence, $p_{1}=\frac{4 T}{x}, p_{2}=\frac{4 T}{y}, p=\frac{4 T}{z}$
$p V=p_{1} V_{1}+p_{2} V_{2}$
or $\frac{4 T}{z}\left(\frac{4}{3} \pi z^{3}\right)=\frac{4 T}{x}\left(\frac{4}{3} \pi x^{3}\right)+\frac{4 T}{y}\left(\frac{4}{3} \pi y^{3}\right)$
Hence $z^{2}=x^{2}+y^{2} $
$\Rightarrow z=\sqrt{x^{2}+y^{2}}$