# Why doesn't an ideal gas undergoing an isobaric process violate the second law of thermodynamics

I have been stuck on this for the past few hours, and still have got no resolution:

Let's say that we have an isobaric process being done by $$1$$ mol of a gas. Accordingly, we'll be using gas laws and the first law of thermodynamics to analyze ​the situation.

So, by the ideal gas law:
$$PV=nRT$$

For sake of understanding, we take $$n = 1\space \mathrm {mol}$$:

$$\Rightarrow PV=RT \tag{1}$$

Now, using First Law of Thermodynamics,

$$\delta Q = \delta W + \mathrm d U$$ and $$\mathrm d U = C_v\, \mathrm d T$$, $$\space\space\delta W=P\, \mathrm dV$$

$$\Rightarrow \delta Q = P\, \mathrm d V + C_v\, \mathrm dT \tag{2}$$

Dividing $$(2)$$ by $$T$$, we get,

$$\frac{\delta Q}{T} = \frac{P\, \mathrm dV}{T} + \frac{C_v\, \mathrm d T}{T} \tag{3}$$

Using $$(1)$$ in $$(3)$$,

$$\frac{\delta Q}{T} = \frac{R\, \mathrm d V}{V} + \frac{C_v\, \mathrm dT}{T}$$

And $$\displaystyle \frac{\delta Q}{T} = \mathrm dS$$,

$$\Rightarrow \mathrm d S = \frac{R\, \mathrm dV}{V} + \frac{C_v\, \mathrm d T}{T} \tag{4}$$

Integrating $$(4)$$, we get,

$$\Delta S = R\,\ln\left(\frac{V_2}{V_1}\right)+C_v\,\left(\frac{T_2}{T_1}\right)$$

Now, if $$T$$ decreases in this process, then by the ideal gas law, $$V$$ should also decrease. If this follows, then the both the terms $$R\ln(\frac{V_2}{V_1})$$ and $$C_v(\frac{T_2}{T_1})$$ become negative as $$T_2 and $$V_2. So, the overall $$RHS$$ should become negative, and consequently, $$\Delta S$$ should become negative.

Please help to point out my mistake in the above mentioned text. Is $$\Delta S$$ coming negative because I have used an ideal gas?

• I haven't found mistakes in your derivation. It is true that for an isolated system, $\Delta S$ cannot be negative. But here the gas is not an isolated system, and $\Delta S$ can be negative. So I would say the second law of thermodynamics is not violated here. Aug 14 '21 at 10:09
• I've edited some equations and formatting; feel free to reverse something. Further, I think in your very last equation it should read $\displaystyle + \,C_v \, \ln\left(\ldots\right)$. Aug 14 '21 at 12:55
• I suggest editing the question to focus more on the conceptual issue of an ideal gas losing entropy in an isobaric process rather than focusing on your calculation. As of now, the question reads as a "check my work" question, which is off-topic on PSE. Aug 14 '21 at 13:03
• For a simpler example of a gas losing entropy, consider isothermal compression! If the gas is in contact with large heat reservoir and the compression is very slow the temperature difference between gas and reservoir can be made negligible, so the reservoir gains entropy equal to that lost by the gas. Aug 14 '21 at 14:03
• For another simple example, consider an air conditioner or a refrigerator. These are entropy reducing machines -- at least within the confines of the non-isolated system they are keeping cool. The second law of thermodynamics does not apply to non-isolated systems. You have a non-isolated system. An ideal gas does not maintain constant pressure and cool itself all by its lonesome. Aug 14 '21 at 21:59

By the Sakur-Tetrode equation, the entropy of a monatomic, ideal gas is given by

$$\frac{S}{k_BN}=\ln\left[\frac VN\left(\frac{4\pi m}{3h^2}\frac{U}{N}\right)^{3/2}\right]+\frac52$$

For our purposes, it will make sense to use the ideal gas law to express $$V$$ in terms of $$P$$ and $$T$$, and to express $$U=\frac32Nk_BT$$, so we get

$$\frac{S}{k_BN}=\ln\left[\frac {k_BT}{P}\left(\frac{2\pi m}{h^2}\cdot k_BT\right)^{3/2}\right]+\frac52$$

