Using ideal gas equation,
PV=nRT
⇒n=PVRT
Case I:- When the stopcock is closed.
Pressure enclosed in sphere =p
Temperature of sphere =T1
Volume =V
∴ total moles of gas (n)=pVRT1
Case II:- When the stopcock is opened.
Pressure within the apparatus, i.e., final pressure =p1
Temperature of first sphere =T1
Temperature of second sphere =T2
Volume of first sphere =V
Volume of second sphere =V2
∴ Moles of gas in first sphere (n1)=p1VRT1
∴ Moles of gas in second sphere (n2)=p1V2RT2=p1V2RT2
Now,
Total moles of gas = moles of gas in first sphere + moles of gas in second sphere
n=n1+n2
pVRT1=p1VRT1+p1V2RT2
⇒p1=2pT22T2+T1