Now let us calculate the performance of a Carnot cycle, using one mole of ideal gas as work substance and with only PV work.

We write the equation of the first law: $$dU=dq+dw=dq-pdV$$ For an ideal gas it is true that: $$dU=C_vdT\;\;y\;\ ;P=\frac{nRT}{V}$$ Substituting into the first law: $$C_vdT=dq-\frac{nRT}{V}dV$$ Dividing the entire equation by T $$\frac{C_v}{T}dT=\frac{dq}{T}-nR\frac{dV}{V}$$ Integrating over the Carnot cycle $$\oint C_v\frac{dT}{T}=\oint\frac{dq}{T}-nR\oint\frac{dV}{V}$$ The integrals $\oint C_v\frac{dT} {T}$ and $\oint\frac{dV}{V}$ are zero since the integrands are differentials of state functions and the integral over one cycle is zero.

Therefore, the equality becomes: $$\oint \frac{dq}{q}=0$$ valid expression for a Carnot cycle operating with an ideal gas. Writing the four terms of the integral (one for each stage of the Carnot cycle). $$\oint\frac{dq}{q}=\oint_{1}^{2}\frac{dq}{T}+\oint_{2}^{3}\frac{dq}{T }+\oint_{3}^{4}\frac{dq}{T}+\oint_{4}^{1}\frac{dq}{T}$$ The adiabatic stages ($2\rightarrow 3$ and $4\rightarrow 1$) have $dq=0$ and the integrals corresponding to these stages are zero. The isothermal stages work at temperatures $T_F$ and $T_c$, exchanging heat $q_F$ and $q_c$ with the environment, respectively.

Therefore: $$\oint\frac{dq}{q}=0=\frac{q_c}{T_c}+\frac{q_F}{T_F}$$ Solving for: $$\frac{q_F}{q_c}=\frac{T_c}{T_F}$$ Substituting into the expression calculated above for the performance in the Carnot cycle. $$e=1-\frac{q_F}{q_c}=1-\frac{T_F}{T_c}$$ This expression gives us the efficiency of a reversible heat engine operating between two temperatures $T_C$ (hot spot) $T_F$ (cold spot). As can be seen, the performance only depends on the temperature difference between the two sources and approaches 1 when $T_F$ is smaller and $T_C$ is larger.

A reversible machine does not exist in reality, all machines work with some irreversibility, therefore, the Carnot cycle represents a maximum performance limit that cannot be exceeded by any real machine.