# What temperature should be taken into consideration when calculating the entropy change?

## Introduction

In this question I want to know when calculating the entropy change where we take the temperature of the system or the reservoir's and if my thought process is sound.

## Clausius Theorem

The state function of Entropy is defined by the Clausius's Theorem which in short is stated by the equation: $$\int\limits_{\text{cycle}} \frac{\mathrm{d}Q}{T}\leq 0 \,.$$

And the equality stands only when the heat is transferred reversibly around the cycle.

## Comments on the variable in the inequality

From the process of proving the theorem I understood that the temperature $T$ is the temperature of the reservoir between the Carnot Engine and the system that we study.

## Entropy

Entropy is defined as $$\mathrm{d}S= \frac{\mathrm{d}Q_{\text{rev}}}{T} \,,$$ so as to be an exact differential and therefore a state function.

As I came to understand the only way to transfer energy through heat reversibly is for the temperatures of the two bodies in thermal contact to be the same. So the temperature $T$ in the above equation which is the temperature of the reservoir (or whatever) is to be the same as the system's one. Therefore the temperature $T$ in the equation is the temperature of the system. RIGHT?
This answer is response to the question you asked in one of your comments. Suppose you have an ideal constant temperature infinite reservoir at temperature $T_R$ and a system (which does no work) of mass M, heat capacity C, and initial temperature $T_S$. You place the system in contact with the infinite reservoir and allow them to equilibrate spontaneously. The question is, what is the entropy change of the system, the reservoir, and the universe?
In the final thermodynamic equilibrium state, the temperature of the system will have changed from $T_S$ to $T_R$. The amount of heat transferred from the reservoir to the system will be $Q=MC(T_R-T_S)$. The entropy change of the reservoir will be $$\Delta S_R=-\frac{MC(T_R-T_S)}{T_R}$$The change in entropy of the system will be $$\Delta S_S=MC\ln{(T_R/T_S)}$$ The entropy change for the universe (system plus surroundings) will be: $$\Delta S_U=MC\left[\ln{(T_R/T_S)}-\frac{(T_R-T_S)}{T_R}\right]$$This is greater than zero for all unequal values of $T_R$ and $T_S$.