1 Introduction

Suppose that a small thermodynamic system contacts with a heat bath of temperature T. For equilibrium cases, microscopic states obey a canonical distribution. Dynamical properties of the system are described by stochastic processes with the detailed balance condition or by projected dynamics of the system from the Hamiltonian dynamics of the total system containing the heat bath. The transition from an equilibrium state to another equilibrium state is caused by a time-dependent parameter. Even for small systems without the thermodynamic limit, thermodynamic concepts such as the first law and the second law are formulated together with incorporating fluctuation properties [1,2,3].

We study N-interacting identical particles whose Hamiltonian is given by \(H(\Gamma ;{{\mathcal {C}}})\) with a microscopic coordinate \(\Gamma \) and a set of parameters \({{\mathcal {C}}}\) describing a system configuration. A typical example of \({{\mathcal {C}}}\) is (VN), which represents a condition that N particles are completely confined in a region of volume V. The equilibrium state is given by the canonical distribution

$$\begin{aligned} \rho _\beta (\Gamma ;{{\mathcal {C}}})=\frac{1}{Z(T,{{\mathcal {C}}})} \exp (-\beta H(\Gamma ;{{\mathcal {C}}})), \end{aligned}$$
(1)

where \(\beta \equiv 1/(k_{\mathrm{B}}T)\) with the Boltzmann constant \(k_{\mathrm{B}}\) and the partition function \(Z(T,{{\mathcal {C}}})\) is given by

$$\begin{aligned} Z(T,{{\mathcal {C}}})=\int d\Gamma \exp (-\beta H(\Gamma ;{{\mathcal {C}}})) \end{aligned}$$
(2)

from the normalization condition \(\int d\Gamma \rho _\beta (\Gamma ;{{\mathcal {C}}})=1\). We then define the free energy \(F(T,{{\mathcal {C}}})\) of this system from the following two prerequisites. First, for any \({{\mathcal {C}}}_0\) and \({{\mathcal {C}}}_1\), the free energy difference \(F(T,{{\mathcal {C}}}_1)-F(T, {{\mathcal {C}}}_0)\) is equal to the quasi-static work from \({{\mathcal {C}}}_0\) to \({{\mathcal {C}}}_1\). Because the latter is expressed by the partition function, the first condition is expressed as

$$\begin{aligned} F(T,{{\mathcal {C}}}_1)-F(T, {{\mathcal {C}}}_0) = -k_{\mathrm{B}}T [\log Z(T, {{\mathcal {C}}}_1) - \log Z(T, {{\mathcal {C}}}_0)]. \end{aligned}$$
(3)

See Sec. 2.2 for the derivation. The second condition is that \(F(T,{{\mathcal {C}}})\) satisfies the Gibbs-Helmholtz relation:

$$\begin{aligned} E= \frac{\partial (\beta F)}{\partial \beta }, \end{aligned}$$
(4)

where E is the expectation of \(H(\Gamma ;{{\mathcal {C}}})\). We emphasize that these prerequisites are standard in the thermodynamic definition of free energy.

As the simplest configuration, we consider the case where N-interacting identical particles are confined in a cuboid container of volume V. The partition function and the free energy of this system are denoted by Z(TVN) and F(TVN). It has been known that (3) and (4) lead to

$$\begin{aligned} F(T,V,N)=-k_{\mathrm{B}}T [\log Z(T,V,N)-\bar{\phi }(N)] \end{aligned}$$
(5)

with a function \(\bar{\phi }(N)\). See Sec. 2.2 for a review of the derivation. If we end the argument to this point, \(\bar{\phi }(N)\) remains an arbitrary function that is not observed in experiments. However, using (3) for a quasi-static decomposition process, we can derive

$$\begin{aligned} \bar{\phi }(N)= \log N! +c_0 N, \end{aligned}$$
(6)

where \(c_0\) is an arbitrary constant. This is the main claim of this paper. Substituting (6) into (5), we obtain

$$\begin{aligned} F(T,V,N)= -k_{\mathrm{B}}T \left[ \log \frac{Z(T,V,N)}{N!} -c_0 N \right] . \end{aligned}$$
(7)

The formula (7) has been explained in standard textbooks of statistical mechanics. If the system is described by quantum mechanics, the free energy is defined as

$$\begin{aligned} F\equiv \mathrm{Tr}[\hat{\rho }_\beta {\hat{H}}] +k_{\mathrm{B}}T \mathrm{Tr}[\hat{\rho }_\beta \log \hat{\rho }_\beta ] \end{aligned}$$
(8)

using the density matrix \(\hat{\rho }_\beta ({{\mathcal {C}}})\) with a Hamiltonian \({\hat{H}}({{\mathcal {C}}})\). For N-interacting identical particles, the classical limit of F leads to (7) with \(c_0= 3\log h\), where h is the Planck constant. However, when \(\hat{\rho }_\beta \) and \({\hat{H}}\) in (8) are replaced by \(\rho _\beta (\Gamma ;{{\mathcal {C}}})\) and \(H(\Gamma ;{{\mathcal {C}}})\), (8) becomes (7) without N!. From this fact, one may understand that N!, which we call the Gibbs factorial, comes from quantum mechanics. We understand that this interpretation is not logically correct, because it might be possible that the definition of F in (8) is not valid. There are several approaches characterizing the Gibbs factorial in classical systems [4,5,6,7,8,9,10]. Our argument stands on a general principle that thermodynamic quantities are defined by experimentally measurable quantities. That is, whether or not N! appears in the formula should be determined by thermodynamic considerations. This viewpoint has been repeatedly explained in the literature [4, 5].

To determine the functional form of \(\bar{\phi }(N)\) based on (3), one might be tempted to assume that a quasi-static decomposition process can be achieved by inserting a separating wall slowly. If the decomposition were possible without work as assumed in macroscopic thermodynamics, (3) could lead to

$$\begin{aligned} F(T, \lambda V, \lambda N)+ F(T, (1-\lambda ) V, (1-\lambda ) N) -F(T,V,N)=0 \end{aligned}$$
(9)

