Stochastic thermodynamics of a finite quantum system coupled to a heat bath

We consider a situation where an $N$-level system (NLS) is coupled to a heat bath without being necessarily thermalized. For this situation we derive general Jarzinski-type equations and conclude that heat and entropy is flowing from the hot bath to the cold NLS and, vice versa, from the hot NLS to the cold bath. The Clausius relation between increase of entropy and transfer of heat divided by a suitable temperature assumes the form of two inequalities which have already been considered in the literature. Our approach is illustrated by an analytical example.


Introduction
The study of nonequilibrium thermodynamics of systems in contact with a thermal reservoir ("heat bath") of different temperatures has a long history. As an example of the approach via a Master equation and its weak coupling limit, we mention the work of Lebowitz and Spohn [1], which actually considers a finite number of reservoirs. During the last decades, new methods have been devised, in particular, the approach via fluctuation theorems [2]. The famous Jarzynski equation represents one of the rare exact results of nonequilibrium statistical mechanics. It is a statement about the expectation value of the exponential of the work ⟨ e − ⟩ performed on a system initially in thermal equilibrium with inverse temperature , but possibly far from equilibrium after the work process. This equation was first formulated for classical systems [3] and subsequently proved for quantum systems [4][5][6]. Extensions for systems that are initially in local thermal equilibrium [5], microcanonical ensembles [7], and grand-canonical ensembles [8][9][10][11][12][13][14] have been published. The literature on the Jarzynski equation and its applications is rich; a concise review is given in [14], focusing on the connection with other fluctuation theorems. The most common approach to the quantum Jarzynski equation is to consider sequential measurements. This approach is also followed in the present work. The general framework for such an approach was outlined in [15] and [16]. It is per se neither quantum mechanical nor classical and will be referred to as "stochastic thermodynamics" in the present work. At the end of Appendix C, we sketch realizations of the general framework in quantum mechanics and classical mechanics.
Interestingly, one can derive from the Jarzynski equation certain inequalities that resemble the second law, see, e.g., [14]. However, a closer inspection shows that these inequalities are not exactly statements about the non-decrease of entropy. But the entropy balance is not the problem: the total von Neumann entropy is constant during unitary time evolution and non-decreasing during projective measurements, see [17] or Theorem 11.9 in [18]. The problem is rather that in the quantum case, the entropy balance is not sufficient to cover all aspects of the second law.
To explain the latter, consider classical thermodynamics where there are several equivalent formulations of the second law. For example, from the non-decrease in total entropy, it can be deduced that heat (and entropy) always flows from the hotter to the colder body. The elementary argument goes as follows: If the hotter body with inverse temperature transfers the infinitesimal heat Q (of whatever sign) to the colder body with inverse temperature 0 > , then its entropy decrease will be dS 1 = Q, according to the Clausius equality. On the other hand, the colder body receives the heat Q and its entropy increases by dS 2 = 0 Q. The total entropy increase will be dS = dS 2 In the quantum case, this elementary argument breaks down. Between the two sequential measurements, the transferred heat ΔQ and entropy ΔS can no longer be con- replaced by two inequalities. Moreover, the energy increase of the first system is not exactly equal to the energy decrease of the second system. This holds only approximately if the interaction Hamiltonian can be neglected, which will not be the case for small ΔQ. (Strictly speaking, the latter objection already applies to the classical case.) We will try here to modify the classical argument for the "correct" heat flow for quantum mechanics. To this end, we will adopt another approach to the problem of the direction of the heat flow that focuses on the N-level quantum system and describes the influence of the heat bath solely in terms of a transition matrix T. T is only a (left) stochastic matrix and can no longer be assumed to be bi-stochastic (in the strict or modified sense) and hence, the usual assumptions leading to a Jarzynski-type equation, see [15], are no longer satisfied. But it is possible to derive a more general J-equation that is only based on (left) stochasticity of T. Thus, we can find arguments for the "correct" flow of heat and entropy that only rely on the assumption that T leaves invariant some Gibbs state with inverse temperature 0 , see Section 2. 0 is interpreted as the inverse temperature of the heat bath. In this sense, we derive the second law of thermodynamics from a form of the zeroth law. For this derivation, we combine known results that appear in various places in the literature, see [19][20][21][22][23], but are sometimes only proved under assumptions that are stronger than those we will assume in the present work. We will present the relationship of these references to our results in more detail in Section 4.
The structure of the paper is as follows. The general definitions and main results on the heat flow between the system and the heat bath are given in Section 2. These results are based on a Jarzynski-type equation (19), which is proved in a more general setting in Appendix C. Here, we also comment on the possibility to relax the usual assumption of an initial product state. Close to the equilibrium point, the entropy increase ΔS and the absorbed heat over temperature ΔQ have a common tangent, see The analogous result on the entropy flow is formulated in Section 3. It depends on two "Clausius inequalities", see Eq. (67), the second one of which again follows from the Jarzynski-type equation. The bi-stochastic limit is shortly considered in Section 4. The next Section 5 contains an analytically solvable example. We close with a summary and outlook in Section 6.

