We will choose the two metal blocks as the system for writing the balance equations. There is no exchange of mass between the blocks, so the mass balance does not provide any useful information. The energy balance for the system is
M \hat{U}_{1, f}+M \hat{U}_{2, f}-M \hat{U}_{1, i}-M \hat{U}_{2, i}=0
or
M \hat{C}_{\mathrm{V}}\left(T_{1, f}-T_{1, \text { ref }}\right)+M \hat{C}_{\mathrm{V}}\left(T_{2, f}-T_{2, \text { ref }}\right)-M \hat{C}_{\mathrm{V}}\left(T_{1, i}-T_{1, \text { ref }}\right)-M \hat{C}_{\mathrm{V}}\left(T_{2, i}-T_{2, \text { ref }}\right)=0
which reduces to
T_{1, f}-T_{1, i}+T_{2, f}-T_{2, i}=0 (a)
The entropy balance cannot be used directly to provide useful information since the entropy generation due to heat transfer cannot be evaluated at this stage in the calculation. However, we can use the fact that for a system in which M, U, and V are constant, at equilibrium the entropy is a maximum with respect to the independent variations within the system. The final entropy of the system is
S=M \hat{S}_{1, f}+M \hat{S}_{2, f}=M \hat{C}_{\mathrm{V}} \ln \left(\frac{T_{1, f}}{T_{1, \text { ref }}}\right)+M \hat{C}_{\mathrm{V}} \ln \left(\frac{T_{2, f}}{T_{2, \text { ref }}}\right)
The only possible variations are in the two final temperatures, T_{1, f} and T_{2, f}. However, as the energy balance connects these two temperatures, only one of them can be considered to be independent, say T_{1, f}. Therefore, to identify the equilibrium state we set the differential of the entropy with respect to T_{1, f} equal to zero:
\begin{gathered}\frac{d S}{d T_{1, f}}=0=\frac{d}{d T_{1, f}}\left[M \hat{C}_{\mathrm{V}} \ln \left(\frac{T_{1, f}}{T_{1, \text { ref }}}\right)+M \hat{C}_{\mathrm{V}} \ln \left(\frac{T_{2, f}}{T_{2, \text { ref }}}\right)\right] \\\\=\frac{M \hat{C}_{\mathrm{V}}}{T_{1, f}}+\frac{M \hat{C}_{\mathrm{V}}}{T_{1, f}} \frac{d T_{2, f}}{d T_{1, f}} \end{gathered}
or
\frac{d T_{2, f}}{d T_{1, f}}=-\frac{T_{2, f}}{T_{1, f}} (b)
Now taking the derivative of the energy balance with respect to T_{1, f}, we obtain
\frac{d}{d T_{1, f}}\left[M \hat{C}_{\mathrm{V}}\left(T_{1, f}-T_{1, i}\right)+M \hat{C}_{\mathrm{V}}\left(T_{2, f}-T_{2, i}\right)\right]=0=M \hat{C}_{\mathrm{V}}+M \hat{C}_{\mathrm{V}} \frac{d T_{2, f}}{d T_{1, f}}
or
\frac{d T_{2, f}}{d T_{1, f}}=-1 (c)
Comparing Eqs. b and c, we have
\frac{d T_{2, f}}{d T_{1, f}}=-1=-\frac{T_{1, f}}{T_{2, f}}
Clearly, the only way this combined equation can be satisfied is if T_{1, f}=T_{2, f}=T_{f}; that is, the final temperature of the two blocks must be equal, which is the intuitively obvious solution.
To calculate this final equilibrium temperature, we use the energy balance, Eq. a,
T_{f}-T_{1, i}+T_{f}-T_{2, i}=2 T_{f}-T_{1, i}-T_{2, i}=0
which has the solution
T_{f}=\frac{T_{1, i}+T_{2, i}}{2}
Knowing the final state of the system, it is of interest to calculate the amount of entropy generated in the process of achieving equilibrium. We do this using the difference form of the entropy balance,
S_{f}-S_{i}=S_{\text {gen }}
S_{\text {gen }}=S_{f}-S_{i}
=M \hat{C}_{\mathrm{V}}\left[\ln \left(\frac{T_{f}}{T_{1, \text { ref }}}\right)+\ln \left(\frac{T_{f}}{T_{2, \text { ref }}}\right)\right]-M \hat{C}_{\mathrm{V}}\left[\ln \left(\frac{T_{1, i}}{T_{1, \text { ref }}}\right)+\ln \left(\frac{T_{2, \mathrm{i}}}{T_{2, \text { ref }}}\right)\right]
=M \hat{C}_{\mathrm{V}} \ln \left[\frac{T_{1, i}+T_{2, i}}{2 T_{1, i}}\right]+M \hat{C}_{\mathrm{V}} \ln \left[\frac{T_{1, i}+T_{2, i}}{2 T_{2, i}}\right]=M \hat{C}_{\mathrm{V}} \ln \left[\frac{\left(T_{1, i}+T_{2, i}\right)^{2}}{4 T_{1, i} T_{2, i}}\right]