for any N and \(\lambda \) such that \(\lambda N\) is an integer. The combination of (5) with (9) gives

$$\begin{aligned} \bar{\phi }(N)= N \log N +c_1 N, \end{aligned}$$
(10)

as shown in Sec. 2.3, where \(c_1\) is an arbitrary constant. Here, (10) is consistent with (6) when o(N) terms are ignored in the thermodynamic limit \(N \rightarrow \infty \) and \(V \rightarrow \infty \) with V/N fixed, while (10) is not equal to (6) for finite N cases. The correct statement is that (9) is valid only in the thermodynamic limit. Thus, the Gibbs factorial N! for macroscopic systems is understood by thermodynamic considerations, but (6) has not been derived from (3) for finite N cases.

The difference between (6) and (10) has been studied from the viewpoint of information thermodynamics [10]. Indeed, one can quickly insert a separating wall after measuring the particle number in the left region of the volume \(\lambda V\). Then, the free energy associated with measurement-and-feedback appears on the right-hand side of (9). The form of \(\bar{\phi }(N)\), taking account of this contribution, is found to be (6), not (10). This argument provides the operational foundation of (7). Therefore, the Gibbs factorial N! would be derived only from quasi-static works if the quasi-static process corresponding to the free energy obtained by measurement-and-feedback is constructed.

Concerning the last point, in Ref. [11], it is claimed that such a quasi-static process exists, but the process is not explicitly shown. In the present paper, we construct a quasi-static decomposition process using a special confining potential. We note that another decomposition process along the argument in Ref. [11] is also presented in Ref. [12].

Here, it should be noted that for a system consisting of identical particles, the symmetry of the Hamiltonian for any permutation of particle indexes plays an essential role in the calculation of the quasi-static work. In contrast, when two types of particles, A and B, are mixed, the Gibbs factorial becomes \(N_A!N_B!\), where \(N_A\) and \(N_B\) are the numbers of particles of type A and B, respectively. In addition to the quasi-static decomposition, the separation of different types of particles is conducted using a semi-permeable wall under the assumption that the semi-permeable wall can be prepared for any type described in the Hamiltonian.

The remainder of the paper is organized as follows. In Sec. 2, we describe the setup of our study. We then derive (3), (5), and (10) as a review. In Sec. 3, we derive the main result (6). In Sec. 4, we study binary mixtures and clarify how the Gibbs factorial is modified from simple systems. In Sec. 5, we briefly comment on the other approaches presented in Refs. [6,7,8,9]. We also consider quantum systems from the viewpoint of quasi-static decomposition.

2 Preliminaries

2.1 Setup

We study N-interacting particles confined in a cuboid region D with \(|D|=V\), where |D| represents the volume of the region D. Let \(({\varvec{r}}_i, {\varvec{p}}_i) \in {\mathbb {R}}^6\) be the position and momentum of i-th particle. The phase space coordinate \(\Gamma \) of the system is then given by

$$\begin{aligned} \Gamma =({\varvec{r}}_1, {\varvec{r}}_2, \ldots , {\varvec{r}}_{N}, {\varvec{p}}_1, {\varvec{p}}_2, \ldots , {\varvec{p}}_{N}). \end{aligned}$$
(11)

We assume the Hamiltonian of the system as

$$\begin{aligned} H_0(\Gamma ) =\sum _{i=1}^{N} \frac{|{\varvec{p}}_i|^2}{2m} +\sum _{i < j} V_{\mathrm{int}}( |{\varvec{r}}_i-{\varvec{r}}_j|), \end{aligned}$$
(12)

where \(V_{\mathrm{int}}\) represents a short-range interaction between two particles. For simplicity, we assume that there exists a microscopic length \(\xi \) such that \(V_{\mathrm{int}}(r)=0\) for \(r \ge \xi \).

To describe confinement of the N particles into the region D, we introduce a wall potential

$$\begin{aligned} V_{\mathrm{wall}} ({\varvec{r}};D,\kappa )= \frac{\kappa }{2} |d({\varvec{r}},D)|^2 \end{aligned}$$
(13)

with