Main results on heat flow
We consider an N-level system (NLS) described by a finite index set  , energies E n , and degeneracies d n for n ∈  .
The NLS is assumed to be initially in a Gibbs state with probabilities where the partition function Z is defined by and = 1 is the inverse temperature of the NLS. After an interaction with a heat bath a subsequent measurement of energy finds the NLS in the level m ∈  with probability Here, the "transition matrix" T is an N × N (left) stochastic matrix, i.e., satisfying The entries of T will be sometimes written as conditional probabilities T mn = P(m ← n) with self-explaining notation. We do not make any assumptions concerning thermalization and hence, the final probabilities q m will, in general, not be of Gibbs type.
The usual Jarzynski equation is based on the property of T being a bi-stochastic matrix, i.e., additionally satisfying, in the non-degenerate case of d n ≡ 1, ∑ n T mn = 1 forallm ∈  , (6) or, in the general case, ∑ n T mn d n = d m for all m ∈  , see Eq. (25) in [15]. This property holds if the system is closed and only subject to external forces performing work upon the system. But bi-stochasticity is no longer guaranteed for systems coupled to other ones (heat baths). However, if this is the case and if no external forces are applied, we may relax the (modified) bi-stochasticity of T to the following: There exists a Gibbs state with probabilities and that is left fixed by T, i.e., ∑ n T mn p (0) In this case, the transition matrix T, satisfying (4), (5) and (10), will be called a "Gibbs matrix" with temperature 0 = 1 0 . We will also refer to 0 as the "temperature of the heat bath".
Recall that every (left) stochastic matrix T has an eigenvector p (0) with non-negative entries corresponding to the eigenvalue 1, although p (0) is generally not unique. Mathematically, T being bi-stochastic is a special case of being a Gibbs matrix, since (6) follows from (10) for 0 = 0 and d n = 1 for all n ∈  . However, according to the above remarks, being a Gibbs matrix should rather be considered as a property of T relative to a given family of energies E n , not as a property of T alone. Physically, the property (10) appears plausible if T represents the transition matrix due to the interaction with a heat bath of temperature 0 . If the NLS already has the same temperature 0 , its state should not change. This is not trivial since, in general, the Gibbs state of the combined is concentrated on the level with the lowest/highest energy, respectively, and hence 0 ΔQ as well as ΔS approach constant values. Therefore, ΔQ is asymptotically linear at these limits.
system, NLS plus heat bath, with temperature 0 does not commute with the interaction Hamiltonian. However, it can be shown that (10) holds exactly for some analytically solvable examples [24], and in other cases, the real situation can be expected to be represented by (10) to an excellent approximation.
Next, we will recall some probabilistic framework concepts for the Jarzynski-type equation, see [15]. Let  ×  be the set of "elementary events" such that one event (m, n) ∈  ×  represents the outcome of a sequential energy measurement at the NLS in the sense that the initial measurement yields the result E n , and, after the interaction with the heat bath, the final measurement yields E m . The probability function defined for elementary events is given by Analogously to the case of the ordinary Jarzynski equation, we consider random variables Y:  ×  → ℝ and their expectation value denoted by An example is defined by This can be interpreted as the "heat" transferred to the NLS during the interaction with the heat bath since we have assumed that no external forces are active that could perform work on the NLS. Another example is the random variable "entropy increase" Its expectation value agrees with the familiar expression for entropy decrease, as will be shown in Section 3, see Eqs. (35)-(37).
Sometimes, instead of (13), we will also use the sloppy notation ⟨Y(m, n)⟩ for the expectation value.
Then we can state the following Jarzynski-type equation that follows from the general "J-equation" considered in Appendix C.