So, as we can see, for a constant pressure $$P$$, the entropy of the ideal gas is a monotonically decreasing function with respect to decreasing $$T$$; if we decrease $$T$$, we decrease $$S$$.

I suspect your confusion comes from thinking that $$S$$ can never decrease, but this is only the case for isolated systems. If you are forcing an ideal gas to undergo an isobaric compression, then the system is no longer isolated, and so the entropy can decrease (entropy will increase elsewhere though).

As a separate argument, the entropy is a state function, meaning its value only depends on the state, not how you got there. Now, let's consider your isobaric process, and let's say we do an isobaric expansion and then an isobaric compression back to the original state (this is the original state of the system, not the original state of the system as well as the surroundings, which is impossible to achieve). Since entropy is a state function, the entropy ends at where it started. But this means one of two things happened

1. The entropy remained constant the entire time
2. The entropy increased as well as decreased during this process.

If you showed that the change in entropy is non-zero for some part of this, then you have to conclude that it is possible to decrease the entropy of an ideal gas. Also, note that this argument is not dependent on use of an ideal gas specifically.

• Very well explained, thanks a lot! That clears up all my queries. Aug 15 '21 at 13:28

There is nothing wrong in your reasoning. The entropy of an ideal gas in a given state $$(P, V, T)$$ is indeed given by

$$S = nC_v \ln(T)+nR \ln (V)+S_0$$

(where $$S_0$$ is a constant we don't care about and this expression is meant to be used only then computing entropy differences so that the dimensions of the arguments of the logarithms work out) meaning that the entropy difference between any two states $$A$$ and $$B$$ is given by

$$\Delta S = nC_v \ln(T_B/T_A)+nR \ln (V_B/V_A)$$

which we can, using $$PV=nRT$$ easily rewrite as

$$\Delta S = nC_v \ln(P_B/P_A)+n C_p \ln (V_B/V_A)$$ (where we used $$T_B/T_A=P_B P_B/T_AV_A$$ and $$R+C_v=C_p$$).

So, in an isobaric process ($$P_A=P_B$$ so $$\ln(P_B/P_A)=0$$), this one is the expression we want to look at: $$\Delta S =n C_p \ln (V_B/V_A)$$

which clearly if $$V_B is negative.

More in general, from the expression of $$\Delta S$$ you can see that it can be negative in a variety of ways, for example also in an isothermal process if $$V_B (to be precise: it does not depend on the process but on the initial and starting points!)

Entropy differences can be negative if you are only looking at a subset of the system. What can not decrease is the entropy of the universe. But we are in this case only looking at the gas! If we get a negative entropy difference in the gas it means the rest of the world has increased its entropy.

Indeed, to go from $$A$$ to $$B$$ using an isothermal compression, you have given the system an amount of work $$p(V_A-V_B)$$ to decrease its entropy but this means that the system has released an amount of heat $$Q=n C_p (T_B-T_A)$$ "in the atmosphere", thus heating it up and producing an amount $$\Delta S$$ of entropy in the universe which (because we are dealing with a reversible process) perfectly balances the decrease in the gas, meaning $$\Delta S_{universe}=\Delta S_{gas}+\Delta S_{environment} = 0$$

If you want to compute this analytically, you need to find a transformation from $$A$$ to $$B$$ from which entropy is easy to compute (meaning it is either isothermal, with $$\delta S = \delta Q/T$$, or adiabatic, with $$\delta S =0$$) and you will see that the "emitted entroyp", i.e. the "emitted heat divided by the temperature" will perfectly balance the value we computed of $$\Delta S =n C_p \ln (V_B/V_A)$$

In the easiest case of an isothermal compression, the entropy difference is, using $$\Delta S = nC_v \ln(T_B/T_A)+nR \ln (V_B/V_A)$$ with $$T_B=T_A$$, given by

$$\Delta S_{gas} = nR \ln (V_B/V_A) <0$$

so it is negative also in this case! However, the "heat emitted (at temperature $$T$$)" is, using the formula for an isothermal process $$Q=-nRT\ln(V_B/V_A)<0$$ with the minus sign indicating it is heat released so that - as we are at constant temperature - the produced entropy in the environment is

$$\Delta S_{env} = Q/T = -nR\ln(V_B/V_A)$$

so that $$\Delta S_{env}+\Delta S_{gas}=0$$ as expected.