Why is a multivariable function satisfying the following conditions exact? I read this section in the book "Mathematics Methods for Physics and Engineering"

Determining whether a differential containing many variable $x_1,x_2,...,x_n$
exact is a simple extension of the above. A differential containing many variables can be written in general as
$$df=\Sigma^n_{i=1}g_i(x_1,x_2,...,x_n)dx_i$$
and the function will be exact if
$\frac{\partial g_i}{\partial x_j}=\frac{\partial g_j}{\partial x_i}$ for all pairs of i and n.

I can understand the situation when there are only two variables in the function, but when there are many variables, I am a bit confused about why this condition is already necessary  to prove that the function is exact, instead of requiring all partial derivatives of the function to be equal.
 A: *

*By definition, an exact differential one form
$$
\omega=\sum^n_{i=1}g_i(x_1,x_2,...,x_n)\,dx_i
$$
arises from a function, aka $0$-form, $f$ by exterior differentiation $\omega=df\,.$


*Saying that the differential $\omega$ is exact amounts to showing that the function $f$ exists. Writing the differential from the beginning as $df$ is therefore confusing.


*The reason for this confusion is imho that the authors Riley, Hobson & Bence are trying to avoid the language of differential forms and mention the above result without proof or reference.


*By the Poincare lemma it is enough to show that $\omega$ is closed which means that
$d\omega=0\,.$


*By the exterior differential calculus rules,
\begin{eqnarray}
d\omega&=\sum^n_{i,j=1} \partial_j g_i(x_1,x_2,...,x_n)\,dx_j\wedge dx_i
\end{eqnarray}
which is zero because $\partial_j g_i$ is symmetric in $i,j$ and $dx_j\wedge dx_i$ is antisymmetric.


*In order that the Poincare lemma is applicable we need to assume that the domain of the $g_i$ functions is simply connected.


*Examples of inexact differentials arise in Thermodynamics: change in heat $Q$ and change in work $W$ and are usually denoted by
$\delta Q$ and $\delta W$ following Carl Gottfried Neumann. The first law of thermodynamics is then
$$
dU=\delta Q-\delta W
$$
where $U$ is the internal energy and has an exact differential.
A: The author shouldn't write $df$ there. Suppose $\Omega \subset \mathbb{R}^n$ is an open set. A one form is an object of the form
$$\omega = \sum_{i = 1}^{n}g_i(x)\,dx_i,$$
where each $g_i \in C^{\infty}(\Omega, \mathbb{R})$. The one-form $\omega$ is said to be exact if there exists a smooth function $f \in C^{\infty}(\Omega, \mathbb{R})$ such that
$$df := \sum_{i = 1}^{n}\frac{\partial f}{\partial x_i}dx_i = \omega.$$
The above equation is equivalent to
$$g_i = \frac{\partial f}{\partial x_i} \text{ for } i = 1, \dots, n.$$
Now if $\omega$ is exact, meaning that the above holds, then
$$\frac{\partial g_i}{\partial x_j} = \frac{\partial^2 f}{\partial x_i \partial x_j} = \frac{\partial^2 f}{\partial x_j \partial x_i} = \frac{\partial g_j}{\partial x_i}.$$
So exactness implies $\frac{\partial g_i}{\partial x_j} = \frac{\partial g_j}{\partial x_i}$ for $i, j \in \{1, \dots, n\}$. However, the converse is not true in general. It is true when $\Omega$ is simply connected though, which means roughly that any smooth closed curve in $\Omega$ is smoothly homotopic to a point through a family of closed curves.