Theorem 1. If T is a Gibbs matrix with inverse temperature 0 andp an arbitrary probability distribution, hence satisfying
then, under the preceding conditions, the following holds: For the proof see Appendix C, where (19) is obtained as a special case.
The Jarzynski-type equation (19) is more of a template that can be used to generate further equations by choosing a special form of the general probability distributionp. As a particular choice, we will considerp = p. This yields and further, using and (15), the following equation: This equation was also derived in [19] under stronger assumptions. As pointed out in [19], Eq. (23) implies that the probability of events where heat flows in the "wrong" direction, i.e., where ( − 0 ) ΔQ < 0, must be exponentially suppressed. The reason is that in the case of a Jarzynski-type equation of the form ⟨ e X ⟩ = 1 the contributions to the expectation value from large positive values of X must be counterbalanced by a large number of contributions from negative values of X in order to maintain the expectation value at 1. As for the original Jarzynski equation, we may derive an inequality by invoking Jensen's inequality (JI). Note that Thus, we have proven: If the temperature of the NLS is lower than the temperature 0 of the heat bath, then − 0 ≥ 0 and hence, by means of (26), ⟨ΔQ⟩ ≥ 0. It means that in this case the expectation value of the heat flowing into the NLS will be positive, and vice versa. In other words, heat will flow from the hotter body to the colder one, analogously to the result in classical thermodynamics, see Section 1.

Clausius inequalities
We adopt the notation of Section 2 but for the next steps will not need Assumption 1. Further define (sometimes skipping the expectation brackets ⟨…⟩ if no misunderstanding can occur): Note that (1) implies the familiar identity To show the consistency of (33) with the definition (17), we calculate the expectation value of the corresponding random variable which agrees with (33). Then, we can show the following: Under the preceding conditions, the "first Clausius inequality" holds.
This inequality has also be obtained in [20] by considering two systems with weak interaction and using the fact that the Gibbs state minimizes the free energy. This statement, in turn, can also be proven by the Gibbs inequality used below.
see, e.g., Theorem 11.1 in [18]. From this, we obtain −S(q) and further ≥ S(q) − S(p) (33) = ΔS, which concludes the Proof of Theorem 3. □ Interestingly, the first Clausius inequality can be sharpened to a Clausius equality in the weak coupling limit.

Proposition 1. If the transition matrix T is of the form
where t denotes some N × N-matrix with necessarily vanishing column sums, then The proof can be found in Appendix A. Next, we assume the situation of a "heat process" as in Section 2 together with Assumption 1 and hence, can interpret the energy difference ⟨ΔE⟩ as the heat ⟨ΔQ⟩ transferred to the NLS. We consider both sides of (38), ⟨ΔQ⟩ and ⟨ΔS⟩, as functions of the inverse temperature . Both functions vanish at the inverse temperature 0 of the heat bath and, due to (38), must have a common tangent at = 0 , see Figure 1. We will calculate its slope a using the intermediate results This yields using Eq. (5) in (60). According to Theorem 1, it is clear that the slope of the tangent cannot be negative, a ≥ 0. Nevertheless, this will be checked independently, see Appendix B. The linear part of the Taylor series of ⟨ΔQ⟩ w.r.t.
( − 0 ) can be used to re-write ⟨ΔQ⟩ as a function of the dimensionless temperature = 1 such that the zero of ⟨ΔQ⟩ at = 0 corresponds to the temperature 0 = 1 0 .

