# Is average total energy of two objects is the sum of their individual average energies?

In the context of Boltzmann's distribution, Schroeder states that an average is defined as $$\bar{x}=\frac1Z\sum_sx(s)e^{-\beta E(s)}$$

Where $$\beta=1/kT$$ and E(s) is the energy corresponding to the state $${s}$$

Then he states:

One nice feature of average values is that they are additive; for example, the average total energy of two objects is the sum of their individual average energies.

Is this statement correct?

Consider two systems, $${E_1(s_1)}$$ and $${E_2(s_2)}$$

First off how are we even supposed to calculate the average of this combined system? The summation carries on $$s_1$$ and $$s_2$$ which might be different.

Their individual average energies, however, are straightforward

$$\bar{E_1}=\frac1{Z_1}\sum_{s_1}E(s_1)e^{-\beta_1 E(s_1)}\tag1$$ $$\bar{E_2}=\frac1{Z_2}\sum_{s_2}E(s_2)e^{-\beta_2 E(s_2)}\tag2$$

Assuming $$\beta_1=\beta_2=\beta$$ and that there is a meaningful way to correspond every $$s_1$$ with every $$s_2$$, which I'll simply call s for the whole system, the average energy of the whole system is then

$$\overline{E_1+E_2}=\frac1{Z_1Z_2}\sum_{s}(E_1(s)+E_2(s))e^{-\beta (E_1(s)+E_2(s))}$$

Since $$Z=Z_1Z_2$$

This is not the same as the sum of (1) and (2).

Where am I going wrong?

You choose the parameters of each system separately. By writing $$E_1(s) + E_2(s)$$, you're neglecting the states where the $$s$$'s aren't the same. That is, there is a state specified by $$(s_1,s_2)$$ whose energy is $$E_1(s_1) + E_2(s_2)$$. Once you've realized that, then you have a double sum $$\sum_{s_1}\sum_{s_2}$$, and from there it's straightforward to show that the result is the sum of the averages.
All of this assumes that the two systems are independent, which allows you to specify the states of each one separately and write the combined state as $$(s_1,s_2)$$.
In addition, $$\beta_1 = \beta_2$$ by assumption: they are assumed to be in thermal equilibrium so that the temperatures are the same. Otherwise, it's unclear that you can even define an average energy for the entire system.