# How can we say that entropy is constant if and only if all processes are reversible?

The second law of thermodynamics states that the total entropy of an isolated system can never decrease over time, and is constant if and only if all processes are reversible.

For an isolated system, for both reversible and irreversible process dQ = 0. So according to the equation of entropy isn't dS always zero for an isolated system?

In summary, is there any term in the equation of entropy representing the reversibility and irreversibility of a thermodynamic process?

The equation $$dS = \frac{dQ_\mathrm{rev}}{T}$$ describes the change in entropy only for a reversible process. If the process is not reversible, then $$dQ = 0$$ does not imply $$dS = 0$$.

For an isolated system, for both reversible and irreversible process dQ = 0. So according to the equation of entropy isn't dS always zero for an isolated system?

No.

Although a differential change in entropy is defined for a reversible transfer of heat, or

$$dS=\frac{\delta Q_{rev}}{T}$$

entropy can be generated without heat transfer. Any irreversible process can generate (increase) entropy.

The classic example given is an ideal gas located in one side of a rigid insulated vessel with a vacuum in the other side separated by a rigid partition. Since the vessel is both rigid and insulated, the gas is an isolated system. There is no work or heat transfer between the gas and the surroundings.

An opening is created in the partition allowing the gas to expand into the evacuated half of the vessel. $$W=0$$, $$Q=0$$, $$\Delta T=0$$ (for an ideal gas) and therefore $$\Delta U=0$$. Although no heat transfer has occurred, the process is obviously irreversible (you would not expect the gas to be able to spontaneously return to its original location) and entropy increases.

You can calculate the entropy increase by assuming any convenient reversible process that can bring the system back to its original state (original entropy) and apply the above definition for entropy. We can do this because entropy is a state function that does not depend on the path.

The obvious choice is to remove the insulation and insert a movable piston. Then conduct a reversible isothermal compression until the gas is returned to its original volume leaving a vacuum in the other half. All properties are then returned to their original state. The change in entropy for the isothermal compression is then, where $$Q$$ is the heat transferred to the surroundings by the isothermal compression,

$$\Delta S=-\frac{Q}{T}$$

Since the system is returned to its original state, the overall change in entropy is zero, meaning the original change in entropy due to the irreversible expansion had to be

$$\Delta S=+\frac{Q}{T}$$

Hope this helps.

The complete formulation would be that for any closed system:

$$dS = \delta S_{r} + \delta S_{p} = \frac{\delta Q_{r}}{T} + \delta S_{p}$$

where $$\delta S_{r}$$ and $$\delta Q_{r}$$ are respectively the entropy and heat received by the system from the environment, $$T$$ is the temperature of the element of the system that receives $$\delta Q_r$$, $$\delta S_{p}$$ is the entropy produced in the system during the process, with $$\delta S_{p}\ge 0$$ and $$\delta S_p = 0$$ if the process is reversible.