The result
resembles the Fourier law or its precursor, Newton's law of cooling [25], stating that the rate of heat loss of a body is directly proportional to the difference in the temperatures between the body and its surroundings. We further remark that the explicit form (60) of the "heat conduction coefficient" a 0 in (61) is reminiscent of the fluctuation-dissipation theorems mentioned in [7] in connection with the Jarzynski equation, see also Appendix B.2.
The above result that ΔQ = ΔS + O( − 0 ) 2 can be viewed as a confirmation of the Clausius identity in linear stochastic thermodynamics. The fact that the deviation to the Clausius identity is non-negative in the sense of Theorem 3 can be made plausible in the following way. Consider a state change of an NLS with a slightly lower temperature than the heat bath, < 0 , consisting of two steps. In the first step, there is a limited contact with the heat bath such that only the heat Δ 1 Q is flowing into the TLS leading, in linear approximation, to an increase of its entropy by Δ 1 S = Δ 1 Q . After this first step, the system, while being kept isolated, thermalizes and approximately assumes a Gibbs state with temperature 1 such that < 1 < 0 . This can be reasonably expected if N is large enough (or if N = 2). In a second step, there is another contact with the heat bath leading to a further heat transfer of Δ 2 Q and, in linear approximation, to an increase of its entropy by Δ 2 S = Δ 2 Q 1 < Δ 2 Q . The total heat transfer is ΔQ = Δ 1 Q + Δ 2 Q and the total increase of entropy is ΔS = Δ 1 S + Δ 2 S which is less than ΔQ . An analogous reasoning applies to the case of > 0 and a cooling of the NLS in two steps. The "first Clausius inequality" ⟨ΔQ⟩ ≥ ⟨ΔS⟩ thus reflects the fact that is the fixed initial inverse temperature of the NLS and possible changes of the NLS's temperature during the interaction with the heat bath are ignored in the term ⟨ΔQ⟩ but would be relevant for the term ⟨ΔS⟩. On the other hand, the term ⟨ΔQ⟩ cannot be improved in a simple way, because after the interaction with the heat bath, the NLS may no longer be in a Gibbs state and thus has no temperature at all.
Next, we turn to a second Clausius inequality that can be obtained from the Jarzynski-type equation (19) by As above, we may invoke Jensen's inequality (JI) and the fact that x ↦ −log x is a convex function: where we have suitably expanded the fraction (63) with the factors d n and d m . Together with (38), we have thus proven the following The second Clausius inequality 0 ⟨ΔQ⟩ ≤ ⟨ΔS⟩ has also been obtained in [21], Eq. (4.4), under the same conditions corresponding to our Assumption 1 and using the "monotonicity of the Kullback-Leibler (KL) divergence". This proof is closely related to ours, since the said monotonicity is also a consequence of the general J-equation, see Appendix C.
Recall that according to Theorem 2, heat is always flowing from the hotter body to the colder one. According to the first Clausius inequality (38), the analogous statement for the entropy flow can only be shown in the case of 0 ≤ ≤ 0 , i.e., where the NLS has initially a larger temperature than the heat bath. This follows since − 0 ≤ 0 implies ⟨ΔQ⟩ ≤ 0 by Theorem 2 and hence, (68)

Bi-stochastic limit case
As remarked in Section 2, in the limit case 0 = 0 and if d n = 1 for all n ∈  , we obtain the special case of a bistochastic transition matrix T satisfying (6). For d n ≡ 1, the entropy (31) can be identified with the Shannon entropy [26], up to the choice of units. Physically, this case can be realized by an NLS subject to external time-dependent forces but not coupled to a heat bath. Although this special case is actually outside the thematic scope of this article, it will be instructive to investigate it closer. The mathematics we used does not presuppose 0 ≠ 0 and hence, this special case should be included in the preceding sections. According to the mentioned physical realization of the bistochastic limit case, we will refer to the random variable ΔE as "work" and denote it by the variable .
In particular, we consider the "Clausius inequalities" (67) and re-write them as For ≥ 0, it implies ⟨ ⟩ ≥ 0, a result that could also have been derived from the usual Jarzynski equation, see, e.g., [27]. Another consequence of (69) is ⟨ΔS⟩ ≥ 0 (in contrast to ⟨ΔS⟩ = 0 for classical adiabatic work processes). This result can be independently proven as follows: every bistochastic matrix T can be written as a convex sum of permutational matrices. This is the Birkhoff-von Neumann theorem, see [28,29]. The Shannon entropy is invariant under permutations, but increases under a convex sum of probability distributions. The latter is due to the concavity of the Shannon entropy, see, e.g., Ex. 11.21 in [18].