$$\begin{aligned} d({\varvec{r}},D)= \inf _{{\varvec{r}}' \in D} |{\varvec{r}}-{\varvec{r}}'|, \end{aligned}$$
(14)

which indicates the distance between a point \({\varvec{r}}\) and the region D. The parameter \(\kappa \) in (13) represents the strength of confinement. We express the total Hamiltonian as

$$\begin{aligned} H(\Gamma ;D,{N,\kappa }) =H_0(\Gamma )+\sum _{i=1}^{N} V_\mathrm{wall}({\varvec{r}}_i;D,\kappa ). \end{aligned}$$
(15)

The canonical distribution for this Hamiltonian is given by

$$\begin{aligned} \rho _\beta (\Gamma ;D,{N, \kappa })=\frac{1}{Z(T,{D,N,\kappa })} \exp (-\beta H(\Gamma ;D,{N,\kappa })) \end{aligned}$$
(16)

with the partition function

$$\begin{aligned} Z(T,{D,N,\kappa })=\int d\Gamma \exp (-\beta H(\Gamma ;D,{N,\kappa })), \end{aligned}$$
(17)

In the hard wall limit \(\kappa \rightarrow \infty \), recalling \(|D|=V\), we have the standard partition function

$$\begin{aligned} Z(T,V,N)&= \lim _{\kappa \rightarrow \infty } Z(T,{D,N,\kappa }), \end{aligned}$$
(18)
$$\begin{aligned}&= \int d \Gamma \exp (-\beta H_0(\Gamma ))\prod _{i=1}^{N}\chi ({\varvec{r}}_{i} \in D), \end{aligned}$$
(19)

where \(\chi ({{\mathcal {A}}})=1\) if \({{\mathcal {A}}}\) is true, otherwise \(\chi ({{\mathcal {A}}})=0\).

More generally, \(V_{\mathrm{con}}(\Gamma ;{{\mathcal {C}}})\) denotes a general confining potential described by a set of parameters \({{\mathcal {C}}}\). We then write

$$\begin{aligned} H(\Gamma ;{{\mathcal {C}}}) =H_0(\Gamma )+V_{\mathrm{con}}(\Gamma ;{{\mathcal {C}}}). \end{aligned}$$
(20)

The canonical distribution and the partition function of this system are given by (1) and (2). Thermodynamic processes are described by time-dependence of \({{\mathcal {C}}}\) that describes a system configuration. In particular, for any \({{\mathcal {C}}}_0\) and \(\mathcal{C}_1\), a quasi-static process connecting them is represented by a one-parameter continuous family \({{\mathcal {C}}}_\alpha \), where \(0 \le \alpha \le 1\), which forms a path in the parameter space. The quasi-static work done in this process is defined by

$$\begin{aligned} W ({{\mathcal {C}}}_0 \rightarrow {{\mathcal {C}}}_1) = \int _0^1 d\alpha \int d \Gamma \rho _\beta (\Gamma ;{{\mathcal {C}}}_\alpha ) \frac{\partial H(\Gamma ;\mathcal{C}_\alpha )}{\partial \alpha }. \end{aligned}$$
(21)

2.2 Derivation of (3) and (5)

We substitute (1) into the right-hand side of (21), and then calculate it as

$$\begin{aligned} W ({{\mathcal {C}}}_0 \rightarrow {{\mathcal {C}}}_1)&= -k_{\mathrm{B}}T \int _0^1 d\alpha \frac{1}{Z(T;{{\mathcal {C}}}_\alpha )} \int d\Gamma \frac{\partial }{\partial \alpha } \exp (-\beta H(\Gamma ;{{\mathcal {C}}}_\alpha )) \nonumber \\&= -k_{\mathrm{B}}T \int _0^1 d\alpha \frac{\partial }{\partial \alpha } \log Z(T;{{\mathcal {C}}}_\alpha ) \nonumber \\&= -k_{\mathrm{B}}T [\log Z(T;{{\mathcal {C}}}_1)-\log Z(T;{{\mathcal {C}}}_0)]. \end{aligned}$$
(22)

From the condition that the free energy difference is equal to \(W({{\mathcal {C}}}_0 \rightarrow {{\mathcal {C}}}_1)\), we obtain (3).

As a special case, we consider the system with a confining potential

$$\begin{aligned} V_{\mathrm{con}}(\Gamma ;{D,N,\kappa })= \sum _{i=1}^{N} V_\mathrm{wall}({\varvec{r}}_i;D,{\kappa }). \end{aligned}$$
(23)

Let \(F(T,{D,N,\kappa })\) be the free energy of the system. The formula (3) in this case becomes

$$\begin{aligned} F(T,{D_1,N,\kappa })-F(T,{D_0,N,\kappa })= -k_{\mathrm{B}}T[\log Z(T,{D_1,N,\kappa })- \log Z(T,{D_0,N,\kappa })] \end{aligned}$$
(24)

for any regions \(D_0\) and \(D_1\). Taking the limit \(\kappa \rightarrow \infty \), we obtain

$$\begin{aligned} F(T,V_1,N)-F(T,V_0,N)=-k_{\mathrm{B}}T[\log Z(T,V_1,N)-\log Z(T,V_0,N)], \end{aligned}$$
(25)

where \(|D_1|=V_1\) and \(|D_0|=V_0\). Note that the formula (3) cannot be directly applied to the system with \(\kappa \rightarrow \infty \) because we here always determine the change in free energy from quasi-static work and \(\partial H/\partial \alpha \) is not defined for the case \(\kappa \rightarrow \infty \). This is the reason why we need to pass (24) to get (25). Because the relation (25) holds for any \(V_0\) and \(V_1\), F(TVN) takes the form

$$\begin{aligned} F(T,V,N)=-k_{\mathrm{B}}T \log Z(T,V,N) + \phi (T,N), \end{aligned}$$
(26)

where a functional form of \(\phi (T,N)\) is not determined yet.

Furthermore, the expectation of the energy is calculated as

$$\begin{aligned} E= - \frac{\partial \log Z}{\partial \beta }. \end{aligned}$$
(27)

The condition (4) is then expressed as

$$\begin{aligned} \frac{\partial (\beta F+\log Z)}{\partial \beta }=0. \end{aligned}$$
(28)

This equality with (26) becomes

$$\begin{aligned} \frac{\partial \beta \phi (T,N)}{\partial \beta }=0, \end{aligned}$$
(29)

which leads to

$$\begin{aligned} \phi (T,N)= k_{\mathrm{B}}T \bar{\phi }(N) \end{aligned}$$
(30)

with a function \(\bar{\phi }(N)\). Substituting (30) into (26), we obtain (5).

2.3 Derivation of (10)

Let us derive (10), which is a consequence of the invalid assumption (9). Let \(H_{\mathrm{id}}(\Gamma ;D,N,\kappa )\) be the Hamiltonian of N-free particles confined in the same region D. The system corresponds to the ideal gas in thermodynamics. The partition function of the system is denoted by \(Z_{\mathrm{id}}(T,V,N)\). Here, putting \(\alpha \) in front of \(V_{\mathrm{int}}\) in (12), we change \(\alpha \) from \(\alpha =0\) to \(\alpha =1\) gradually. We then have a quasi-static process from \(H_{\mathrm{id}}(\Gamma ;D,N,\kappa )\) to \(H(\Gamma ;D,N,\kappa )\). Because the work done in the quasi-static process is equal to the free energy difference of the two systems, the relation

$$\begin{aligned} F(T,V,N)-F_{\mathrm{id}}(T,V,N)=-k_{\mathrm{B}}T[\log Z(T,V,N)-\log Z_\mathrm{id}(T,V,N)] \end{aligned}$$
(31)

holds. By substituting (5) into (31), we obtain

$$\begin{aligned} F_{\mathrm{id}}(T,V,N)=-k_{\mathrm{B}}T [\log Z_{\mathrm{id}}(T,V,N)-\bar{\phi }(N)]. \end{aligned}$$
(32)

This expression indicates that \(\bar{\phi }(N)\) is independent of \(H_0(\Gamma )\). Now, we can directly calculate \(Z_{\mathrm{id}}(T,V,N)\) as

$$\begin{aligned} Z_{\mathrm{id}}(T,V,N)= \left( \frac{2m\pi }{\beta }\right) ^{3N/2} V^N . \end{aligned}$$
(33)

We substitute (32) with (33) into (9) for \(F_{\mathrm{id}}\). We then have

$$\begin{aligned} \bar{\phi }(\lambda N)+\bar{\phi }((1-\lambda )N)-\bar{\phi }(N)= N[\lambda \log \lambda +(1-\lambda )\log (1-\lambda )]. \end{aligned}$$
(34)

Because this relation holds for any N and \(\lambda \) such that \(\lambda N\) is an integer, we obtain (10).

3 Derivation of the Main Result (6)

3.1 Outline

The key step in the derivation of (6) is to construct a quasi-static decomposition. We start with a description of the decomposed system. Let \(D^{\mathrm{L}}\) and \(D^{\mathrm{R}}\) be two cuboid regions separated by greater than the interaction length \(\xi \). By using a confining potential with a strength \(\kappa \), we attempt to construct a system where \(N^{\mathrm{L}}\) and \(N^{\mathrm{R}}\) particles are almost in \(D^{\mathrm{L}}\) and \(D^{\mathrm{R}}\), where \(N^{\mathrm{L}}+N^{\mathrm{R}}=N\) and \(|D^{\mathrm{L}}|=V^{\mathrm{L}}\) and \(|D^{\mathrm{R}}|=V^{\mathrm{R}}=V-V^{\mathrm{L}}\). Let \({{\mathcal {C}}}_1\) be a parameter set of the confining potential for the decomposed system, which is explicitly written as

$$\begin{aligned} {{\mathcal {C}}}_1 = ((D^{\mathrm{L}},N^{\mathrm{L}}), (D^{\mathrm{R}},N^{\mathrm{R}}), \kappa ). \end{aligned}$$
(35)

We also express the confining potential given in (23) as \({{\mathcal {C}}}_0=(D,N,\kappa )\). The most important step is to find a continuous family of confining potentials \(V_{\mathrm{con}}(\Gamma ;\mathcal{C}_\alpha )\) with \(0 \le \alpha \le 1\) starting from (23). Here, it is assumed that a particular \(N^{\mathrm{L}}\)-particles cannot be selected by controlling a potential. This property is expressed by

$$\begin{aligned} V_{\mathrm{con}}(\Gamma _\sigma ;{{\mathcal {C}}}_\alpha )= V_{\mathrm{con}}(\Gamma ;\mathcal{C}_\alpha ) \end{aligned}$$
(36)

with

$$\begin{aligned} \Gamma _\sigma \equiv ({\varvec{r}}_{\sigma (1)}, {\varvec{r}}_{\sigma (2)}, \ldots , {\varvec{r}}_{\sigma (N)}, {\varvec{p}}_{\sigma (1)}, {\varvec{p}}_{\sigma (2)}, \ldots , {\varvec{p}}_{\sigma (N)}) \end{aligned}$$
(37)

for any \(\Gamma \) and \(\sigma \in P\), where P denotes a set of all permutations of \(\{1,2,\ldots , N\}\). If such a family of potentials \(V_{\mathrm{con}}(\Gamma ;{{\mathcal {C}}}_\alpha )\), \(0 \le \alpha \le 1\), is found, (3) can be applied to the quasi-static decomposition process represented by this \((\mathcal{C}_\alpha )_{\alpha =0}^1\). Then, we take the limit \(\kappa \rightarrow \infty \) for the obtained expression. The result is

$$\begin{aligned} F(T,V^{\mathrm{L}},N^{\mathrm{L}})+F(T,V^{\mathrm{R}},N^{\mathrm{R}}) -F(T,V,N) = -k_{\mathrm{B}}T \lim _{\kappa \rightarrow \infty } [\log Z(T, {{\mathcal {C}}}_1) - \log Z(T, {{\mathcal {C}}}_0)], \nonumber \\ \end{aligned}$$
(38)

where the numbers of particles in the regions \(D^{\mathrm{L}}\) and \(D^{\mathrm{R}}\) are fixed as \(N^{\mathrm{L}}\) and \(N^{\mathrm{R}}\). Because

$$\begin{aligned} Z(T, {{\mathcal {C}}}_0)=Z(T,D,{N,\kappa }), \end{aligned}$$
(39)

we have only to calculate \(\log Z(T, {{\mathcal {C}}}_1)\). In the next section, by explicitly constructing the quasi-static decomposition, we calculate

$$\begin{aligned} \lim _{\kappa \rightarrow \infty }Z(T, {{\mathcal {C}}}_1) = \frac{N!}{N^{\mathrm{L}}! N^{\mathrm{R}}!}Z(T,V^{\mathrm{L}},N^{\mathrm{L}})Z(T,V^{\mathrm{R}},N^{\mathrm{R}}). \end{aligned}$$
(40)

Substituting (5), (39), and (40) into (38), we obtain

$$\begin{aligned} \phi (N^{\mathrm{L}})+\phi (N^{\mathrm{R}})-\phi (N)+\log \frac{N!}{N^{\mathrm{L}}! N^{\mathrm{R}}!}=0. \end{aligned}$$
(41)

Because this holds for any N, \(N^{\mathrm{L}}\), and \(N^{\mathrm{R}}\), we conclude (6).

3.2 Derivation of (40)

Fig. 1
figure 1

Illustration of a decomposed system using the confining potential (42) (top) or (44) (bottom). \(N=6\), \(N^{\mathrm{L}}=4\), and \(N^{\mathrm{R}}=2\). Particles can move from one region to the other region when \(\kappa \) is finite, while only \(\Gamma \) satisfying \(V_{\mathrm{con}}=0\) can be realized in the limit \(\kappa \rightarrow \infty \)

We explicitly construct a confining potential for the decomposed system described by \({{\mathcal {C}}}_1\), where \(N^{\mathrm{L}}\) and \(N^{\mathrm{R}}\) particles are almost in \(D^{\mathrm{L}}\) and \(D^{\mathrm{R}}\). One may naively consider such a potential as

$$\begin{aligned} V_{\mathrm{con}}(\Gamma ;{{\mathcal {C}}}_1)= \sum _{i=1}^{N^{\mathrm{L}}} V_\mathrm{wall}({\varvec{r}}_i;D^{\mathrm{L}},\kappa )+ \sum _{i=N^{\mathrm{L}}+1}^{N} V_\mathrm{wall}({\varvec{r}}_i;D^{\mathrm{R}},\kappa ), \end{aligned}$$
(42)

illustrated in the top side of Fig. 1. The confining potential (42) does not satisfy (36) with \(\alpha =1\). This means that if (42) were realized in a quasi-static process from (23), particles with index i satisfying \(1 \le i \le N^{\mathrm{L}}\) could be distinguished from the others. However, such distinguishment of identical particles is not allowed in the operation. Therefore, we have to look for a potential that is symmetric with respect to permutations of particle indexes.

Our approach is to consider a potential depending on the particle number in a specified region. For example, let us investigate

$$\begin{aligned} V_{\mathrm{con}}(\Gamma ;D^{\mathrm{L}},N^{\mathrm{L}},\kappa ) \equiv \min _{\sigma \in P} \left[ \sum _{i=1}^{N^{\mathrm{L}}} V_{\mathrm{wall}}({\varvec{r}}_{\sigma (i)};D^{\mathrm{L}},\kappa ) \right] . \end{aligned}$$
(43)

A phase space coordinate \(\Gamma \) satisfying \(V_\mathrm{con}(\Gamma ;D^{\mathrm{L}},N^{\mathrm{L}},\kappa )=0\) shows that at least \(N^{\mathrm{L}}\) particles are confined in the region \(D^{\mathrm{L}}\). It is obvious that \(V_\mathrm{con}(\Gamma ;D^{\mathrm{L}},N^{\mathrm{L}},\kappa )\) is symmetric with respect to permutations of the particle label because the minimization is taken over all permutations. However, owing to this property, the confining potential is not local.

Now, based on the potential (43), we consider a confining potential for the system configuration given by (35). As one example, we propose

$$\begin{aligned} V_{\mathrm{con}}(\Gamma ;{{\mathcal {C}}}_1) \equiv \min _{\sigma \in P} \left[ \sum _{i=1}^{N^{\mathrm{L}}} V_{\mathrm{wall}}({\varvec{r}}_{\sigma (i)};D^{\mathrm{L}},\kappa ) +\sum _{i=N^{\mathrm{L}}+1}^N V_{\mathrm{wall}}({\varvec{r}}_{\sigma (i)};D^{\mathrm{R}},\kappa ) \right] . \end{aligned}$$
(44)

Because \(D^{\mathrm{L}}\) and \(D^{\mathrm{R}}\) are separated by greater than the interaction length \(\xi \), a phase space coordinate \(\Gamma \) satisfying \(V_{\mathrm{con}}(\Gamma ;{{\mathcal {C}}}_1)=0\) shows that \(N^{\mathrm{L}}\) particles are confined in \(D^{\mathrm{L}}\) and \(N^{\mathrm{R}}=N-N^{\mathrm{L}}\) particles are confined in \(D^{\mathrm{R}}\), respectively, as displayed in the bottom side of Fig. 1. We here note that particles can move from one region to the other region when \(\kappa \) is finite. Therefore, all possible decompositions are observed in the time evolution.

Fig. 2
figure 2

Illustration of quasi-static decomposition described by the family of potentials (45). A sequence of particle configurations. \(N=8\), \(N^{\mathrm{L}}=5\), and \(N^{\mathrm{R}}=3\). The case \(\alpha =0\) is on the leftmost side, and the case \(\alpha =1\) on the rightmost side. \((D^{\mathrm{L}}_0,D^{\mathrm{R}}_0)=(D,D)\), \((D^{\mathrm{L}}_1,D^{\mathrm{R}}_1)=(D^{\mathrm{L}},D^{\mathrm{R}})\), and \(D^{\mathrm{L}}_{\alpha } \cap D^{\mathrm{R}}_{\alpha } \not =\phi , D\) for \(0< \alpha < 1\). \({{\hat{N}}}^{\mathrm{L}}\) and \({{\hat{N}}}^{\mathrm{R}}\) denotes the number of particles in the region \(D^{\mathrm{L}}_\alpha \) and \(D^{\mathrm{R}}_\alpha \), respectively. Note that \({{\hat{N}}}^{\mathrm{L}}\ge N^{\mathrm{L}}\) and \({{\hat{N}}}^{\mathrm{R}}\ge N^{\mathrm{R}}\) hold if and only if \(V_{\mathrm{con}}(\Gamma ;\mathcal{C}_\alpha )=0\)

Furthermore, we construct a quasi-static process from the parameter set \({{\mathcal {C}}}_0\) to \({{\mathcal {C}}}_1\). Let \(D^{\mathrm{L}}_\alpha \) and \(D^{\mathrm{R}}_\alpha \) (\(0\le \alpha \le 1\)) be a continuous family of regions satisfying \((D^{\mathrm{L}}_0,D^{\mathrm{R}}_0)=(D,D)\) and \((D^{\mathrm{L}}_1,D^{\mathrm{R}}_1)=(D^{\mathrm{L}},D^{\mathrm{R}})\). We then define

$$\begin{aligned} V_{\mathrm{con}}(\Gamma ;{{\mathcal {C}}}_\alpha ) \equiv \min _{\sigma \in P} \left[ \sum _{i=1}^{N^{\mathrm{L}}} V_\mathrm{wall}({\varvec{r}}_{\sigma (i)};D^{\mathrm{L}}_{\alpha },\kappa ) +\sum _{i=N^{\mathrm{L}}+1}^N V_{\mathrm{wall}}({\varvec{r}}_{\sigma (i)};D^{\mathrm{R}}_{\alpha },\kappa ) \right] . \end{aligned}$$
(45)

To see properties of the potential, we define \({{\hat{N}}}^{\mathrm{L}}\) and \({{\hat{N}}}^{\mathrm{R}}\) as the number of particles contained in \(D^{\mathrm{L}}_\alpha \) and \(D^{\mathrm{R}}_\alpha \) for a given microscopic coordinate \(\Gamma \). We then confirm that \({{\hat{N}}}^{\mathrm{L}}\ge N^{\mathrm{L}}\) and \({{\hat{N}}}^{\mathrm{R}}\ge N^{\mathrm{R}}\) hold if and only if \(V_{\mathrm{con}}(\Gamma ;{{\mathcal {C}}}_\alpha )=0\). Keeping this in mind, we find that (45) with \(\alpha =0\) is equivalent to (13), and thus (45) with \(0 \le \alpha \le 1\) represents the quasi-static decomposition, as illustrated in Fig. 2. We also note that (45) satisfies (36) for any permutation \(\sigma \).

Now, we calculate \(\lim _{\kappa \rightarrow \infty }Z(T, {{\mathcal {C}}}_1)\). For later convenience, we define the subset G of permutations P as

$$\begin{aligned} G \equiv \{ \sigma \in P| \sigma (1)< \sigma (2)\cdots<\sigma (N^{\mathrm{L}}); \sigma (N^{\mathrm{L}}+1)< \sigma (N^{\mathrm{L}}+2)\cdots <\sigma (N) \}. \end{aligned}$$
(46)

For a given phase-space coordinate \(\Gamma \) satisfying \(V_\mathrm{con}(\Gamma ;{{\mathcal {C}}}_1)=0\), there is a unique \(\sigma \in G\) such that \({\varvec{r}}_{\sigma (i)} \in D^{\mathrm{L}}\) for \(1\le i \le N^{\mathrm{L}}\) and \({\varvec{r}}_{\sigma (i)} \in D^{\mathrm{R}}\) for \(N^{\mathrm{L}}+1\le i \le N\). We express this \(\sigma \) as \(\sigma _\Gamma \) to see the \(\Gamma \) dependence explicitly. We then have

$$\begin{aligned} \lim _{\kappa \rightarrow \infty }Z(T, {{\mathcal {C}}}_1) =\int d\Gamma \exp (-\beta H_0(\Gamma )) \prod _{i=1}^{N^{\mathrm{L}}}\chi ({\varvec{r}}_{\sigma _\Gamma (i)} \in D^{\mathrm{L}}) \prod _{i=N^{\mathrm{L}}+1}^{N}\chi ({\varvec{r}}_{\sigma _\Gamma (i)} \in D^{\mathrm{R}}). \end{aligned}$$
(47)

By substituting \(\sum _{\sigma \in G}\delta (\sigma , \sigma _\Gamma )=1\) into the right-hand side of (47), we rewrite it as

$$\begin{aligned} \sum _{\sigma \in G} \int d\Gamma \exp (-\beta H_0(\Gamma )) \prod _{i=1}^{N^{\mathrm{L}}}\chi ({\varvec{r}}_{\sigma (i)} \in D^{\mathrm{L}}) \prod _{i=N^{\mathrm{L}}+1}^{N}\chi ({\varvec{r}}_{\sigma (i)} \in D^{\mathrm{R}}). \end{aligned}$$
(48)

Here, using the symmetry property \(H_0(\Gamma )=H_0(\Gamma _\sigma )\) for any \(\sigma \in P\), (48) is further expressed as

$$\begin{aligned} |G| Z(T,V^{\mathrm{L}},N^{\mathrm{L}})Z(T,V^{\mathrm{R}},N^{\mathrm{R}}). \end{aligned}$$
(49)

Because

$$\begin{aligned} |G|=\frac{N!}{N^{\mathrm{L}}! N^{\mathrm{R}}!}, \end{aligned}$$
(50)

we obtain (40).

4 Free Energy of Binary Mixtures

In this section, we study a system consisting of two different types of particles, A and B, confined in the cuboid region D. Let \(\Gamma =(\Gamma ^A, \Gamma ^B)\) be a phase-space coordinate of the system, where

$$\begin{aligned} \Gamma ^A&=({\varvec{r}}^A_1, {\varvec{r}}^A_2, \ldots , {\varvec{r}}^A_{N^A} ,{\varvec{p}}^A_1, {\varvec{p}}^A_2, \ldots , {\varvec{p}}^A_{N^A}), \end{aligned}$$
(51)
$$\begin{aligned} \Gamma ^B&= ( {\varvec{r}}^B_1, {\varvec{r}}^B_2, \ldots , {\varvec{r}}^B_{N^B},{\varvec{p}}^B_1, {\varvec{p}}^B_2, \ldots , {\varvec{p}}^B_{N^B} ). \end{aligned}$$
(52)

The Hamiltonian of the system is expressed as

$$\begin{aligned} H_0(\Gamma )= H^A(\Gamma ^A)+H^B(\Gamma ^B)+H^{AB}(\Gamma ) \end{aligned}$$
(53)

with

$$\begin{aligned} H^A(\Gamma ^A)&=\sum _{i=1}^{N^A} \frac{|{\varvec{p}}_i|^2}{2m^A} +\sum _{i < j} V_{\mathrm{int}}^A( |{\varvec{r}}_i^A-{\varvec{r}}_j^A|) , \end{aligned}$$
(54)
$$\begin{aligned} H^B(\Gamma ^B)&=\sum _{i=1}^{N^B} \frac{|{\varvec{p}}_i|^2}{2m^B} +\sum _{i < j} V_{\mathrm{int}}^B( |{\varvec{r}}_i^B-{\varvec{r}}_j^B|) , \end{aligned}$$
(55)
$$\begin{aligned} H^{AB}(\Gamma )&= \frac{1}{2} \sum _{i=1}^{N^A} \sum _{j=1}^{N^B} V_{\mathrm{int}}^{AB}(| {\varvec{r}}_i^A-{\varvec{r}}_j^B|). \end{aligned}$$
(56)

Here, \(V_{\mathrm{int}}^{A/B}\) represents a short-range interaction between two particles with the same type A or B, and \(V_\mathrm{int}^{\mathrm{AB}}\) a short-range interaction between a particle of type A and a particle of type B. The system configuration that all the particles are confined in the region D is given by a confining potential

$$\begin{aligned} V_{\mathrm{con}}(\Gamma ; {{\mathcal {C}}}_0) = \sum _{i=1}^{N^A} V_\mathrm{wall}({\varvec{r}}_i^A;D,\kappa ) +\sum _{i=1}^{N^B} V_\mathrm{wall}({\varvec{r}}_i^B;D,\kappa ), \end{aligned}$$
(57)

where \({{\mathcal {C}}}_0\) denotes this set of the parameters. The total Hamiltonian is denoted by \(H(\Gamma ;{{\mathcal {C}}}_0)\), which is equal to \(H_0(\Gamma )+ V_{\mathrm{con}}(\Gamma ; {{\mathcal {C}}}_0)\). We then define the partition function \(Z(T,V,N^A,N^B)\) by

$$\begin{aligned} Z(T,V,N^A,N^B)=\lim _{\kappa \rightarrow \infty } \int d\Gamma \exp (-\beta H(\Gamma ;{{\mathcal {C}}}_0)). \end{aligned}$$
(58)

By a similar argument for the derivation of (5), we find that the free energy \(F(T,V,N^A,N^B)\) of the binary mixture satisfies

$$\begin{aligned} F(T,V,N^A,N^B)=-k_{\mathrm{B}}T [\log Z(T,V,N^A,N^B)-\bar{\phi }^{(2)}(N^A,N^B)] \end{aligned}$$
(59)

with a function \(\bar{\phi }^{(2)}(N^A,N^B)\).

In order to determine \(\bar{\phi }^{(2)}(N^A,N^B)\), we consider a system configuration that particles of type A are in \(D^{\mathrm{L}}\), while particles of type B are in \(D^{\mathrm{R}}\), where \(D^{\mathrm{L}}\) and \(D^{\mathrm{R}}\) are separated by greater than the interaction length of particles. This configuration is described by a confining potential

$$\begin{aligned} V_{\mathrm{con}}(\Gamma ; {{\mathcal {C}}}_1) = \sum _{i=1}^{N^A} V_\mathrm{wall}({\varvec{r}}_i^A;D^{\mathrm{L}},\kappa ) +\sum _{i=1}^{N^B} V_\mathrm{wall}({\varvec{r}}_i^B;D^{\mathrm{R}},\kappa ), \end{aligned}$$
(60)

Now, using \(D^{\mathrm{L}}_\alpha \) and \(D^{\mathrm{R}}_\alpha \) in the previous section, we can construct a quasi-static process parameterized by \(\mathcal{C}_\alpha \) as

$$\begin{aligned} V_{\mathrm{con}}(\Gamma ; {{\mathcal {C}}}_\alpha ) = \sum _{i=1}^{N^A} V_\mathrm{wall}({\varvec{r}}_i^A;D^{\mathrm{L}}_\alpha ,\kappa ) +\sum _{i=1}^{N^B} V_\mathrm{wall}({\varvec{r}}_i^B;D^{\mathrm{R}}_\alpha ,\kappa ), \end{aligned}$$
(61)

which enforces all particles of type A (and B) to be confined in \(D^{\mathrm{L}}_{\alpha }\) (and \(D^{\mathrm{R}}_\alpha \)). This potential corresponds to a semi-permeable wall for any type of particles. Note that (61) is a standard one-body potential which is different from (45). The relation (3) for the quasi-static process \(({{\mathcal {C}}}_\alpha )_{\alpha =0}^1\) is written as

$$\begin{aligned}&F(T,V_1,N^A,0)+F(T,V_2,0,N^B)-F(T,V,N^A,N^B) \nonumber \\&=-k_{\mathrm{B}}T [\log Z(T,V_1,N^A,0)+\log Z(T,V_1,0,N^B)-\log Z(T,V,N^A,N^B)]. \end{aligned}$$
(62)

Here, from the result of the previous section, we have

$$\begin{aligned} F(T,V_1,N^A,0)&=-k_{\mathrm{B}}T [\log Z(T,V_1,N^A,0)- \log N_A! -c_A N^A], \end{aligned}$$
(63)
$$\begin{aligned} F(T,V_2,0,N^B)&=-k_{\mathrm{B}}T [\log Z(T,V_2,0,N^B)- \log N_B! -c_B N^B], \end{aligned}$$
(64)

where \(c_A\) and \(c_B\) are arbitrary constants. By substituting (59), (63), and (64) into (62), we obtain

$$\begin{aligned} \bar{\phi }^{(2)}(N^A,N^B)=\log N^A!+\log N^B!+c_A N^A+c_B N^B. \end{aligned}$$
(65)

Therefore, (59) with (65) becomes

$$\begin{aligned} F(T,V,N^A,N^B)=-k_{\mathrm{B}}T \left[ \log \frac{Z(T,V,N^A,N^B)}{N^A!N^B!}-c_A N^A-c_B N^B \right] . \end{aligned}$$
(66)

The difference of (66) from (7) comes from the symmetry of the Hamiltonian for permutations. The assumption of the argument is that if the Hamiltonian is not invariant for the exchange of two particle indices, the two particles can be distinguished by the operation of a confining potential.

The arguments leading to (62), (63), and (64) imply that the free energy of binary mixtures can be calculated from works measured in numerical simulations or experiments. However, from a practical viewpoint, using the potential (44), which is necessary to obtain (63) and (64), may be impossible in experiments and is not efficient in numerical simulations. As shown in Ref. [10], the quasi-static decomposition can be replaced by the measurement-and-feedback with information thermodynamics. Furthermore, the expressions using other quasi-static works can be replaced by the Jarzynski relation [13], which turns out to be computationally efficient [10].

5 Concluding Remarks

We have derived (7) based on a quasi-static decomposition using the potential (44). Our argument stands on the view that free energy is defined by the measurement of thermodynamic quantities, that is, whether or not N! appears in the formula should be determined by thermodynamic considerations. This understanding was first presented over one hundred years ago [14]. As explained in Sec. 1, it is established that the Gibbs factorial for macroscopic systems is characterized by quasi-static works. The achievement in the present paper is that this known result can be extended to small thermodynamic systems by distinguishing \(\log N!\) and \(N\log N\). In closing, we briefly discuss other approaches to understand the Gibbs factorial.

In Refs. [6, 8], the partition function of a composite system of sub-systems with \((T,V^{\mathrm{L}},N^{\mathrm{L}})\) and \((T,V^{\mathrm{R}},N^{\mathrm{R}})\) is given as

$$\begin{aligned} Z_{\mathrm{comp}}(T,V^{\mathrm{L}},N^{\mathrm{L}},V^{\mathrm{R}},N^{\mathrm{R}}) = \frac{N!}{N^{\mathrm{L}}! N^{\mathrm{R}}!} Z(T,V^{\mathrm{L}},N^{\mathrm{L}})Z(T,V^{\mathrm{R}},N^{\mathrm{R}}). \end{aligned}$$
(67)

See Eq. (2) in [6] and Eq. (6) in [8]. Although this takes the same form as (40), the left-hand side of (67) is not explicitly defined in Ref. [6]. The Hamiltonian of the composite system should involve a confining potential that is symmetric with respect to permutations of particle indexes. As shown in our paper, we require a special potential (44), but such an example is not illustrated in Ref. [6]. Concerning the last point, in Ref. [8], the composite system is prepared by making a small opening in the separating wall of the two sub-systems with the condition \(N^{\mathrm{L}}/N^{\mathrm{R}}=V^{\mathrm{L}}/V^{\mathrm{R}}\). However, in this case, \(N^{\mathrm{L}}\) fluctuates, and thus \(N^{\mathrm{L}}\) is not a fixed parameter. Nevertheless, (67) may be justified when the thermodynamic limit is taken, because \(N^{\mathrm{L}}/N\) takes the most probable value. Note that this argument cannot be applied to small thermodynamic systems.

As a slightly different approach, in Ref. [7], the thermodynamic function is defined by the probability of unconstrained thermodynamic variables. For example, in isolated systems, the probability is expressed in terms of thermodynamic entropy [15, 16]. For non-interacting particles in contact with a heat bath, the probability of the number of particles \(N^{\mathrm{L}}\) in a given region \(D^{\mathrm{L}}\) of the system is expressed as

$$\begin{aligned} P(N^{\mathrm{L}};T,V,N)= \frac{1}{{\tilde{Z}}(T,V,N)} \exp (-\beta [F(T,V^{\mathrm{L}},N^{\mathrm{L}})+ F(T,V-V^{\mathrm{L}},N-N^{\mathrm{L}})]), \end{aligned}$$
(68)

where \({\tilde{Z}}\) is the normalization constant independent of \(N^{\mathrm{L}}\). Now, one may adopt (68) as a prerequisite for determining the free energy. Because \(P(N^{\mathrm{L}};T,V,N)\) is calculated from the canonical distribution, we find that (7) holds. The argument is easily generalized to N-interacting identical particles for macroscopic systems, which is the standard large deviation theory of thermodynamic systems [17]. Nevertheless, this approach cannot be used for small thermodynamic systems except for non-interacting particles.

As a generalization of (3), the Jarzynski relation can be used to determine the free energy from non-equilibrium works [13]. Then, when a non-equilibrium process without the corresponding time-reversed path is considered, the relation takes a modified form [18]. In Ref. [9], the free energy is argued using this modified Jarzynski relation with absolute irreversibility. Although the formal result of Eq. (6) in Ref. [9] is correct, the argument leading to the main result is limited to non-interacting particles. To prove their result for general cases, it is necessary to employ the quasi-static decomposition introduced in the present paper. We thus believe that the essence of the Gibbs factorial is in the quasi-static decomposition, not in the absolute irreversibility.

Finally, we consider quantum systems. Let \({\hat{H}}({{\mathcal {C}}})\) be a Hamiltonian for N-interacting identical particles in a system configuration described by \({{\mathcal {C}}}\). We define the partition function \(Z_{\mathrm{QM}}({{\mathcal {C}}})\) as

$$\begin{aligned} Z_{\mathrm{QM}}(T,{{\mathcal {C}}})= \mathrm{Tr} (\exp (-\beta {\hat{H}}({{\mathcal {C}}})). \end{aligned}$$
(69)

By repeating a similar argument in Sec. 3, we obtain

$$\begin{aligned} \lim _{\kappa \rightarrow \infty }Z_{\mathrm{QM}}(T, {{\mathcal {C}}}_1) = Z_\mathrm{QM}(T,V^{\mathrm{L}},N^{\mathrm{L}})Z_{\mathrm{QM}}(T,V^{\mathrm{R}},N^{\mathrm{R}}) \end{aligned}$$
(70)

instead of (40). This result leads to

$$\begin{aligned} F(T,V,N)= -k_{\mathrm{B}}T \left[ \log {Z_{\mathrm{QM}}(T,V,N)} -c_0 N \right] , \end{aligned}$$
(71)

instead of (7). The free energy F defined by (8) is equivalent to (71) with \(c_0=0\). In our viewpoint, (8) should not be a starting point, but interpreted as the result from the prerequisites of free energy. Then, the free energy for both classical and quantum systems can be uniquely determined from the quasi-static works without any confusion, up to an additive constant proportional to N. The difference between (7) and (71) comes from the difference in distinguishability of microscopic states for N-identical particles. Although this is correct, the distinguishability of microscopic states plays no role in the argument determining the free energy. Rather, the most important issue here is whether or not particles are distinguished by operation of a confining potential.