\documentclass[english, a4paper, 12pt, reqno]{amsbook}% ams book
\usepackage[english]{babel}% handles English typography specifics.
\usepackage[T1]{fontenc}% T1 character encoding, new LaTeX standard. $A$voids [OT1] error but switches to $B$itmap
\usepackage{xspace}% manages spaces after quotes, after dots, and 1st
\usepackage{lmodern}% Latin Modern font. Switches back from $B$itmap to vector
\usepackage{microtype}% improves justification and character spacing
\usepackage[left=1.8cm,right=2.2cm,top=2.5cm,bottom=2.5cm]{geometry}% page margins
\usepackage[super]{nth}% first, second, third

\usepackage{amssymb}% mathematical symbols
\usepackage{siunitx}% replaces siunit
\sisetup{
locale = US,
output-decimal-marker={.},% period as decimal separator
group-minimum-digits = 3,% number of digits between each separation
group-separator={,},% thousands separator
quantity-product={~},% separator between a number and its unit
inter-unit-product={~}% non-breaking space between two units
}
\usepackage{enumitem}% bullet lists
\usepackage{auto-pst-pdf}% avoids undefined control sequence error
\usepackage{pst-3dplot}% draw in 3D
\usepackage{float}% begin figure[H] (does not work with subfigure, keep [h!])
\usepackage{caption}% figure captions
\captionsetup{figurename=Fig.}
\usepackage{empheq}% boxes important formulas
\usepackage[most]{tcolorbox}% frame text, includes xcolor. Define colors red green blue between 0 and 1.
%white, black, red, green, blue, yellow, cyan, magenta, gray, orange, purple, brown, pink, lime, navy, teal, olive
\definecolor{oliveYellow}{rgb}{0.7, 0.7, 0.3}
\definecolor{brown}{rgb}{.7,.7,.3}
\definecolor{lightBrown}{rgb}{.997,.997,.97}
\definecolor{goldColor}{rgb}{1.0, 0.843, 0.0} % Color close to gold
\newcommand*\mybox[1]{\fcolorbox{oliveYellow}{white}{\hspace{1em}#1\hspace{1em}}}
\newcommand*\myboxdef[1]{{\hspace{1em}#1\hspace{1em}}}
\newcommand*\myboxtheo[1]{{\hspace{1em}#1\hspace{1em}}}

\theoremstyle{plain}% predefined style (bold title, italic body)
\newtheorem{theorem}{Theorem}[section]

% Definition
\newtcbtheorem[auto counter, number within=section]{defi}{Definition}{lower separated=false, enhanced, breakable, attach boxed title to top left={xshift=0.5cm,yshift=-2mm}, coltitle=black, colbacktitle=white, boxed title style={colframe=white}, colback=white, colframe=goldColor, fonttitle=\bfseries}{def}

% Remark
\newtcbtheorem[auto counter, number within=section]{rmq}{Remark}{lower separated=false, enhanced, breakable, sharp corners, boxrule=0.4pt, attach boxed title to top left={xshift=0.5cm,yshift=-2mm}, coltitle=black, colbacktitle=white, boxed title style={colframe=white}, colback=white, colframe=oliveYellow, fonttitle=\scriptsize, fontupper=\scriptsize}{rmq}

% Theorem
%\newtcbtheorem[auto counter, number within=subsection]{theo}{Theorem}{lower separated=false, enhanced, breakable, attach boxed title to top left={xshift=0.5cm,yshift=-2mm}, coltitle=black, colbacktitle=white, boxed title style={colframe=white}, drop shadow, colback=white, colframe=black, fonttitle=\bfseries, fontupper=\itshape}{th}
\newtcolorbox{thbox}{enhanced jigsaw,drop shadow,colframe=black,colback=white,boxrule=0.4pt,before skip=15pt,after skip=15pt}
\newenvironment{theo}{\begin{thbox}\begin{theorem}}{\end{theorem}\end{thbox}}

% Axiom
\newtcbtheorem[auto counter, number within=section]{axio}{Axiom}{lower separated=false, enhanced, breakable, attach boxed title to top left={xshift=0.5cm,yshift=-2mm}, coltitle=black, colbacktitle=white, boxed title style={colframe=white}, drop shadow, colback=white, colframe=black, fonttitle=\bfseries, fontupper=\itshape}{ax}

\usepackage{fancyhdr}% fancy header
\fancyhf{}% clear head and foot
\pagestyle{fancy}
\fancyfoot[c]{\thepage}% page number position
\renewcommand{\headrulewidth}{0pt}% thickness of the horizontal line at the top of pages
\setlength{\headheight}{16pt}% header height, normal=8pt
\setlength{\headsep}{28pt}% distance between header and body text, normal=14pt
\setlength{\footskip}{28pt}% footer number position
\renewcommand{\chaptermark}[1]{\markboth{Chapter \thechapter\ : #1}{}}% redefine chaptermark
\fancyhead[l]{\color{oliveYellow}\slshape{\leftmark}}% title in header on left
\usepackage{hyperref}% configure opening in PDF readers
\hypersetup{
pdftoolbar=false,% display $A$crobat toolbar
pdfmenubar=false,% display $A$crobat menu
pdftitle={Thermodynamics},% title
pdfauthor={Olivier Castéra},% author
pdfstartview= FitH,% page fits full width
colorlinks=true,% false: boxed links; true: colored links
linkcolor=blue,% internal links color
}
\usepackage{afterpage}% leave a blank page
\newcommand\blankpage{\null\thispagestyle{empty}\addtocounter{page}{-1}\newpage}
% empty for empty header and footer
\usepackage[nobottomtitles]{titlesec}% title formatting, no title at bottom of page
\renewcommand{\chaptertitlename}{\color{oliveYellow}Chapter}% Chapter in oliveYellow instead of black
\renewcommand{\bottomtitlespace}{.2\textheight}% minimal space required to not change page title (default .2)
\titleformat{\chapter}[display]{\Large\bfseries\filcenter}{\chaptertitlename\ \thechapter}{1.5cm}{\uppercase}[]
% display: "Chapter X" written above the title
% filcenter: title centering
% 15mm vertical space between "Chapter X" and chapter title
\titleformat{\section}{\vspace{.75\baselineskip}\normalfont\large\bfseries}{}{0cm}
% vspace=space between text and horizontal line
{{\color{oliveYellow}{\hrule height .1cm}}\vspace{.3cm}{\thesection}\hspace{.5cm}}[\vspace{.75\baselineskip}]
\titleformat{\subsection}{\vspace{.6\baselineskip}\normalfont\bfseries}{}{0cm}
{{\color{oliveYellow}{\hrule height .05cm}}\vspace{.2cm}{\thesubsection}\hspace{.5cm}}[\vspace{.5\baselineskip}]
\titlespacing*{\subsection}{0mm}{-2mm}{0mm}
% indentation
% vertical space between text and horizontal line (opposite to parskip)
% vertical space between title and text
\titleformat{\subsubsection}{\vspace{.6\baselineskip}\fontsize{12}{1}\bfseries}{}{0cm}
{{\color{oliveYellow}\hrule}\vspace{.2cm}{\thesubsubsection}\hspace{.5cm}}[\vspace{.5\baselineskip}]
\titlespacing*{\subsubsection}{0mm}{-2mm}{0mm}

\renewcommand{\thesection}{\Alph{section}}% sections numbered with Greek letters
\renewcommand{\numberline}[1]{#1~~}% To$C$ numbering issue

\usepackage{parskip}% spaces in paragraphs
\setlength{\parindent}{0pt}% suppress indentations
\setlength{\parskip}{2mm}% add vertical space between paragraphs

\title{Thermodynamics}
\author{Olivier Castéra}
\email{o.castera@free.fr}
\urladdr{https://sciences-physiques.neocities.org}
\date{\today}

\def\grad{\mathop{\boldsymbol{\rm grad}}\nolimits}
\def\curl{\mathop{\rm curl}\nolimits}
\newcommand{\dd}{\mathrm{d}}% upright d for differential element

\begin{document}
\frontmatter
\begin{titlepage}
\parindent=0pt
https://sciences-physiques.neocities.org\\
o.castera@free.fr
\vspace*{\stretch{1}}
\vspace*{\stretch{1}}
{\color{oliveYellow}\hrule width \hsize height .4pt \kern 3pt \hrule width \hsize height 1.6pt}
\vspace*{.7cm}
\begin{center}
\textbf{\fontfamily{qcs}\fontsize{48}{54}\selectfont Thermodynamics}
\end{center}
\vspace*{.7cm}
{\color{oliveYellow}\hrule width \hsize height 1.6pt \kern 3pt \hrule width \hsize height .4pt}
\vspace*{1cm}
\begin{center}\bfseries\large
Olivier Castéra
\end{center}
\vspace*{\stretch{2}}
\begin{flushright}
\today
\end{flushright}
\end{titlepage}
\blankpage% leave a blank page
\setcounter{tocdepth}{2}% To$C$ depth
\setcounter{secnumdepth}{4}% sub-paragraph numbering depth
\tableofcontents% display ToC
\mainmatter% numbering in $A$rabic numerals

\chapter{Ideal Gases}
We consider a gas in a container. It is characterized by four variables: its pressure $p$, its volume $V$, its temperature $\theta$,
and its number of moles $n$.
The three variables $p,V,\theta$ are called \emph{state variables} because they characterize the state of the gas, unlike $n$.
If we fix three of these four variables, then the fourth has only one possible value.
Therefore, there exists a function that links these four variables:
\begin{equation*}
f(n,p,V,\theta)
\end{equation*}
where $\theta$ is the temperature in degrees Celsius, whose zero is arbitrarily set at the temperature of melting ice.
This freedom to position the zero of temperatures will help us simplify the expression of $f$.
If we double the number of moles, then at constant pressure and temperature, the volume is multiplied by two.
Therefore:
\begin{equation*}
V=n\,g(p,\theta)
\end{equation*}
where $g$ is a new function yet to be defined.
\begin{rmq}{}{}
In thermodynamics, it is customary to specify that the variables are \guillemotleft state\guillemotright,
but these variables are nothing other than the variables we usually encounter in mathematics.
Similarly, functions of state variables, also called state functions, such as $f$ or $g$ here,
are nothing other than mathematical functions.
\end{rmq}
\section{Joule Gay-Lussac Experiment}
This experiment shows that for $n$ moles of gas, if we double the volume,
the pressure is halved and the temperature remains almost constant. Thus:
\begin{equation*}
V=\frac{n}{p}\,h(\theta)
\end{equation*}
where h is a new function yet to be defined.
A gas that exactly follows this law is said to obey the \emph{first Joule law}.

\section{Charles' Experiment}
This experiment shows that if we heat $n$ moles of gas at constant volume, the pressure is an almost linear function of the temperature,
\begin{align*}
p&=\frac{n}{V}\,h(\theta)\\
&=\frac{nR}{V}\,\theta+b
\end{align*}
which is the expression of the sought function $f$.
A gas that follows this law is called an \emph{ideal gas},
$R$ is called the \emph{ideal gas constant}.

We could have equivalently used Boyle-Mariotte's experiment which shows that for $n$ moles of gas,
the product $pV$ is an almost affine function of the temperature.
\section{Absolute Temperature Scale}\label{edta}
We now use the fact that the zero of the Celsius scale is arbitrary to make the function passing through zero:
\begin{equation*}
p=\frac{nR}{V}\left(\theta+\frac{Vb}{nR}\right)
\end{equation*}
We find the following experimental values:
\begin{align*}
R&=\qty{8,314472}{\joule/\mole/\degreeCelsius}\\
V&=\qty{22,414}{\liter/\mole}\ at\ \qty{0}{\degreeCelsius}\ \text{and at}\ \qty{101325}{\pascal}
\end{align*}
so that
\begin{align*}
\frac{Vb}{nR}&=\frac{pV}{nR}-\theta\\
&=\frac{\num{101325}\times\num{22,414e-3}}{1\times\num{8,314472}}\\
&=\qty{273.15}{\degreeCelsius}
\end{align*}
If we set
\begin{empheq}[box=\mybox]{align*}
T=\theta+273.15
\end{empheq}
we have:
\begin{empheq}[box=\mybox]{align*}
pV=nRT
\end{empheq}
This is the \emph{ideal gas equation of state} where $T$ is measured in Kelvin ($\unit{\kelvin}$).
It is experimentally observed that as pressure and temperature decrease,
the behavior of all real gases approaches that of an ideal gas.
The variables $p,V,n$ and the constant $R$ being always positive,
the Kelvin temperature is also positive. Therefore, in the framework of classical thermodynamics,
there can be no temperature below zero $\unit{\kelvin}$, or $\qty{-273.15}{\degreeCelsius}$, called absolute zero.
The Kelvin temperature scale is then called the \emph{absolute temperature scale}.

\chapter{First Law of Thermodynamics}
\section{Equivalence Principle}
Joule performed the following experiment: in a water calorimeter at room temperature,
an axle equipped with paddles is immersed and rotated by falling weights.
The studied system is the water in the calorimeter, the exterior to the system is also called the ambient medium.
The exterior thus provides mechanical energy to the studied system,
and it is observed that the temperature of the system increases. Upon returning to room temperature,
the water returns all this energy to the ambient medium through thermal transfer.

The water has undergone a cycle, returning to its initial state.
It received energy in ordered form and returned this energy in disordered form.

In thermodynamics, the terms \guillemotleft work\guillemotright\ and \guillemotleft heat\guillemotright\ designate \emph{transfers} of energy between the system and the external
medium, in ordered form for the first and disordered form for the second.
Heat and work both being transfers, we can add and subtract them.

These are not quantities of energy contained in the system; they are quantities of exchanged energy,
which exist only during a change in the system's state.
Regarding work or heat, speaking of exchange, transfer, production, or supply is an abuse of language.
We exchange, transfer, or supply energy in a certain form, mechanical or thermal.
We do not exchange a transfer, we do not transfer a transfer, etc.

We will no longer speak of \guillemotleft heat contained in a body\guillemotright\ (e.g.: this coat keeps the heat),
as was the case in the early days of thermodynamics,
but of thermal energy.

From Joule's experiment, we state the following principle.
\begin{axio}{Equivalence Principle}{}
When a system follows a cycle of transformations, the algebraic sum of the work W (Work) and the heat Q is zero:
\begin{empheq}[box=\mybox]{align*}
(W+Q)_{cycle}=0
\end{empheq}
\end{axio}
This principle can only have general validity if it also applies to cycles where the exterior
provides thermal energy to the system, and the system returns all this energy, part of it in mechanical form.
Hirn showed that the equivalence principle is satisfied by steam engines producing mechanical energy.

\section{Transformation Cycle}

Consider a cycle passing through two distinct equilibrium states, $A$ and $B$. This cycle consists of a transformation $\alpha$,
reversible or not, to go from $A$ to $B$, and a return transformation $r$, reversible or not, to go from $B$ to $A$.
The intermediate states are not necessarily equilibrium states. Suppose there exists another transformation,
denoted $\beta$, to go from $A$ to $B$. Represent this cycle in the Clapeyron diagram:

\begin{pspicture}(-5,-1)(9,6)
%\psgrid(-5,-1)(9,6)
\uput[0](8,0){V}
\uput[0](-.6,5){p}
\psline{>}(8,0)(0,0)
\psline{>}(0,5)(0,0)
\pscurve{>}(5,1.5)(3.5,4)(1,4)%alpha
\pscurve{>}(5,1.5)(3.5,3)(1,4)%beta
\pscurve{>}(1,4)(2,2)(5,1.5)%retour
\uput[0](0.4,4.2){A}
\uput[0](5,1.2){B}
\uput[0](2.5,4.5){$\alpha$}
\uput[0](3,3.5){$\beta$}
\uput[0](2,1.5){r}
\end{pspicture}

Apply the equivalence principle to the two other possible cycles:
\begin{align*}
W_{\alpha}+Q_{\alpha}+W_{r}+Q_{r}&=0\\
W_{\beta}+Q_{\beta}+W_{r}+Q_{r}&=0
\end{align*}
Therefore:
\begin{equation*}
W_{\alpha}+Q_{\alpha}=W_{\beta}+Q_{\beta}
\end{equation*}
\begin{theo}\label{th:indep_transfo}
When there are several transformations to take a system from one equilibrium state to another equilibrium state,
the sum $W+Q$ is independent of the followed transformation and depends only on the initial and final states.
\end{theo}
\section{Internal Energy}
The sum $W+Q$ depending only on the final and initial states, we can write it as a function of the variables of these states.
Let a transformation go from $A$ to $B$, then:
\begin{equation*}
(W+Q)_{AB}=f(p_A,V_A,T_A\,;\,p_B,V_B,T_B)
\end{equation*}
Consider an arbitrary equilibrium state $C$, according to theorem \ref{th:indep_transfo} p.~\pageref{th:indep_transfo},
$W+Q$ not depending on the path followed, let it pass through $C$:
\begin{equation*}
(W+Q)_{AB}=(W+Q)_{AC}+(W+Q)_{CB}
\end{equation*}
However, according to the equivalence principle, for any cycle $BCCB$, we have:
\begin{align*}
(W+Q)_{BCCB}&=0\\
(W+Q)_{BC}+(W+Q)_{CB}&=0\\
(W+Q)_{BC}&=-(W+Q)_{CB}
\end{align*}
so that
\begin{equation*}
(W+Q)_{AB}=(W+Q)_{AC}-(W+Q)_{BC}
\end{equation*}

\begin{pspicture}(-5,-1)(9,6)
%\psgrid(-5,-1)(9,6)
\uput[0](7.5,.3){V}
\uput[0](-.6,5){P}
\psline{>}(8,0)(0,0)
\psline{>}(0,5)(0,0)
\pscurve{>}(5,1.5)(3.5,3)(1,4)%aller
\uput[0](0.4,4.2){A}
\uput[0](5,1.2){B}
\uput[0](3.2,3.4){$C$}
\rput[0](3.5,3){+}
\end{pspicture}

This implies:
\begin{equation*}
f(p_A,V_A,T_A\,;\,p_B,V_B,T_B)=f(p_A,V_A,T_A\,;\,p_C,V_C,T_C)-f(p_B,V_B,T_B\,;\,p_C,V_C,T_C)
\end{equation*}
Let us choose $C$ as the reference state. The coordinates $(p_C,V_C,T_C)$
being then constants determined once and for all,
we define $U$ by:
\begin{equation*}
f(p_A,V_A,T_A\,;\,p_C,V_C,T_C)=-U_A(p_A,V_A,T_A)
\end{equation*}
where the negative sign is merely a convention, and
where the function $U$ now depends only on the variables of state $A$.
Similarly:
\begin{equation*}
f(p_B,V_B,T_B\,;\,p_C,V_C,T_C)=-U_B(p_B,V_B,T_B)
\end{equation*}
This amounts to defining $U$ by:
\begin{align*}
f(p_A,V_A,T_A\,;\,p_B,V_B,T_B)&=U_B(p_B,V_B,T_B)-U_A(p_A,V_A,T_A)\\
(W+Q)_{AB}&=U_B(p_B,V_B,T_B)-U_A(p_A,V_A,T_A)
\end{align*}
\begin{defi}{}{}
The function of state variables $U(p,V,T)$, called internal energy, is such that:
\begin{empheq}[box=\myboxdef]{align*}
U_B-U_A\triangleq (W+Q)_{AB}
\end{empheq}
\end{defi}
We can state the \emph{first law of thermodynamics}:

\emph{The variation in internal energy is equal to the algebraic sum of the work and heat exchanged with the exterior.}

When there is no exchange, the system is \emph{isolated} and its internal energy is conserved.
Internal energy being a function of state variables means that if you know the variables that define the state of the gas,
$p,V$ and $\theta$, you can calculate the internal energy of this gas in that state
(the number $n$ of moles is given by the gas equation of state).
On the other hand, this calculation is impossible for work or heat, which are energy transfers between two states.

After a cycle, the state variables of the gas return to their starting values.
Any function of the state variables returns to its initial value at the start of the cycle, its variation during a cycle is zero:
\begin{empheq}[box=\mybox]{align*}
\forall f\quad\Delta f_{cycle}(p,V,T)=0
\end{empheq}
The variation in internal energy is therefore zero for any cycle:
\begin{empheq}[box=\mybox]{align}
\Delta U_{cycle}=0\label{Ucycle}
\end{empheq}
\section{Joule Gay-Lussac Experiment}
In 1843, Joule revisited an experiment imagined in 1806 by Gay-Lussac.
Two reservoirs of the same volume are connected by a valve.
Gas under pressure is confined in the first reservoir, and a vacuum is created in the second.
The assembly is placed in a water bath whose temperature is measured.
When the valve is opened, the gas sees its volume doubled while its pressure is halved.
Although the walls of the reservoirs are diathermal (heat is possible, they allow thermal energy to pass),
no temperature variation in the water bath is observed.
Interesting in principle, this experiment has no practical value.
The calorific capacity of the calorimeter being a thousand times greater than that of the gas,
even a significant temperature variation of the gas could not have been detected.
In 1865, Hirn revisited the principle of this experiment and measured a slight cooling for all real gases.
It is considered that for an ideal gas, this variation is strictly zero,
and there is therefore no thermal energy transfer between the gas and the water.
Moreover, there is no work between the gas and the exterior.
For this experiment and for an ideal gas, the first law of thermodynamics is written:
\begin{align*}
\Delta U&=W+Q\\
&=0
\end{align*}
The volume and pressure of the gas having varied, it is deduced that the internal energy of an ideal gas is a function only of its temperature,
\begin{empheq}[box=\mybox]{align*}
U=U(T)
\end{empheq}
so that for any \emph{isothermal} transformation of an ideal gas $\Delta U=0$.

\chapter{Second Law of Thermodynamics}
\section{Introduction}
In his 1824 memoir\footnote{Sadi Carnot, \emph{Réflexions sur la puissance motrice du feu
et sur les machines propres a développer cette puissance}, Bachelier bookseller, 1824},
Sadi Carnot considers the reversible engine cycle of a closed-circuit heat engine.
\begin{defi}{Cycle}{}
When a system initially in an equilibrium state undergoes a certain number of successive transformations,
and at the end of these transformations it finds itself in a final equilibrium state identical to the initial state (same values of pressure,
volume, temperature, etc.) we say that the system has described a cycle.
\end{defi}
In the present case, the system in question consists of a piston, a cylinder, and a gas, for example water vapor.
\begin{defi}{Heat Engine}{}
A heat engine is a machine either intended to produce mechanical energy (heat engines),
or to create a thermal transfer from a cold source to a hot source (heat pumps).
\end{defi}
In closed-circuit heat engines, the fluid and the machine describe a cycle.
On the other hand, when the circuit is open, only the machine describes a cycle,
the fluid is replaced by fresh new fluid at each cycle start.
\begin{defi}{Reversible Transformation}{}
A transformation is reversible if it is possible to perform exactly,
for the system and for the external medium, the inverse transformation.
\end{defi}

\section{Description of the Carnot Cycle}
The Carnot cycle has 4 stages.
The gas in the cylinder exchanges thermal energy with two fixed-temperature thermal energy sources,
called hot source and cold source.

\begin{itemize}[label=\textbullet]
\item Before the start of the cycle
\begin{figure}[H]
\begin{pspicture}(0,0.5)(12,4.5)
%\psframe(0,0.5)(12,4.5)
\psframe[linecolor=red](5,.5)(7,1)%source
\uput[0](7,2){$\theta_{gaz}=\theta_c$}
\uput[0](7.5,.75){\red Hot source at $\theta_c$}
\psline(5.5,1)(5.5,3)
\psline(6.5,1)(6.5,3)
\psline(5.5,2)(6.5,2)%piston
\psline(6,2)(6,4.2)%tige
\psline(5.5,1.02)(6.5,1.02)%socle
\psline(5.5,4.2)(6.5,4.2)%masse
\psline{-}(5.5,4.2)(5.75,4.45)
\psline{-}(5.75,4.2)(6,4.45)
\psline{-}(6,4.2)(6.25,4.45)
\psline{-}(6.25,4.2)(6.5,4.45)
\psline{-}(6.5,4.2)(6.75,4.45)
\end{pspicture}
\caption{Before the start of the cycle}
\end{figure}

Before starting the engine cycle,
the gas in the cylinder is in thermal equilibrium with the hot source at temperature $\theta_h$,
the symbol $\theta$ denoting temperatures expressed in degrees Celsius.

\item \nth{1} stage: \emph{Adiabatic expansion} (remove the hot source)

\begin{figure}[H]
\begin{pspicture}(0,1)(12,5)
%\psframe(0,1)(12,5)
\psline(5.5,1)(5.5,3)
\psline(6.5,1)(6.5,3)
\psline[linestyle=dotted](5.5,2)(6.5,2)%piston
\psline(5.5,2.75)(6.5,2.75)%piston
\psline(6,2.75)(6,4.95)%tige
\psline(5.5,1.02)(6.5,1.02)%socle
\psline{->}(6.1,3.25)(6.1,3.75)
\uput[0](6.1,3.5){$W_1$}
\end{pspicture}
\caption{\nth{1} stage}
\end{figure}

For each of the four stages, the piston is assumed to move very slowly
and without friction so that the transformations are reversible.
The gas is allowed to expand by pushing the piston upward.
The work $W_1$ allows, for example, the piston to lift a load.
By expanding, the gas reaches the temperature $\theta_c$ of the cold source.
The first law of thermodynamics states the conservation of energy:
\begin{equation*}
\Delta U=W+Q
\end{equation*}
The expansion being adiabatic, $Q_1=0$:
\begin{equation*}
\Delta U=W_1
\end{equation*}
Joule Gay-Lussac's experiment shows that the internal energy of a gas depends almost only on its temperature,
the work is then a function only of the temperature variation from $\theta_h$ to $\theta_c$:
\begin{equation*}
W_1=U(\theta_c)-U(\theta_h)
\end{equation*}

\item \nth{2} stage: \emph{Isothermal compression at temperature $\theta_c$} (add the cold source)

\begin{figure}[H]
\begin{pspicture}(0,.5)(12,4)
%\psframe(0,.5)(12,4)
\psframe[linecolor=blue](5,.5)(7,1)%source
\uput[0](7.5,.75){\blue Cold source at $\theta_f$}
\psline(5.5,1)(5.5,3)
\psline(6.5,1)(6.5,3)
\psline[linestyle=dotted](5.5,2.75)(6.5,2.75)%piston
\psline(5.5,1.5)(6.5,1.5)%piston
\psline(6,1.5)(6,3.7)%tige
\psline(5.5,1.02)(6.5,1.02)%socle
\psline{->}(6.1,3.75)(6.1,3.25)
\uput[0](6.1,3.5){$W_2$}
\psline{->}(5.75,1.25)(5.75,.75)
\uput[0](5.7,1.25){$Q_f$}
\end{pspicture}
\caption{\nth{2} stage}
\end{figure}

The transformation being isothermal,
\begin{align*}
\Delta U(\theta)&=0\\
W_2&=-Q_c
\end{align*}
The mechanical energy supplied to the gas is almost entirely lost through thermal transfer to the cold source.

\item \nth{3} stage: \emph{Adiabatic compression} (remove the cold source)

\begin{figure}[H]
\begin{pspicture}(0,1)(12,4)
%\psframe(0,1)(12,4)
\psline(5.5,1)(5.5,3)
\psline(6.5,1)(6.5,3)
\psline[linestyle=dotted](5.5,1.5)(6.5,1.5)%piston
\psline(5.5,1.25)(6.5,1.25)%piston
\psline(6,1.25)(6,3.45)%tige
\psline(5.5,1.02)(6.5,1.02)%socle
\psline{->}(6.1,3.75)(6.1,3.25)
\uput[0](6.1,3.5){$W_3$}
\end{pspicture}
\caption{\nth{3} stage}
\end{figure}

We continue to supply mechanical energy to the gas so that its temperature reaches the temperature $\theta_h$ of the hot source.
The compression being adiabatic,
the work here is also a function only of the temperature variation from $\theta_c$ to $\theta_h$:
\begin{align*}
W_3&=U(\theta_h)-U(\theta_c)\\
&=-W_1
\end{align*}

\item \nth{4} stage: \emph{Isothermal expansion at temperature $\theta_h$} (add the hot source again)

\begin{figure}[H]
\begin{pspicture}(0,.5)(12,4.5)
%\psframe(0,.5)(12,4.5)
\psframe[linecolor=red](5,.5)(7,1)%source
\uput[0](7.5,.75){\red Source chaude à $\theta_c$}
\psline(5.5,1)(5.5,3)
\psline(6.5,1)(6.5,3)
\psline(5.5,2)(6.5,2)%piston
\psline(6,2)(6,4.2)%tige
\psline(5.5,1.02)(6.5,1.02)%socle
\psline{->}(6.1,3)(6.1,4)
\uput[0](6.1,3.5){$W_4$}
\psline{->}(5.75,.75)(5.75,1.50)
\uput[0](5.7,.75){$Q_c$}
\end{pspicture}
\caption{\nth{4} stage}
\end{figure}

The gas temperature being nearly constant, its internal energy does not vary.
\begin{align*}
\Delta U(\theta)&=0\\
W_4&=-Q_h
\end{align*}
The mechanical energy supplied by the gas comes entirely from the thermal transfer from the hot source to the gas.
We have returned to the start of the cycle, another cycle can begin.
\end{itemize}

\section{Study of the Carnot Cycle}
Sadi Carnot created a theoretical model of the steam engines of his time.
Thermal transfers must occur only with the hot source (boiler) and the cold source (atmosphere),
which is why stages 1 and 3 are adiabatic. Stages 2 and 4 are done in contact with the cold and hot sources,
so at their respective temperatures. How can we be sure that this cycle is optimal? Let's quote Sadi Carnot:

\guillemotleft Since any restoration of equilibrium in caloric can be the cause of the production of motive power,
any restoration of equilibrium that occurs without production of this power must be considered a true loss:
now, with a little reflection, one will realize that any temperature change that is not due to a change in volume
of bodies can only be a useless restoration of equilibrium in caloric. The necessary condition for the maximum is
therefore \emph{that no temperature change occurs in the bodies used to realize the motive power of heat
that is not due to a change in volume}\ldots
Any temperature change that is not due to a change in volume or chemical action
(action which we provisionally assume does not occur here) is necessarily due to the direct passage of
caloric from a more or less heated body to a colder body.
This passage occurs mainly upon contact of bodies of different temperatures:
therefore such contact must be avoided as much as possible.\guillemotright

In other words, in heat engines, only the change in volume creates work,
and heat must create this change in volume and not uselessly balance temperatures
(which could moreover be done by directly putting the sources in contact).
Stages 1 and 3 thus serve to bring the gas to the temperature of the sources before putting it in contact with them.

The total work is such that:
\begin{align*}
W_T&=W_1+W_2+W_3+W_4\\
&=W_2+W_4
\end{align*}
Over a cycle, excess mechanical energy is supplied by the heat engine. Here are Sadi Carnot's explanations:

\guillemotleft  In these various operations, the piston experiences a greater or lesser effort from the air enclosed in the cylinder;
the elastic force of this air varies, both due to changes in volume and changes in temperature;
but one must note that at equal volume, that is, for similar positions of the piston,
the temperature is higher during expansion movements than during compression movements.
During the former, the elastic force of the air is therefore greater and consequently the amount of motive power produced by
the expansion movements is more considerable than that consumed to produce the compression movements.
Thus one obtains an excess of motive power, excess which can be used for any purposes.\guillemotright

Stage $2$ thus consumes less mechanical energy than stage $4$ supplies:
\begin{equation*}
|W_2|<|W_4|
\end{equation*}
so that:
\begin{equation*}
W_T\neq0
\end{equation*}
A thermal transfer occurring only if there is a temperature difference,
one may wonder how there can be thermal transfer during stages $2$ and $4$,
the gas and the source being at the same temperature. Sadi Carnot replies:

\guillemotleft One may be surprised here that body $B$ (cold source) being at the same temperature as the vapor can condense it:
undoubtedly this is not rigorously possible; but the smallest temperature difference will determine the condensation,
which suffices to establish the correctness of our reasoning.\guillemotright

The transformations being reversible, they are \emph{among other things} (but not only) infinitely slow, that is, quasi-static,
the temperatures differ by a first-order infinitesimal.

\section{Statement of the Second Law of Thermodynamics}
Let's quote Sadi Carnot:

\guillemotleft The motive power is therefore due, in steam engines, not to a real consumption of caloric,
\emph{but to its transport from a hot body to a cold body}, that is, to its restoration of equilibrium,
equilibrium supposed broken by any cause whatsoever, by a chemical action, such as combustion, or by any other.
We will soon see that this principle is applicable to any machine set in motion by heat.
According to this principle, it is not sufficient, to give birth to motive power, to produce heat:
one must also procure cold; without it the heat would be useless.\guillemotright

The first sentence is thus a principle, which can be stated more modernly:
\begin{axio}{}{}
A machine describing a cycle can supply mechanical energy only if it receives thermal energy from a hot source,
and cedes some to a cold source.
\end{axio}
The last sentence of the cited section is the same principle stated differently.
Curiously, this statement is attributed to Lord Kelvin in 1852:
\begin{axio}{Statement according to Lord Kelvin}{}
A machine describing a cycle and in contact with a single source cannot supply mechanical energy.
\end{axio}
There is finally a third equivalent formulation, stated in 1850 by Clausius:
\emph{[\ldots] heat, which always tends to balance existing temperature differences and,
consequently, to pass from hot bodies to cold bodies.}
In other words, heat never spontaneously goes from a cold body to a hot body. We can state the following axiom:
\begin{axio}{Statement according to Clausius}{}
An isolated machine describing a cycle cannot transfer thermal energy from a cold source to a hot source.
\end{axio}
We can easily show that these three axioms are equivalent.
It suffices to verify that if any one of them is assumed false,
then the other two axioms are also false (modus tollens).

\chapter{Thermodynamic Temperature Scale}
\section{Thermodynamic Efficiency}
\subsection{Case of the Engine Cycle}
\begin{defi}{Thermodynamic Efficiency}{}
Efficiency is the ratio of our gain to our expense.
\end{defi}
The studied system being the gas, for us, external to the system,
our gain is the mechanical energy supplied by the heat engine,
and our expense is the thermal energy transfer from the hot source to the cold source,
the quantities being taken positive:
\begin{equation*}
\eta=\frac{|W_T|}{|Q_h|}
\end{equation*}
Whatever the sign convention, $W_T$ and $Q_h$ are of opposite signs, so:
\begin{equation*}
\eta=-\frac{W_T}{Q_h}
\end{equation*}

In the case of operation as a heat pump or refrigerator,
we will speak of \emph{thermodynamic effectiveness} rather than efficiency, because we can obtain values greater than $1$.
This is due to the fact that the mechanical energy supplied to these machines serves to create a thermal transfer,
and not to directly create thermal energy.

\subsection{Case of the Heat Pump or Refrigerator Cycle}

Our gain here is the thermal transfer from the cold source to the hot source,
for example to heat a building.
Our expense is the mechanical energy
(more precisely the electrical energy converted to mechanical energy by an electric motor) supplied to the heat engine,
the quantities being taken positive:
\begin{equation*}
\alpha=\frac{|Q_c|}{|W_T|}
\end{equation*}
Whatever the sign convention, $W_T$ and $Q_c$ are of opposite signs so:
\begin{equation*}
\alpha=-\frac{Q_c}{W_T}
\end{equation*}

Sadi Carnot makes the following analogy:

\guillemotleft The motive power of a waterfall depends on its height and the quantity of liquid;
the motive power of heat also depends on the quantity of caloric used, and on what one could name,
what we will indeed call the height of its fall,
that is, the temperature difference of the bodies between which the exchange of caloric takes place.\guillemotright

Only the analogy is limited, because contrary to what Sadi Carnot believed,
the caloric (internal energy of thermal agitation) is not entirely found in the cold source but a part,
and only a part, is transformed into work. To use Sadi Carnot's terms,
there is indeed real consumption of part of the caloric, which is found in motive power.
His representation of thermal transfer is incorrect, but the notion of efficiency is independent of this representation.

A reversible machine can function as an engine:

\begin{figure}[H]
\begin{pspicture}(0,.5)(12,3.5)
%\psframe(0,.5)(12,3.5)
\psframe[linecolor=blue](5,0.5)(7,1)
\psframe(5.5,1.5)(6.5,2.5)
\psframe[linecolor=red](5,3)(7,3.5)
\psline{->}(6,3)(6,2.5)
\uput[0](6,2.7){$Q_c$}
\psline{->}(6,1.5)(6,1)
\uput[0](6,1.2){$Q_f$}
\psline{->}(6.5,2)(8.5,2)
\uput[0](7,2.3){$W_M$}
\uput[0](7.5,.7){\blue Cold source}
\uput[0](7.5,3.2){\red Hot source}
\uput[0](3.5,2){Engine}
\end{pspicture}
\caption{Engine operation}
\end{figure}

Sadi Carnot defines the notion of reversible transformation:

\guillemotleft The operations we have just described could have been done in a sense and in an inverse order\ldots
But if one acts on both sides on the same quantity of vapor,
if no loss of motive power or caloric has occurred,\ldots\guillemotright

A reversible machine can therefore also function in reverse and use mechanical energy to perform a thermal transfer
from the cold source to the hot source.
It can therefore function as a heat pump:

\begin{figure}[H]
\begin{pspicture}(0,.5)(12,3.5)
%\psframe(0,.5)(12,3.5)
\psframe[linecolor=blue](5,0.5)(7,1)
\psframe(5.5,1.5)(6.5,2.5)
\psframe[linecolor=red](5,3)(7,3.5)
\psline{->}(6,2.5)(6,3)
\uput[0](6,2.7){$Q_c$}
\psline{->}(6,1)(6,1.5)
\uput[0](6,1.2){$Q_f$}
\psline{->}(3.5,2)(5.5,2)
\uput[0](4,2.3){$W_P$}
\uput[0](7.5,.7){\blue Cold source}
\uput[0](7.5,3.2){\red Hot source}
\uput[0](7.5,2){Heat pump}
\end{pspicture}
\caption{Heat pump operation}
\end{figure}

For the system and the external medium to return to their initial states,
the reversible machine must use exactly the mechanical energy it supplied in engine operation
to transfer the thermal energy in heat pump operation, $|W_P|=|W_M|$:

\begin{figure}[H]
\begin{pspicture}(0,.5)(12,5.5)
%\psframe(0,.5)(12,5.5)
\psframe[linecolor=blue](4,0.5)(8,1)
\psframe(4.5,2.5)(5.5,3.5)
\psframe(6.5,2.5)(7.5,3.5)
\psframe[linecolor=red](4,5)(8,5.5)
\psline{->}(5,5)(5,3.5)
\uput[0](5,4.2){$Q_1$}
\psline{->}(5,2.5)(5,1)
\uput[0](5,1.7){$Q_2$}
\psline{->}(7,1)(7,2.5)
\uput[0](7,1.7){$Q_2$}
\psline{->}(7,3.5)(7,5)
\uput[0](7,4.2){$Q_1$}
\uput[0](5.5,3.2){\tiny $W_M$}
\uput[0](4.4,3){$M_{rev}$}
\uput[0](6.5,3){$P_{rev}$}
\psline{->}(5.5,3)(6.5,3)
\uput[0](8.5,.7){\blue Cold source}
\uput[0](8.5,5.2){\red Hot source}
\end{pspicture}
\caption{}
\end{figure}

Can two reversible machines have two different efficiencies?
Let's quote Sadi Carnot again:

\guillemotleft [\ldots] if it were possible, by any method whatsoever,
to make caloric produce a greater quantity of motive power than we have done by our first series of operations,
it would suffice to divert a portion of this motive power to make caloric rise, by the method just indicated,
from body $B$ to body $A$, from the refrigerant to the furnace, to restore things to their primitive state and
thus put oneself in a position to restart an operation entirely similar to the first and so on:
this would be not only perpetual motion, but an indefinite creation of motive power\ldots\guillemotright

Imagine two reversible machines performing an engine cycle between the same sources.
The second supplies less mechanical energy than the first, $W_{E_2}<W_{E_1}$. Let's make it function as a heat pump.
It then does not use all the mechanical energy supplied by the other machine to restore the hot and cold sources
to their initial states.
Mechanical energy is created from nothing, and according to Sadi Carnot,
this is contrary \emph{to the laws of mechanics and sound physics}.
In fact, he appeals to the first law of thermodynamics, conservation of energy, which at this date is not yet stated.
He concludes:

\guillemotleft One must conclude that the maximum motive power resulting from the use of vapor is also the maximum motive power
achievable by any means whatsoever.\guillemotright

Therefore,
\begin{align*}
W_{E_1}&=W_{E_2}\\
-\frac{W_{E_1}}{Q_1}&=-\frac{W_{E_2}}{Q_1}
\end{align*}
\begin{empheq}[box=\mybox]{align*}
\eta_{E_1}=\eta_{E_2}
\end{empheq}
and we can state the following theorem:
\begin{theo}\label{th:}
The efficiency is the same for all reversible machines operating between the same two sources.
\end{theo}

Can a real irreversible machine have an efficiency superior to that of a reversible machine?
For Sadi Carnot, it goes without saying that no, a reversible machine being a perfect machine.
We can now state Sadi Carnot's theorem:
\begin{theo}\label{th:}
All reversible machines operating between the same two sources have the same efficiency,
and this efficiency is superior to that of any irreversible machine.
\end{theo}

\section{New Temperature Scale}
The efficiency of reversible machines following the Carnot cycle, called Carnot efficiency,
is thus the maximum possible efficiency of all diathermal heat engines.
Sadi Carnot then states the following general proposition:

\guillemotleft\emph{The motive power of heat is independent of the agents used to realize it;
its quantity is fixed solely by the temperatures of the bodies between which the transport of caloric ultimately occurs.}\guillemotright

Indeed, this max efficiency not being a function of the machine used,
it can only be a function of the temperatures of the hot and cold sources.
The efficiency must not depend on the chosen temperature scale.
For example, switching from Celsius to Fahrenheit, the efficiency must be the same,
therefore there must exist an absolute temperature scale.
An absolute temperature scale having already been found with the notion of ideal gas,
we will use the term thermodynamic temperature scale to distinguish them.
It can be shown that these scales coincide.

We are free to choose the amplitude of the unit of thermodynamic temperatures, because efficiency having no dimension,
it is necessarily the ratio of two temperature functions.
For example, the ratio of two temperatures in Celsius depends only on the definition of zero degrees Celsius,
but not on the unit itself ($100$ units between freezing water and boiling water, at atmospheric pressure). Indeed, we have:
\begin{equation*}
\forall \alpha\neq 0,\quad\quad\frac{\theta_1}{\theta_2}=\frac{\alpha\times \theta_1}{\alpha\times \theta_2}
\end{equation*}
but,
\begin{equation*}
\forall \beta\neq 0,\quad\quad\frac{\theta_1}{\theta_2}\neq\frac{\theta_1+\beta}{\theta_2+\beta}
\end{equation*}
For the thermodynamic temperature scale, we will choose the same unit amplitude as that of the Celsius scale.

We can simplify the expression of efficiency using the notion of internal energy.
We have seen that the internal energy of a gas being a function of state variables,
its variation is zero for any cycle.
Now internal energy can vary in two ways, by work (mechanical energy transfer) or heat (thermal energy transfer):
\begin{align*}
\Delta U_{cycle}&=0\\
W_T+Q_h+Q_c&=0\\
W_T&=-Q_h-Q_c
\end{align*}
therefore for an engine cycle
\begin{align*}
\eta&=-\frac{W_T}{Q_h}\\
&=\frac{Q_h+Q_c}{Q_h}\\
&=1+\frac{Q_c}{Q_h}
\end{align*}
The thermal transfers $Q_c$ and $Q_h$ being of opposite signs, we also have:
\begin{empheq}[box=\mybox]{align*}
\eta=1-\frac{|Q_c|}{|Q_h|}
\end{empheq}

Now let's find the expression of thermal transfers as a function of temperatures.
We will use the fact that for any reversible machine,
there can be only one possible efficiency between two sources,
a hot one at $\theta_1$ and a cold one at $\theta_3$.
Imagine an intermediate source, at temperature $\theta_2$, such that $\theta_1$>$\theta_2$>$\theta_3$.
Let three reversible engines, $A$, $B$, and $C$, operate between these sources (cf.~figure~\ref{3moteurs}).
If we assume that $Q_1$ is the same at the input of engines $A$ and $C$,
then $Q_3$ must also be the same at the output of engines $B$ and $C$.
We have seen that otherwise,
by making $A$ and $B$, or $C$, function as a heat pump, we could create mechanical energy from nothing.

\begin{figure}[H]
\begin{pspicture}(0,.5)(12,6)
%\psframe(0,.5)(12,6)
\psframe[linecolor=blue](4,0.5)(8,1)
\psframe(4.5,1.5)(5.5,2.5)
\psframe(4.5,4)(5.5,5)
\psframe(6.5,4)(7.5,5)
\psframe[linecolor=red](4,5.5)(8,6)
\psframe[linecolor=violet](4,3)(6,3.5)
\psline{->}(5,5.5)(5,5)
\uput[0](5,5.2){$Q_1$}
\psline{->}(5,4)(5,3.5)
\uput[0](5,3.7){$Q_2$}
\psline{->}(5,3)(5,2.5)
\uput[0](5,2.7){$Q_2$}
\psline{->}(5,1.5)(5,1)
\uput[0](5,1.2){$Q_3$}
\psline{->}(7,5.5)(7,5)
\uput[0](7,5.2){$Q_1$}
\psline{->}(7,4)(7,1)
\uput[0](7,2.5){$Q_3$}
\psline{->}(4.5,4.5)(2.5,4.5)
\uput[0](3.1,4.8){$W_{1\to2}$}
\psline{->}(4.5,2)(2.5,2)
\uput[0](3.1,2.3){$W_{2\to3}$}
\psline{->}(7.5,4.5)(9.5,4.5)
\uput[0](7.8,4.8){$W_{1\to3}$}
\uput[0](4.7,4.5){$A$}
\uput[0](4.7,2){$B$}
\uput[0](6.7,4.5){$C$}
\uput[0](.2,.7){\blue Cold source at $\theta_3$}
\uput[0](0,5.7){\red Hot source at $\theta_1$}
\uput[0](-1,3.2){\textcolor{violet}{Intermediaite source at $\theta_2$}}
\end{pspicture}
\caption{}
\label{3moteurs}
\end{figure}

The Carnot efficiency being a function only of the source temperatures, we have for each reversible engine:
\begin{align*}
\eta_{A}&=1-\frac{|Q_2|}{|Q_1|}\\
&=1-\psi(\theta_1,\theta_2)\\
\eta_{B}&=1-\frac{|Q_3|}{|Q_2|}\\
&=1-\psi(\theta_2,\theta_3)\\
\eta_{C}&=1-\frac{|Q_3|}{|Q_1|}\\
&=1-\psi(\theta_1,\theta_3)
\end{align*}
Moreover,
\begin{equation*}
\frac{|Q_3|}{|Q_1|}=\frac{|Q_3||Q_2|}{|Q_2||Q_1|}
\end{equation*}
which implies:
\begin{equation*}
\psi(\theta_1,\theta_3)=\psi(\theta_1,\theta_2)\times\psi(\theta_2,\theta_3)
\end{equation*}
The temperature $\theta_2$ is not present in the left member. For it not to be in the right one either, we set:
\begin{align*}
\psi(\theta_1,\theta_2)&=\frac{F(\theta_1)}{F(\theta_2)}\\
\psi(\theta_2,\theta_3)&=\frac{F(\theta_2)}{F(\theta_3)}
\end{align*}
thus $\theta_2$ will disappear from the product $\psi(\theta_1,\theta_2)\times\psi(\theta_2,\theta_3)$. Therefore,
\begin{equation*}
\frac{|Q_c|}{|Q_h|}=\frac{F(\theta_c)}{F(\theta_h)}
\end{equation*}
where we recall that the temperatures $\theta_c$ and $\theta_h$ of the sources are expressed in degrees Celsius.
To preserve the amplitude of Celsius units, Lord Kelvin proposes the following function:
\begin{equation*}
F(\theta)=\theta+\beta
\end{equation*}
The max efficiency then takes the following expression:
\begin{align*}
\eta&=1-\frac{|Q_f|}{|Q_c|}\\
&=1-\frac{\theta_f+\beta}{\theta_c+\beta}\\
1-\eta&=\frac{\theta_f+\beta}{\theta_c+\beta}\\
\theta_c+\beta-\eta\,\theta_c-\eta\,\beta&=\theta_f+\beta
\end{align*}
that is,
\begin{align*}
\eta\,\beta&=\theta_c-\eta\,\theta_c-\theta_f\\
\beta&=\frac{\theta_c-\theta_f}{\eta}-\theta_c
\end{align*}
To find the value of $\beta$ we build a quasi-reversible machine
then calculate its efficiency $\eta$ by measuring the ratio $Q_c/Q_h$ during an engine cycle.

For such a machine operating between temperatures $\theta_h=\qty{100}{\degreeCelsius}$ and $\theta_c=\qty{0}{\degreeCelsius}$,
the measured max efficiency is $0.26799$. We then obtain,
\begin{align*}
\beta&=\frac{100}{0.26799}-100\\
\beta&=\qty{273.15}{\degreeCelsius}
\end{align*}
The thermodynamic temperature scale, expressed in Kelvin ($\unit{\kelvin}$), is defined by:
\begin{empheq}[box=\mybox]{align*}
T(\unit{\kelvin})=\theta(\unit{\degreeCelsius})+\qty{273.15}{\degreeCelsius}
\end{empheq}
The max efficiency is then expressed by:
\begin{empheq}[box=\mybox]{align*}
\eta=1-\frac{T_c}{T_h}
\end{empheq}
The efficiency cannot exceed unity, $T_c$ and $T_h$ must always be of the same sign.
For $\theta=\qty{0}{\degreeCelsius}$, we have $T=\qty{273.15}{\kelvin}$, thermodynamic temperatures are thus always positive:
\begin{align*}
T(\unit{\kelvin})&\geqslant0\\
\theta(\unit{\degreeCelsius})+\qty{273.15}{\degreeCelsius}&\geqslant0\\
\theta(\unit{\degreeCelsius})&\geqslant-\qty{273.15}{\degreeCelsius}
\end{align*}
Thus $\beta$ is the zero of the Celsius scale expressed in the thermodynamic temperature scale,
and the zero of the thermodynamic temperature scale $T=\qty{0}{\kelvin}$, is $\qty{-273.15}{\degreeCelsius}$.

\section{Clausius Inequality}
We have shown that for a reversible cycle, we have the equality:
\begin{align*}
1+\frac{Q_c}{Q_h}&=1-\frac{T_c}{T_h}\\
\frac{Q_c}{T_c}&=-\frac{Q_h}{T_h}\\
\frac{Q_c}{T_c}+\frac{Q_h}{T_h}&=0
\end{align*}
and for an irreversible cycle,
\begin{align*}
\eta_{irr}&<\eta_{rev}\\
1+\frac{Q_c}{Q_h}&<1-\frac{T_c}{T_h}
\end{align*}

\begin{align*}
\frac{Q_c}{T_c}&<-\frac{Q_h}{T_h}\\
\frac{Q_c}{T_c}+\frac{Q_h}{T_h}&<0
\end{align*}
We can state Clausius' inequality:

\emph{For any machine cycle operating between two sources, the following relation is always verified}
\begin{empheq}[box=\mybox]{align*}
\frac{Q_c}{T_c}+\frac{Q_h}{T_h}\leqslant0
\end{empheq}
\emph{equality holding for a reversible machine.}

\chapter{A New Function of State Variables}
\section{Clausius Relation}
Let a arbitrary cycle with continuous evolution of the ambient medium temperature, and continuous thermal energy transfer.
We will show that for energy transfers (work and heat),
we can replace this cycle with an infinite sum of Carnot cycles,
reversible or not. In Clapeyron's $p=f(V)$ diagram, represent this arbitrary cycle, as well as $n$ Carnot cycles.
Isotherms are represented in red and adiabatics in blue:

\begin{figure}[H]
\begin{pspicture}(-2,0)(9,6)
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true}
%\psframe(-2,0)(9,6)
\uput[0](8,0){V}
\put(0,5.4){p}
\psline{>}(8,0)(0,0)
\psline{>}(0,5)(0,0)
\pscurve(3.5,2.8)(3.75,2.5)(5,1)(4,.5)(1.75,1.5)(1,3)(2,4)(3.5,2.8)
\psplot[linecolor=red]{1.95}{5.9}{2.3/x}
\psplot[linecolor=red]{1}{6}{3/x}
\psplot[linecolor=red]{.79}{5.9}{4/x}
\psplot[linecolor=red]{1}{5.9}{5/x}
\psplot[linecolor=red]{1.3}{5.6}{6/x}
\psplot[linecolor=red]{1.4}{5.5}{7/x}
\psplot[linecolor=red]{1.6}{5.}{8/x}
\psplot[linecolor=red]{1.9}{4.15}{9/x}
\psplot[linecolor=red]{2.1}{3.2}{10/x}

\psplot[linecolor=blue]{1}{1.95}{3/(x^1.4)}
\psplot[linecolor=blue]{.77}{1.5}{3.5/(x^1.4)}
\psplot[linecolor=blue]{1}{1.7}{5/(x^1.4)}
\psplot[linecolor=blue]{1.28}{1.9}{6.5/(x^1.4)}
\psplot[linecolor=blue]{1.4}{2}{8/(x^1.4)}
\psplot[linecolor=blue]{1.58}{2.1}{9.5/(x^1.4)}
\psplot[linecolor=blue]{1.88}{2.5}{11.5/(x^1.4)}
\psplot[linecolor=blue]{2.1}{2.75}{13.5/(x^1.4)}

\psplot[linecolor=blue]{3.2}{4.15}{16/(x^1.4)}
\psplot[linecolor=blue]{3.85}{5}{15.3/(x^1.4)}
\psplot[linecolor=blue]{4.1}{5.5}{14/(x^1.4)}
\psplot[linecolor=blue]{4}{5.6}{12.2/(x^1.4)}
\psplot[linecolor=blue]{3.95}{5.9}{10.5/(x^1.4)}
\psplot[linecolor=blue]{3.9}{5.9}{8.5/(x^1.4)}
\psplot[linecolor=blue]{3.5}{6}{6.5/(x^1.4)}
\psplot[linecolor=blue]{3.6}{5.9}{4.9/(x^1.4)}
\end{pspicture}
\caption{}
\end{figure}

The work has the expression,
\begin{empheq}[box=\mybox]{align*}
W=-\int p_{ext}\,\dd V
\end{empheq}
where the negative sign is due to the chosen convention of a selfish system:
when $\dd V$ is positive, the gas supplies mechanical energy to the external medium, from the gas's point of view it is a loss.

For any transformation represented by a curve in the Clapeyron diagram,
the mechanical energy is visualized by the area under the curve.
If during the transformation the volume increases, mechanical energy is produced by the heat engine,
and if during the transformation the volume decreases, mechanical energy is consumed by the heat engine.
For a cycle, we subtract the areas under each of the two curves going from the minimum volume point to the maximum volume point.
The produced or consumed mechanical energy is therefore equal to the area of the cycle.
For the arbitrary cycle and the set of Carnot cycles to be equivalent from the point of view of energy transfers,
we draw the set of cycles such that the sum
of the areas equals the area of the arbitrary cycle.
Moreover, for any cycle the variation in internal energy being zero,
\begin{align*}
\Delta U_{cycle}&=0\\
W_T&=-Q_T
\end{align*}
Therefore, if the mechanical energy transfers are equal in both representations,
the thermal transfers will also be equal.

According to Clausius' inequality, for each of the $n$ cycles, we have:
\begin{equation*}
\frac{Q_{j+1}}{T_{j+1}}+\frac{Q_{j}}{T_{j}}\leqslant0
\end{equation*}
where the temperatures $T_j$ are the temperatures of the $n+1$ sources.
If we sum over the $n$ cycles:
\begin{equation*}
\sum_{j=1}^{n}\left(\frac{Q_{j+1}}{T_{j+1}}+\frac{Q_{j}}{T_{j}}\right)\leqslant0
\end{equation*}
Equality holding if the $n$ cycles are reversible.

Let $n$ tend to infinity. For an infinitesimal cycle $T_j\approx T_j+1$,
and the thermal transfers $Q_j$ and $Q_{j+1}$ being of opposite sign, we have:
\begin{equation*}
\frac{Q_{j+1}}{T_{j+1}}+\frac{Q_{j}}{T_{j}}=\frac{\delta Q}{T_j}
\end{equation*}
We can state Clausius' relation:

\emph{For the infinite sum of all cycles, that is, for an arbitrary cycle,}
\begin{empheq}[box=\mybox]{align*}
\oint\frac{\delta Q}{T_{source}}\leqslant0
\end{empheq}
\emph{equality holding for a reversible cycle.}
$T_{source}$ is the temperature of the source with which the gas is in contact at each instant.

\section{Case of Reversible Transformations}
Let a reversible cycle $ABA$, going from $A$ to $B$ by path $(I)$, then from $B$ to $A$ by path $(II)$.

\begin{figure}[H]
\begin{pspicture}(-2,0)(9,5)
%\psframe(-2,0)(9,5)
\uput[0](8,0){V}
\uput[0](-.6,5){P}
\psline{>}(8,0)(0,0)
\psline{>}(0,5)(0,0)
\pscurve{>}(5,1.5)(3.5,4)(1,4)%I
\pscurve{>}(1,4)(2,2)(5,1.5)%II
\uput[0](0.4,4.2){A}
\uput[0](5,1.2){B}
\uput[0](2.5,4.5){$I$}
\uput[0](2,1.4){$II$}
\end{pspicture}
\caption{}
\end{figure}

We then have:
\begin{align*}
\oint\frac{\delta Q_{rev}}{T_{source}}&=0\\
\int_{A\,(I)}^{B}\frac{\delta Q_{rev}}{T_{source}}+\int_{B\,(II)}^{A}\frac{\delta Q_{rev}}{T_{source}}&=0\\
\int_{A\,(I)}^{B}\frac{\delta Q_{rev}}{T_{source}}&=-\int_{B\,(II)}^{A}\frac{\delta Q_{rev}}{T_{source}}
\end{align*}
The cycle being reversible, path (II) is also,
\begin{equation*}
\int_{A\,(I)}^{B}\frac{\delta Q_{rev}}{T_{source}}=\int_{A\,(II)}^{B}\frac{\delta Q_{rev}}{T_{source}}
\end{equation*}
For a reversible transformation, $\int\frac{\delta Q_{rev}}{T_{source}}$ does not depend on the path followed.
It is therefore a function of the system's state variables.

$\frac{\delta Q_{rev}}{T_{source}}$ is thus an exact total differential and $\frac{1}{T_{source}}$ is an integrating
factor\footnote{See in appendices p.~\pageref{annexes}} of $\delta Q_{rev}$.
This exact total differential is denoted dS, and we have the following definition:
\begin{defi}{}{}
The function of state variables S, called entropy, is such that its differential is written:
\begin{empheq}[box=\myboxdef]{align*}
dS\triangleq \frac{\delta Q_{rev}}{T_{source}}
\end{empheq}
where dS is always taken over a reversible transformation. Its variation is written:
\begin{empheq}[box=\myboxdef]{align*}
S_B-S_A\triangleq \int_{A}^{B}\frac{\delta Q_{rev}}{T_{source}}
\end{empheq}
\end{defi}
$S$ is defined up to an additive constant, but its variation $S_B-S_A$, denoted $\Delta S$, is always perfectly determined.

For a cycle, the entropy variation is zero without being constantly zero.
It is positive if the system receives thermal energy, negative if it cedes it.
\section{Case of Irreversible Transformations}
Recall that entropy being a function of state variables,
its variation during a transformation depends only on the initial and final states.
It is therefore independent of the reversible or irreversible nature of the transformation.
To calculate it during an irreversible transformation between states $A$ and $B$,
we imagine a reversible transformation between these same states $A$ and $B$.
But that's not all.

Consider a cycle consisting of an irreversible go transformation $(I)$ from $A$ to $B$,
and a reversible return transformation $(II)$ from $B$ to $A$. According to Clausius' relation for an irreversible cycle:
\begin{align*}
\oint\frac{\delta Q_{irr}}{T_{source}}&<0\\
\int_{A\,(I)}^{B}\frac{\delta Q_{irr}}{T_{source}}+\int_{B\,(II)}^{A}\frac{\delta Q_{rev}}{T_{source}}&<0\\
\int_{B\,(II)}^{A}\frac{\delta Q_{rev}}{T_{source}}&<-\int_{A\,(I)}^{B}\frac{\delta Q_{irr}}{T_{source}}\\
-\int_{B\,(II)}^{A}\frac{\delta Q_{rev}}{T_{source}}&>\int_{A\,(I)}^{B}\frac{\delta Q_{irr}}{T_{source}}\\
\int_{A}^{B\,(II)}\frac{\delta Q_{rev}}{T_{source}}&>\int_{A\,(I)}^{B}\frac{\delta Q_{irr}}{T_{source}}\\
S_B-S_A&>\int_{A\,(I)}^{B}\frac{\delta Q_{irr}}{T_{source}}
\end{align*}
which is written in differential form:
\begin{empheq}[box=\mybox]{align*}
dS>\frac{\delta Q_{irr}}{T_{source}}
\end{empheq}
We have,
\begin{empheq}[box=\mybox]{align*}
S_B-S_A=\int_{A\,(I)}^{B}\frac{\delta Q_{irr}}{T_{source}}+\text{a positive term}
\end{empheq}
The positive term tends to zero as the transformation approaches reversibility.
It thus measures the degree of irreversibility of the transformation. It is called \emph{irreversible entropy} and denoted $S_i$.

$\delta Q_{irr}$ being a thermal energy exchange between the system and the sources,
the term $\int\frac{\delta Q_{irr}}{T_{source}}$ is also an exchange.
It is called \emph{exchange entropy}, and denoted $S_e$:
\begin{empheq}[box=\mybox]{align*}
S_{e_{A\to B}}\triangleq \int_{A}^{B}\frac{\delta Q_{irr}}{T_{source}}
\end{empheq}
With these notations, we have:
\begin{empheq}[box=\mybox]{align*}
\Delta S=S_e+S_i
\end{empheq}
where, whatever the transformation, $S_i>0$.

\section{Entropy Increase of an Isolated System}
Let an isolated system, $\delta Q_{irr}=0$, evolving from an initial state $A$ to a final state $B$:
\begin{align*}
\int_{A}^{B}\frac{\delta Q_{irr}}{T_{source}}&=0\\
S_e&=0
\end{align*}
\begin{empheq}[box=\mybox]{align*}
\Delta S=S_i
\end{empheq}
The entropy of an isolated system increases with time.
Irreversible entropy is thus created in the system, since it is isolated. The universe being an isolated system, Clausius states:

\emph{The energy of the universe is constant.}
\emph{The entropy of the universe tends toward a maximum.}

The first law of thermodynamics is a conservation principle, the second law is an evolution principle.
The first law does not allow deciding if an irreversible, thus real, transformation is possible or not.
For it to be, the entropy of the global system (in other words, of the universe) must increase.

\chapter{Appendices}\label{annexes}
\section{Differential of a Function of One Variable}
Let $f$ be a function of the variable $x$, differentiable at a point $x_0$ of its domain of definition.
For a small but finite variation $\Delta x$ of the variable $x$ from $x_0$, the function $f$ undergoes the variation
\begin{equation*}
\Delta f=f(x_0+\Delta x)-f(x_0)
\end{equation*}
\begin{defi}{Derivative}{}
The derivative at the point $(f(x_0),x_0)$ of the function $f$ is defined by:
\begin{align*}
f'(x_0)&\triangleq \lim_{\Delta x\to 0}\frac{\Delta f}{\Delta x}\\
&=\lim_{\Delta x\to 0}\frac{f(x_0+\Delta x)-f(x_0)}{\Delta x}
\end{align*}
\end{defi}
\begin{rmq}{}{}
$f'(x_0)$ is a number, it is the ratio of the height $f(x_0+\Delta x)-f(x_0)$ to the width $\Delta x$.
It is therefore the tangent of the angle that the tangent to the function $f$ at the point $(f(x_0),x_0)$ makes with the horizontal.
\end{rmq}
For a small but finite variation $\Delta x$ (this $\Delta x$ is not the same as the one tending to zero in the derivative)
\begin{align*}
\frac{\Delta f}{\Delta x}&=f'(x_0)+\epsilon(\Delta x)\\
\Delta f&=f'(x_0)\Delta x+\Delta x\,\epsilon(\Delta x)
\end{align*}
where $\epsilon$ is a function of $\Delta x$ that tends to zero when $\Delta x$ tends to zero.
$f'(x_0)$ being a number, the first term is linear in $\Delta x$.

When $\Delta x$ tends to zero (cf.~diagram \ref{diff})
\begin{align*}
\lim_{\Delta x\to 0}\Delta f&=f'(x_0)\lim_{\Delta x\to 0}\Delta x+\lim_{\Delta x\to 0}[\Delta x\,\epsilon(\Delta x)]\\
f(x_0+\dd x)-f(x_0)&=f'(x_0)\dd x+\dd x\,\epsilon(\dd x)
\end{align*}
The second term of the right member tends to zero faster than the first because the function $\epsilon(\Delta x)$ also tends to zero with $\Delta x$.
The first term is then the principal term.

\begin{defi}{Differential}{}
The differential at the point $(f(x_0),x_0)$ of the function $f$ is defined by:
\begin{equation*}
\dd f(x_0)\triangleq f'(x_0)\dd x
\end{equation*}
where Leibniz's notation \guillemotleft d\guillemotright\ means differential or small difference.
\end{defi}
So that we have
\begin{equation*}
f(x_0+\dd x)-f(x_0)=\dd f(x_0)+\dd x\,\epsilon(\dd x)
\end{equation*}
$\dd f(x_0)$ is the part linear in dx of the increase of the function $f$ between points $x_0$ and $x_0+dx$,
that is, the first-order linear approximation of the function $f$ at point $x_0$
\begin{align*}
f(x_0+\dd x)-f(x_0)&\approx \dd f(x_0)\\
f(x_0+\dd x)&\approx f(x_0)+\dd f(x_0)
\end{align*}

\begin{figure}[H]
\begin{pspicture}(0,-.6)(5,6)
%\psframe(0,-.6)(5,6)
\psline{->}(0,0)(5,0)
\psline{->}(0,0)(0,6)
\rput(5,-.3){$x$}
\rput(-.5,6){$f(x)$}
\rput(-1.2,3.8){$f(x_0+\dd x)$}
\rput(-.6,2){$f(x_0)$}
\rput(1,-.3){$x_0$}
\rput(3.2,-.3){$x_0+\dd x$}
\put(3.8,4.2){$\dd x\,\epsilon(\dd x)$}
\put(3.6,3.2){$\dd f(x_0)$}
\rput(-.2,-.2){$O$}
\SpecialCoor
\psplot{.5}{3.2}{x 3 mul x 1.5 exp sub}
\psline[linestyle=dotted](1,0)(1,2)
\psline[linestyle=dotted](3,0)(3,5)
\psline[linestyle=dotted](0,2)(3,2)
\psline[linestyle=dotted](0,3.804)(3,3.804)
\psline[linecolor=red](1,2)(3,5)
\psline{<->}(3.4,2)(3.4,5)
\psline{<->}(3.6,3.8)(3.6,5)
\end{pspicture}
\caption{Differential $\dd f(x_0)$ of the function $f$ at point $x_0$}
\label{diff}
\end{figure}

In physics, the expression \guillemotleft exact total differential\guillemotright\ is none other than
the differential encountered in mathematics.

\pagebreak[4]
\section{Differential of a Function of Two Variables}
Let $f(x,y)$ be a function of the two independent variables $x$ and $y$, then:
\begin{align*}
\dd f(x,y)&=\lim_{\dd x,\dd y\to0}f(x+\dd x,y+\dd y)-f(x,y)\\
&=\lim_{\dd x,\dd y\to0}[f(x+\dd x,y+\dd y)-f(x,y+\dd y)+f(x,y+\dd y)]-f(x,y)\\
&=\lim_{\dd x\to0}f(x+\dd x,y+\dd y)-f(x,y+\dd y)+\lim_{\dd y\to0}f(x,y+\dd y)-f(x,y)\\
&=\lim_{\dd x\to0}\frac{f(x+\dd x,y+\dd y)-f(x,y+\dd y)}{\dd x}\,\dd x+\lim_{\dd y\to0}\frac{f(x,y+\dd y)-f(x,y)}{\dd y}\,\dd y\\
&=\frac{\partial f}{\partial x}\,\dd x+\frac{\partial f}{\partial y}\,\dd y
\end{align*}
where $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ are the components of the vector field gradient
$\grad\,f$.
\section{Conditions for Obtaining a Differential}
\subsection{Case of Functions of Two Variables}

Let $\textbf{V}(x,y)$ be a vector field. We can associate with it the following differential form:
\begin{equation*}
V_{x}(x,y)\dd x+V_{y}(x,y)\dd y
\end{equation*}
This differential form is said to be total,
because for each of the variables $x$ and $y$ of $V$ appears the corresponding differential element, $\dd x$ and $\dd y$.
Is this differential form exact, in other words,
is it the differential of a function\footnote{Michel Hulin, \emph{Thermodynamique}, Dunod edition 1994.}~?

Let $g(x,y)$ be this function, then it is necessary and sufficient that:
\begin{align*}
V_{x}(x,y)&=\frac{\partial g(x,y)}{\partial x}\\
V_{y}(x,y)&=\frac{\partial g(x,y)}{\partial y}
\end{align*}
Therefore, it is necessary and sufficient that the vector field $\textbf{V}(x,y)$ be the gradient of the function $g(x,y)$:
\begin{equation*}
\textbf{V}(x,y)=\grad\,g(x,y)
\end{equation*}
If this is indeed the case, then the differential form constitutes
a differential (called exact total in thermodynamics), and,
\begin{equation*}
V_{x}(x,y)\dd x+V_{y}(x,y)\dd y=\dd g(x,y)
\end{equation*}
\begin{theo}{Schwarz Condition}{}

A necessary and sufficient condition for the differential form $V_{x}(x,y)\dd x+V_{y}(x,y)\dd y$ to be a differential
(exact total) is:
\begin{empheq}[box=\myboxtheo]{align*}
\frac{\partial V_{x}(x,y)}{\partial y}-\frac{\partial V_{y}(x,y)}{\partial x}=0
\end{empheq}
\end{theo}
\begin{proof}
Let $dg(x,y)$ be the sought (exact total) differential, first show that:
\begin{equation*}
V_{x}(x,y)\dd x+V_{y}(x,y)\dd y=\dd g(x,y)\quad \Rightarrow\quad \frac{\partial V_{x}(x,y)}{\partial y}-\frac{\partial V_{y}(x,y)}{\partial x}=0
\end{equation*}
We have,
\begin{align*}
\dd g(x,y)&=\frac{\partial g(x,y)}{\partial x}\,\dd x+\frac{\partial g(x,y)}{\partial y}\,\dd y\\
&=V_{x}(x,y)\dd x+V_{y}(x,y)\dd y
\end{align*}
The variables $x$ and $y$ being independent, we can equate the respective coefficients that are
before the differentials $\dd x$ and $\dd y$,
\begin{align*}
V_{x}(x,y)&=\frac{\partial g(x,y)}{\partial x}\\
V_{y}(x,y)&=\frac{\partial g(x,y)}{\partial y}
\end{align*}
Therefore,
\begin{align*}
\frac{\partial V_{x}(x,y)}{\partial y}&=\frac{\partial^{2} g(x,y)}{\partial x\partial y}\\
\frac{\partial V_{y}(x,y)}{\partial x}&=\frac{\partial^{2} g(x,y)}{\partial y\partial x}
\end{align*}
If the second-order partial derivatives of $g(x,y)$ are continuous, then the order of derivation does not matter:
\begin{align}
\frac{\partial^{2} g(x,y)}{\partial x\partial y}&=\frac{\partial^{2} g(x,y)}{\partial y\partial x}\notag\\
\frac{\partial V_{x}(x,y)}{\partial y}&=\frac{\partial V_{y}(x,y)}{\partial x}\label{dvxdvy}
\end{align}
Now show that,
\begin{equation*}
\frac{\partial V_{x}(x,y)}{\partial y}-\frac{\partial V_{y}(x,y)}{\partial x}=0\quad \Rightarrow\quad  V_{x}(x,y)\dd x+V_{y}(x,y)\dd y=\dd g(x,y)
\end{equation*}
Set:
\begin{align*}
g(x,y)-g(x_1,y_1)&=\int_{(x_1,y_1)}^{(x,y)}\dd g(x,y)\\
&=\int_{(x_1,y_1)}^{(x,y)}\left[ V_{x}(x,y)\dd x+ V_{y}(x,y)\dd y\right]
\end{align*}
If condition~\eqref{dvxdvy} is verified, then the integral does not depend on the followed path.
To demonstrate this, we need Green's theorem:
\begin{theo}{Green's Theorem}{}

Let $D$ be a closed domain in the $xy$ plane bounded by a simple closed curve $C$.
If $M(x,y)$ and $N(x,y)$ are continuous functions of $x$ and $y$ having continuous derivatives in $D$, then,
\begin{empheq}[box=\myboxtheo]{align*}
\oint_{C}\left( M\dd x+N\dd y\right)=\iint_{D}\left( \frac{\partial N}{\partial x}-\frac{\partial M}{\partial y}\right)\dd x\dd y
\end{empheq}
where $C$ is traversed counterclockwise.
\end{theo}
Green's theorem will not be proven.
Applying this theorem for $V_{x}=M$ and $V_{y}=N$, we have:
\begin{align*}
\oint_{C}\left( V_{x}\dd x+V_{y}\dd y\right)&=\iint_{D}\left( \frac{\partial V_{y}}{\partial x}-\frac{\partial V_{x}}{\partial y}\right)\dd x\dd y\\
\oint_{ABCDA}\left( V_{x}\dd x+V_{y}\dd y\right)&=0\\
\int_{ABC}\left( V_{x}\dd x+V_{y}\dd y\right)+\int_{CDA}\left( V_{x}\dd x+V_{y}\dd y\right)&=0\\
\int_{ABC}\left( V_{x}\dd x+V_{y}\dd y\right)&=\int_{ADC}\left( V_{x}\dd x+V_{y}\dd y\right)
\end{align*}
the integral to go from $A$ to $C$ is therefore independent of the followed path. Therefore,
\begin{align*}
g(x,y)-g(x_1,y_1)=&\int_{(x_1,y_1)}^{(x,y_1)}\left[ V_{x}(x,y)\dd x+ V_{y}(x,y)\dd y\right]\\
&\qquad\qquad+\int_{(x,y_1)}^{(x,y)}\left[ V_{x}(x,y)\dd x+ V_{y}(x,y)\dd y\right]\\
=&\int_{x_1}^{x}V_{x}(x,y_1)\dd x+\int_{y_1}^{y}V_{y}(x,y)\dd y
\end{align*}
from which,
\begin{align*}
\frac{\partial g(x,y)}{\partial y}&=\frac{\partial}{\partial y}\left[ \int_{x_1}^{x}V_{x}(x,y_1)\dd x+\int_{y_1}^{y}V_{y}(x,y)\dd y\right]\\
&=V_{y}(x,y)
\end{align*}
and,
\begin{align*}
\frac{\partial g(x,y)}{\partial x}&=\frac{\partial}{\partial x}\left[ \int_{x_1}^{x}V_{x}(x,y_1)\dd x+\int_{y_1}^{y}V_{y}(x,y)\dd y\right]\\
&=V_{x}(x,y_1)+\int_{y_1}^{y}\frac{\partial V_{y}(x,y)}{\partial x}\,\dd y\\
&=V_{x}(x,y_1)+\int_{y_1}^{y}\frac{\partial V_{x}(x,y)}{\partial y}\,\dd y\\
&=V_{x}(x,y_1)+V_{x}(x,y)-V_{x}(x,y_1)\\
&=V_{x}(x,y)
\end{align*}
The differential form is therefore a total differential:
\begin{align*}
V_{x}(x,y)\dd x+V_{y}(x,y)\dd y&=\frac{\partial g(x,y)}{\partial x}\,\dd x+\frac{\partial g(x,y)}{\partial y}\,\dd y\\
&=\dd g(x,y)
\end{align*}
\end{proof}
\subsection{Case of Functions of Three Variables}

For the differential form $V_{x}(x,y,z)\dd x+V_{y}(x,y,z)\dd y+V_{z}(x,y,z)\dd z$
to be an e.t.d., it is necessary and sufficient that:
\begin{equation*}
\begin{dcases}
V_{x}(x,y,z)=\frac{\partial h(x,y,z)}{\partial x}\\
V_{y}(x,y,z)=\frac{\partial h(x,y,z)}{\partial y}\\
V_{z}(x,y,z)=\frac{\partial h(x,y,z)}{\partial z}
\end{dcases}
\end{equation*}
in other words, it is necessary and sufficient that the vector $\textbf{V}(x,y,z)$ be the gradient of the function $h(x,y,z)$:
\begin{equation*}
\textbf{V}(x,y,z)=\grad\,h(x,y,z)
\end{equation*}
\begin{theo}{Schwarz Condition}{}

A NCS for the differential form $V_{x}(x,y,z)\dd x+V_{y}(x,y,z)\dd y+V_{z}(x,y,z)\dd z$
to be a differential (exact total) is:
\begin{empheq}[box=\myboxtheo]{align*}
\begin{dcases}
\frac{\partial V_{z}(x,y,z)}{\partial y}-\frac{\partial V_{y}(x,y,z)}{\partial z}=0\\
\frac{\partial V_{x}(x,y,z)}{\partial z}-\frac{\partial V_{z}(x,y,z)}{\partial x}=0\\
\frac{\partial V_{y}(x,y,z)}{\partial x}-\frac{\partial V_{x}(x,y,z)}{\partial y}=0
\end{dcases}
\end{empheq}
\end{theo}
Note that the curl of V(x,y,z) is zero:
\begin{equation*}
\curl\,\textbf{V}(x,y,z)=\textbf{0}
\end{equation*}
This theorem allows understanding why the vector field $\textbf{V}(x,y,z)$
having three coordinates can be written using the gradient of a single scalar $h$.
Its three coordinates must be linked by the three previous relations.
It is this dependence of the coordinates that is used to write $\textbf{V}(x,y,z)$ in the form of a gradient.
\subsection{Integrating Factor}

Let a vector field $\textbf{V}(x,y,z)$ such that $\curl\,\textbf{V}(x,y,z)\neq\textbf{0}$.
The differential form associated with it,
\begin{equation*}
V_{x}(x,y,z)\dd x+V_{y}(x,y,z)\dd y+V_{z}(x,y,z)\dd z
\end{equation*}
is therefore not a differential (exact total).

Is there a scalar function $\mu(x,y,z)$ such that $\textbf{V}/\mu$ is the gradient of a function,
and consequently such that,
\begin{equation*}
\frac{V_{x}}{\mu}\,\dd x+\frac{V_{y}}{\mu}\,\dd y+\frac{V_{z}}{\mu}\,\dd z
\end{equation*}
is an e.t.d.~?

If so, we say that $\mu$ is an integrating factor for the initial differential form.

$\textbf{V}/\mu$ is the gradient of a function iff its curl is zero:
\begin{align*}
\curl\left(\frac{\textbf{V}}{\mu}\right)&=\frac{1}{\mu}\,\curl\,\textbf{V}
+\grad\left(\frac{1}{\mu}\right)\times\textbf{V}\\
&=\textbf{0}
\end{align*}
from which,
\begin{equation*}
\curl\,\textbf{V}=-\mu\,\grad\left(\frac{1}{\mu}\right)\times\textbf{V}
\end{equation*}
which implies that $\curl\,\textbf{V}$ is perpendicular to $\textbf{V}$:
\begin{equation*}
\textbf{V}\cdot\curl\,\textbf{V}=0
\end{equation*}
This relation constitutes a necessary and sufficient condition for the existence of a function that is an integrating factor.
\begin{rmq}{}{}
For two-dimensional vector fields $\textbf{V}(x,y)$, we have:
\begin{align*}
\textbf{V}
\begin{pmatrix}
V_{x}(x,y)\\
V_{y}(x,y)\\
0
\end{pmatrix}
\cdot\curl\,\textbf{V}
\begin{pmatrix}
0\\
0\\
\frac{\partial V_{y}(x,y)}{\partial x}-\frac{\partial V_{x}(x,y)}{\partial y}
\end{pmatrix}
=0
\end{align*}
Therefore, there always exists an integrating factor for two-dimensional vector fields.
\end{rmq}
\begin{rmq}{}{}
Let a vector field $\textbf{V}$ such that its differential form,
\begin{equation*}
V_{x}(x,y,z)\dd x+V_{y}(x,y,z)\dd y+V_{z}(x,y,z)\dd z
\end{equation*}
is not an exact total differential.
If we have been able to associate an integrating factor $\mu$ with it, we have:
\begin{equation*}
\frac{\textbf{V}}{\mu}=\grad\,f(x,y,z)
\end{equation*}
or again,
\begin{equation*}
\dd f=\frac{V_{x}}{\mu}\,\dd x+\frac{V_{y}}{\mu}\,\dd y+\frac{V_{z}}{\mu}\,\dd z
\end{equation*}
Let $g(x,y,z)$ be a function of the function $f(x,y,z)$:
\begin{align*}
g&=F(f)\\
\frac{\dd g}{\dd f}&=F'\\
\dd g&=F'\dd f\\
&=\frac{V_{x}F'}{\mu}\,\dd x+\frac{V_{y}F'}{\mu}\,\dd y+\frac{V_{z}F'}{\mu}\,\dd z
\end{align*}
From the integrating factor $\mu$ we find the e.t.d. df, then from it we find $f$.
We construct a function $F$ of $f$, which we differentiate. We thus obtain a family of integrating factors
$\mu/F'$ of the initial differential form.
\end{rmq}
\end{document}