Analytical example
As an example where the transition matrix T can be exactly calculated, we consider a single spin with spin quantum number s = 1 coupled to a harmonic oscillator that serves as a heat bath. Hence, we have a three-level system,  = {1, 0, −1} and N = | |  | | = 3. The total Hamiltonian is where and (|n⟩) n=0,1,2,… denotes the eigenbasis of A * A. is a real parameter. Further, let (|m⟩) m=1,0,−1 be the eigenbasis of s ∼ z such that (|m, n⟩) m∈ ,n∈ℕ is an orthonormal basis of the total Hilbert space.
The Hamiltonian (70)-(73) strongly resembles the Jaynes-Cummings model [30], which describes the interaction of a two-level system with a quantized radiation field. The extension to three-level systems has also been considered [31][32][33], but always assumes non-uniform level spacings and two radiation modes.
This system is analytically solvable since H 12 com- and the corresponding eigenvalues Let denote a Gibbs state of the harmonic oscillator, such that We choose as an initial mixed state = ∑ mn p m n |mn⟩ ⟨mn| , with an arbitrary probability distribution p. After the time t, this state will evolve into To simplify the following calculation, we will consider the time average The time averaged probability of finally occupying the state r ∈  will be The latter equation follows since q r is a linear function of p and defines the transition matrix T. From what has been said above it is clear that T will be obtained by a summation over all eigenspaces of H 1 + H 2 . It proves to be independent of due to time averaging. After some computer-algebraic calculations, we obtain , (84) , (87) , (88) Here Φ(z, s, a) := ∑ k∈ℕ z k (k+a) s denotes the Lerch's transcendent, see Section 25.14 in [34]. It can be shown that T is a left stochastic matrix and leaves the probability distribution invariant that corresponds to a Gibbs state with inverse temperature 0 . It follows that Assumption 1 is satisfied and hence the results derived in Sections 2 and 3 hold for our example. We illustrate this by showing the three functions ΔQ, ΔS, and 0 ΔQ for −5 0 ≤ ≤ 5 0 in Figure 3 satisfying the Clausius inequalities (67). For this example, we make the following observation, which seems to be typical for NLS coupled to a heat bath: If the three-level system is initially hotter than the heat bath, 0 < < 0 , the maximal heat transfer |ΔQ| results for → 0, as expected. In contrast, the entropy transfer |ΔS| takes its maximum at a positive inverse temperature max , see Figure 3. This is remarkable in the sense that one might naively think that in nonequilibrium thermodynamics the identity ΔS = 0 ΔQ, of the inverse temperature is chosen as −5 0 ≤ ≤ 5 0 and the calculations have been done for 0 = 1. It is remarkable that for 0 < < 0 , the absolute value |ΔS| has its maximum not for = 0, as it is the case for | 0 ΔQ|, but for some positive inverse temperature of max ≈ 0.279896.
which holds for linear thermodynamics, could be weakened to a monotonic relation between ΔS and 0 ΔQ.
However, this is not correct: if one increases the temperature above 1∕ max , the reduced heat transfer | | 0 ΔQ | | also increases, while the entropy transfer |ΔS| decreases.

