# Deriving total temperature of a composite system

Followup from this question,

It seems like the total temperature of the composite system $$T=T_A+T_B$$ can be found using this relation:

$$\frac{1}{T}=\frac{\partial S}{\partial U}$$

where $$S=S_A+S_B$$ is total entropy and $$U=U_A+U_B$$ is total energy. In particular, I want to show that

$$\frac{1}{T}=\frac{1}{T_A+T_B}$$

I started out by applying chain rule to $$\frac{\partial S}{\partial U}$$:

$$\frac{1}{T}=\frac{\partial S}{\partial U_A}\frac{\partial U_A}{\partial U} + \frac{\partial S}{\partial U_B} \frac{\partial U_B}{\partial U}$$

Then I expand $$S$$ and $$U$$:

$$\frac{1}{T}=\frac{\partial}{\partial U_A}(S_A+S_B)\frac{\partial}{\partial U} (U-U_B) + \frac{\partial}{\partial U_B} (S_A+S_B) \frac{\partial U_B}{\partial U}$$

$$\frac{1}{T}=\frac{\partial}{\partial U_A}(S_A+S_B)\frac{\partial}{\partial U} (U-U_B) + \frac{\partial}{\partial U_B} (S_A+S_B) \frac{\partial U_B}{\partial U}$$

Since $$\frac{1}{T_A}=\frac{\partial S_A}{\partial U_A}$$ and $$\frac{1}{T_B}=\frac{\partial S_B}{\partial U_B}$$,

$$\frac{1}{T}=(\frac{1}{T_A}+\frac{\partial S_B}{\partial U_A}) (1-\frac{\partial U_B}{\partial U}) + (\frac{\partial S_A}{\partial U_B}+\frac{1}{T_B}) \frac{\partial U_B}{\partial U}$$

I am not sure what to do next.

• You don't add temperatures. The composite system doesn't have a temperature until the two subsystems are in thermal equilibrium with each other; then they both have the same temperature. It doesn't make sense to add temperatures of two systems. If you brought an ice cube ($T=273$ K) into contact with boiling water ($T=373$ K), is the temperature of the composite system the sum of the temperatures, i.e. 646 K? Nope! Commented Feb 28, 2023 at 9:19
• @march I see, how about when the objects are in thermal equilibrium? Is it possible to show that $1/T=1/(2T_A)=1/(2T_B)$? At equilibrium, $\frac{\partial S}{\partial S_{B}} = - \frac{\partial S}{\partial S_{A}} = 0$, so I got $1/T=0$ instead. Commented Feb 28, 2023 at 9:33

Assuming your system is isolated you want to maximize $$S$$ with fixed $$U$$ according to the second law. More concretely, you want to maximize $$S=S_A+S_B$$ by only varying $$U_A,U_B$$ under the constraint $$U_A+U_B=U$$.
Adding some mathematical assumptions, you just apply the method of Lagrange multipliers. You can thus get rid of the constraint by minimizing instead: $$S-\beta (U_1+U_2)$$ with $$\beta$$ the Lagrange multiplier. Looking for stationary points gives you: $$\frac{\partial S_A}{\partial U_A}=\frac{\partial S_B}{\partial U_B}=\beta$$ And you identify the first two members as $$\frac{\partial S_A}{\partial U_A}=\frac{1}{T_A} \\ \frac{\partial S_B}{\partial U_B}=\frac{1}{T_B}$$ respectively and the Lagrange multiplier as $$1/T$$, the inverse temperature of the whole system.
Actually, the Lagrange function is related to free energy. To summarize you have a system of equations: $$T_A=T_B \\ U_A+U_B=U$$ for two unknowns $$U_A,U_B$$, so (up to mathematical subtleties) you have all the information needed to calculate the equilibrium state. They simply translate thermal equilibrium as the homogeneity of temperature. Unless you specify the $$S_A,S_B$$ dependences on energy, you cannot go further in general. Note that you do not add the temperatures, you need to equate them.