In order to find out the common pressure and temperature attained after the connection, first we have to find out what is the amount of gas present in vessel one and two the formula to be used is


The amount if the gas in vessel 1 is
n1 = p1V1/RT1 and that in vessel 2 is n2 = P2V2/RT2
If p’ and T’ be the common pressure and temperature after the connection is made, the amounts are

As the vessels have fixed volume, no work is done by the gas plus the vessels system. Also no heat is exchanged with the surrounding. Thus, the internal energy if the total system remains constant.
The internal energy of an ideal gas is

The internal energy of the gases before the connection

And after the connection

Neglecting the change in internal energy of the vessels (the heat capacity of the vessels is assumed negligible),