Summary and outlook
In this paper, we have presented an approach to the timehonored problem of the second law for a finite quantum system coupled to a heat bath. We have re-derived several known partial results, in part under weaker assumptions, and integrated them into a theory based on general Jequations. These resemble the famous Jarzynski equation and imply certain second law-like inequalities. It will be in order to provide a general survey that shows their logical dependencies, see Figure 4. The most general J-equation is (C5), the central (red) equation of Figure 4. It holds for two sequential measurements under rather general assumptions, see Theorem 6, and contains two undetermined probability distributions p and p (0) . There are two principal specialization paths that physically correspond to "work processes" (upward direction in Figure 4) and "heat processes" (downward direction in Figure 4).
For "work processes" performed on closed systems that are only marginally touched in this paper, the transition matrix T is bi-stochastic in the modified sense of Eq. (7). This entails the J-equation (27) in [15] (the upper blue equation in Figure 4) that can be further specialized according to the choice ofp. The usual Jarzynski equations are derived for the choice ofp = p, whereas the alternativẽ p = q := T p leads to a scenario reminiscent of earlier work of W. Pauli and F. Klein, see [15,16].
By contrast, the "heat processes" performed on systems without external forces but under contact with a heat bath are characterized by T p (0) = p (0) and lead to another special J-equation (19) (the lower green equation in Figure 4) that is of central importance for this work.
Again, there are two further options. The choicep = p and the restriction to probability distribution given by Gibbs states leads to (23) and, by means of Jensen's inequality (JI), to the relation (26). The latter states that, on statistical average, heat always flows from the hot system to the cold bath and vice versa.
For the analogous statement (68) about the average flow of entropy, we additionally required the two Clausius inequalities. The first one, ΔS ≤ ΔQ, is a simple consequence of the Gibbs inequality (GI). The second one, 0 ΔQ ≤ ΔS, follows via (JI) from the mentioned Jequation (19) and the choicep = q := T p.
In the following, we will relate our results to similar statements found in the relevant literature.
Jarzynski and Wójcik [19] consider two systems which initially have different temperatures, then interact weakly and finally (in the quantum case) are subjected to a separate energy measurement for both systems. They derive a Crooks-like equality, and from this a Jarzynski-type equation, Eq. (18) in [19] that corresponds to our Eq. (23). Important assumptions are: neglect of the interaction between both systems for the heat balance and microreversibility. In contrast, we will focus on the 1st system and describe the second one only in a general way by the transition matrix T. Our assumptions are weaker: T leaves invariant some Gibbs state without neglecting the interaction; time reversal invariance is not needed (and actually will be violated for the example presented in Section 5).
Jennings and Rudolph [20] also consider two systems, which, however, can also be initially entangled. The special case, which is interesting for our purposes, is that both systems are uncorrelated at the beginning and have different temperatures. A first Clausius inequality, corresponding to our (38), is derived from the property that the Gibbs state minimizes the free energy. From this directly, without using a Jarzynski-type equation, the heat flow inequality, Eq. (3) in [20], follows, which corresponds to our Eq. (26), but again assuming, as in [19], that the amount of heat emitted by the first system is exactly absorbed by the second one.
The second Clausius inequality that appears in our (67), can also be found in Chapter 4.1 of [21], and is proved there via the "monotonicity of the KL divergence". This proof is closely related to ours, since the said monotonicity follows from the general J-equation, see Appendix C. The following statements in [21] interpreting the second Clausius inequality as a form of the second law of stochastic thermodynamics should be taken with some caution, see the discussion above.
Another related result has been proven already in 1978 by Spohn [22]: for an open quantum mechanical system described by a quantum dynamical semigroup that leaves invariant a certain state 0 , the entropy production is nonnegative. The latter is defined as the time derivative of the KL divergence between t and 0 . This result has been recently reformulated in [23] in a way compatible with our approach; Eqs. (16) and (17) of that reference immediately imply the second Clausius inequality.
Summarizing the state of research, partial formulations of the second law for the coupling of an NLS to a heat bath can be found to a sufficient extent in recent years, but they have to be integrated into a unified theory and proved under conditions as weak as possible. This has been attempted in the present work.
Moreover, we have presented an analytically solvable example illustrating our approach. It consists of a threelevel system (a spin with s = 1) coupled to a harmonic oscillator. For this example, our central Assumption 1, saying that the transition matrix has a fixed point of Gibbs type, is exactly satisfied. It would be a task for the future to investigate the conditions under which this assumption holds exactly or approximately.

