For an ideal gas the internal energy depends on temperature only. We can consider the process in question to be one of simultaneous free expansion. Then the total energy U = U1 + U2. Since
The entropy change is obtained by considering isochoric processes because in effect, the gas *** confined to its vessel.