B.1 First proof
We write a as double sum according to (60) and add the same sum but with n and m interchanged. This yields and the analogous expression for T mn p (0) n , we obtain The first term in (B4) is non-negative and the second one vanishes according to ∑ and ∑ nm ( Here, we have used T that is left stochastic, see (5), and leaves p (0) fixed, see (10), according to Assumption 1. □

B.2 Second proof
The second proof is based on the cumulant expansion for a random variable X, see, e.g., 26.1.12 in [35], defining the cumulants In our case, we set X = ΔQ and t = −( − 0 ) and use Eq. (23) to obtain 0 = log 1 (23) = log Hence, This proves that a = 0 2 2 (ΔQ) ≥ 0 since the variance 2 (…) of every random variable is non-negative. □

Appendix C: General J-equation
We will sketch the general probabilistic framework, analogous to that in [15] and already used in Section 2 for a special case. It deals with two sequential measurements and the corresponding general J-equation. We have two sets of outcomes,  for the first and  for the second measurement. Further, there exists a probability distribution where T is a (left) stochastic matrix and p:  → [0, 1] a probability distribution. P will be used to calculate expectation values ⟨Y⟩ for random variables Y: For simplicity, we assume that  and  are finite and p i > 0 for all i ∈ . Letp:  → [0, 1] and p (0) :  → (0, 1) be two further probability distributions and define Then, the following holds.
The general J-equation (C5) is more of a template that can be used to generate further equations by choosing a special form of the general probability distributionp. Note that it is not required that the probability distribution p (0) is invariant under T; if this is the case and, moreover,  =  ≡  then the special form of Eq. (19) results.
The J-equation (27) in [15] follows for the choice of that leads to a modified bi-stochasticity of T in the sense of Eq. (25) in [15].
As for every Jarzynski-type equation, the application of Jensen's inequality (JI) using the concave function x ↦ log x yields a second law-like inequality. In the case of (C5), this inequality turns out to be equivalent to the "monotonicity of the KL divergence", see [21], if we set p j = q j for all j ∈  . This will be shown in the following.
We further obtain and ) .

(C16)
As mentioned in Section 1, the general J-equation belongs to the framework of stochastic thermodynamics and is as such neither quantum nor classical. Nevertheless, it will be instructive to sketch realizations of the framework in these two domains.
We begin with the quantum domain. Consider a finitedimensional system Σ 1 initially described by a statistical operator with spectral decomposition 1 = ∑ i x i P i such that 1 = Tr 1 = ∑ i x i Tr P i =:  In the example studied in this paper, the P i would be the eigenprojections of the Hamiltonian H and the x i the corresponding eigenvalues of 1 Z exp (− H). A first projective measurement corresponding to the complete family of mutually orthogonal projections (P i ) i∈ leaves 1 invariant. The system is then coupled to some auxiliary system Σ 2 with initially mixed state 2 and the total system undergoes a finite time evolution described by some unitary operator U defined in the total Hilbert space. Finally, a quantum measurement at Σ 1 is performed corresponding to a complete family of mutually orthogonal projections ( Q j ) j∈ . The probability q j of the outcome j ∈  of the final measurement is given by It is straightforward to check that the matrix T defined by (C20) is (left) stochastic using ∑ j Q j = .
We note that it is not necessary to take the total initial state as a product state 1 ⊗ 2 , although this is usually assumed in the literature on the second law, e.g., in p. 113 of [1], or pp. 230602−3 of [19], and also in this paper, see Section 2. But if we assume an arbitrary total initial state and perform the first projective measurement according to the family (P i ⊗ ) i∈ , then the resulting state will be ′ = ∑ i∈ (P i ⊗ ) (P i ⊗ ), which is not entangled but may, nevertheless, have some "classical" correlation. It yields the initial probabilities p i = Tr (P i ⊗ ) and analogously to (C20).
In the classical case, we work with a phase space (, d ) and an initial probability density satisfying The phase space is decomposed according to the finite partition  = ⨄ i∈  i and is correspondingly written as where and i is the characteristic function of  i for all i ∈ .
The time evolution of the classical system is described by a measure-preserving map U :  → , such that will be transformed into ′ = ⚬ U −1 . Finally, a discrete measurement is performed according to another finite partition  = ⨄ j∈  j . The probability q j of finding the system in the subset  j is given by It is straightforward to check that the matrix T defined by (C26) is (left) stochastic.