Thermodynamics and phase transition of BTZ black hole in a cavity

In this paper, we study the thermodynamics and phase transition of a BTZ black hole in a finite space region, namely a cavity. By imposing a temperature-fixed boundary condition on the wall of the cavity and evaluating the Euclidean action, we derive the thermodynamic quantities and then construct the first law of thermodynamics for a static and neutral BTZ black hole, a rotating BTZ black hole and a charged BTZ black hole, respectively. We prove that heat capacities of these three types of black holes are always non-negative. Considering a grand canonical ensemble, we find that the non-extreme rotating black hole and the charged black hole are locally thermodynamically stable by calculating the Hessian matrix of their internal energy. At the phase transition level, it shows that for the static and neutral BTZ black hole, the phase transition only exists between thermal AdS3 spacetime and the black hole. The temperature where the phase transition occurs is only determined by the cavity radius. For rotating and charged cases, there may exist an extra second-order phase transition between the black hole and the black hole-cavity merger state. The phase structure of a BTZ black hole in a cavity shows strong dissimilarities from that without the cavity.


I. INTRODUCTION
The heat capacity of a Schwarzschild black hole in asymptotically flat spacetime is negative, which leads the system to become thermodynamically unstable. It was then proposed by Hawking and Page that the Einstein equation with a negative cosmological constant admits a black hole solution [1], where the Anti-de Sitter (AdS) space acts as a box of finite volume to make the canonical ensemble well defined and the Hawking-Page phase transition (the phase transition between thermal AdS space and the black hole) was found.
Another method to thermally stabilize a black hole is to place it in a cavity [2,3]. Under this new boundary condition, York found that there exists a Hawking-Page-like phase transition. Afterwards, the charged black hole was investigated in a cavity in a grand canonical ensemble [4] and a canonical ensemble [5], where the similar phase transitions were found: the Hawking-Page-like phase transition in the grand canonical ensemble and the van der Waals-like phase transition in the canonical ensemble. The phase structures of other thermodynamic systems such as black branes [6][7][8][9], boson stars [10] and hairy black holes [11,12] in a cavity caught many interests. Recently, the thermodynamics in AdS space and in a cavity were compared based on various black holes such as the nonlinear electrodynamics black hole [13,14], the Gauss-Bonnet black hole [15] and the quintessence RN black hole [16]. Besides, it shows that the thermodynamic phase space of a black hole can be extended by regarding the volume of the cavity as the thermodynamic volume [17]. The phase transitions of the above black holes in a cavity demonstrate certain similarities and differences from the phase transitions of black holes in AdS space. However, these are all static black holes with dimensions no less than four. Consequently, it is nature to raise the questions that what will it be if the dimension is lower or if we introduce the angular momentum.
We start from considering a (2+1) dimensional black hole, namely BTZ black hole, which was first found by Banados, Teitelboim and Zanellit [18]. The BTZ black hole shows properties similar to a conventional (3+1) dimensional black hole. For example, a rotating BTZ black hole has both an inner and an outer horizon like the Kerr black hole, it has the "surface area" proportional entropy and it is fully characterized by the ADM mass, angular momentum and the electric charge [18,19]. The black hole solutions coupled different nonlinear electromagnetic fields were first studied in [20], which shows that the black holes are thermodynamically stable in a canonical ensemble. The thermodynamic geometry for BTZ black holes was also investigated intensively under different boundary conditions [21][22][23][24].
From the perspective of the phase transition, the BTZ black hole has also attracted many attentions. It shows that in three dimensional gravity, the phase transition between thermal AdS space and the black hole is also possible [25][26][27][28][29][30]. In three-dimensional gravity, there exists two distinct solutions, the BTZ black hole for M ≥ 0 and the thermal soliton for global AdS 3 with M = −1, i.e., the thermal AdS 3 space [30][31][32]. However, it was pointed out that the phase transition between thermal AdS 3 space and the massive BTZ black hole is discontinues rather than of the Hawking-Page since there is a mass gap between thermal AdS 3 space and the BTZ black hole [33]. Thus Myung introduced the mass of conical singularities and then verified that the phase transition could be possible through the off-shell approach [34]. Later on, the phase transition was revisited and it was found that the continuous off-shell free energy describing tunneling effect can be realized through non-equilibrium solitons [35]. It was not long ago, authors in [36] proposed that the TT deformed CFT 2 locates at the finite radial position of AdS 3 , which further promotes us to investigate the (2+1) dimensional black hole in a cavity.
The structures of this paper are as follows: In section II, we obtain the free energy by means of the Euclidean action for three types of BTZ black holes in a cavity: a static and neutral black hole, a rotating black hole and a charged black hole. As expected, the black holes in cavities are thermodynamically stable, so we turn to consider the phase transitions between thermal AdS 3 space, the black hole and the boundary state with the minimal free energy in section III. We fully study the phase transition in a grand canonical ensemble and exhibit the phase diagrams. The final discussions are presented in section IV. The locally thermodynamic stability analysis of the rotating BTZ black hole and the charged BTZ black hole in a cavity is performed in appendix A. Furthermore, we present the phase diagrams of BTZ black holes without the cavity in appendix B to make a comparison with the case of the cavity existing.

II. BLACK HOLE SOLUTIONS AND THERMODYNAMICS
In this section, we briefly review the derivation of the black hole solutions from the Lagrangian formula. By imposing the temperature-fixed boundary condition on the wall of the cavity and evaluating the Euclidean action, we obtain the corrective thermodynamic quantities of the system in a cavity. Our discussions will be divided into three parts including a static and neutral BTZ black hole, a rotating BTZ black hole and a charged BTZ black hole. The concrete discussions are as follows.

A. Static and Neutral BTZ Black Hole
We consider the action of a (2+1) dimensional black hole which consists of a bulk term and a boundary term [18] where Λ is the three dimensional cosmological constant, h is the determinant of the induced metric on the boundary ∂M, K is the extrinsic curvature on the boundary and K 0 is a counter term to avoid the divergence of the action. Varying the action gives the vaccum field equation in three-dimensional version The metric for the static symmetric black hole has the following ansatz Further solving the field equation with the given ansatz gives where M is the ADM mass and l is the AdS radius, which is related to the cosmological constant as Λ = −1/l 2 .
We now study the thermodynamics of the black hole in a cavity. It shows that the statistical mechanical partition function can be related to the on-shell Euclidean action in the semi-classical approximation [2] Z ≃ e −S E , where the Euclidean action S E is obtained by the analytic continuation of the action and so is the Euclidean time According to statistical mechanics, the relation between the free energy and the partition function is In addition, to obtain the expression of temperature, we impose the boundary condition of the fixed temperature on the wall of the cavity by Euclidean time [13] dτ = 1 On the other hand, the period of τ is given by the reciprocal of Hawking temperature 1/T h , which implies The entropy of the BTZ black hole is given by [18] S = 4πr + .
The concrete expression for the temperature of a static and neutral BTZ black hole in a cavity according to Eq. (4) and Eq. (9) is where f (r B ) = −r 2 + /l 2 + r 2 B /l 2 . For the static symmetrically metric, we evaluate the Euclidean action related to the metric (3) and (4) in a cavity Thus, the Helmholtz free energy is The internal energy of the black hole in a cavity is obtained through the thermodynamic The heat capacity will be helpful to investigate the thermodynamic stability of the black hole. Here, it shows straightforwardly that the heat capacity at the constant cavity radius where we have used r + < r B and T > 0 to obtain the inequality. This result implies that for a given temperature and a given cavity radius, there is only one branch of black hole and it is thermodynamically stable.

B. Rotating BTZ Black Hole
The metric of a (2+1) dimensional stationary rotating black hole is given by [18] where h(r) is the shift function. Solving the field equation yields where J is interpreted as the angular momentum.
According to Eq. (9) and Eq. (17), the temperature of the rotating BTZ black hole in a cavity is given by . Evaluating the Euclidean action for the rotating black hole gives the Gibbs free energy where we have used Eq. (18). For the rotating black hole, it is reasonable to interpret the angular momentum and its conjugated quantity as the volume and the negative pressure respectively. We define the angular velocity, i.e., the conjugated quantity of angular momentum as .
The Helmholtz free energy thus can be given by The internal energy is It is easy to verify the following thermodynamic relations We then establish the first law of thermodynamics from those equations and quantities above The quantity f (r B ) that appears under the root sign should be positive to keep the quantities physically meaningful Besides, the temperature of the rotating black hole should be non-negative, and thus we have which gives a stricter constraint than the cavity does since r + < r B . Moreover, this constraint equation can be used to prove that the heat capacity for the rotating black hole at the constant cavity radius and angular momentum is non-negative and so is the heat capacity at the constant cavity radius and the angular velocity The positive heat capacity is sufficient to deduce that the non-extreme rotating black hole in a cavity is locally thermodynamically stable in a canonical ensemble. In a grand canonical ensemble, we also find that the non-extreme rotating black hole in a cavity is locally thermodynamically stable by analyzing the Hessian matrix of the internal energy. The detailed proof is presented in appendix A.

C. Charged BTZ Black Hole
The action of the black hole coupled to electromagnetism is given by [37] where F µν is the electromagnetic field tensor, n ν is the unit outward-pointing normal vector of ∂M and A µ is the electromagnetic potential. Notice the last term in the action is to fix the charge on the boundary [4]. Varying the action with respect to g αβ and A µ gives the equations of motion We assume that the (2+1) dimensional static symmetrically solution has the following form The simplest case is, the electromagnetic field tensor has no components along the φ direction which ensures that the field is purely electric for an stationary observer. Here, we write down the metric straightforwardly [37] f where Q is the electric charge of the black hole.
The temperature of the charged BTZ black hole in a cavity according to Eq. (9) and Eq.
(32) is given by We evaluate the Helmholtz free energy through the Euclidean action The internal energy thus can be written as We define the potential conjugated to the electric charge which can be regarded as the negative pressure while the charge is regarded as the volume in the thermodynamic system. Therefore, the Gibbs free energy is given by It is straightforward to verify that the temperature can be expressed as the differentiation of the thermal energy E respect to entropy S From Eq. (33) to Eq. (38), we establish the first law of thermodynamics Similarly, the charge of the black hole in a cavity is supposed to satisfy The constraint on the charge by requiring that the temperature is non-negative reads which can also be easily verified to be a stricter constraint. It shows that the heat capacity at the constant cavity radius and charge and the heat capacity at the constant cavity radius and electric potential The positive heat capacity implies that the non-extreme charged BTZ black hole in a cavity in a canonical ensemble is locally thermodynamically stable. The detailed proof is presented in appendix A, where we also prove that the charged BTZ black hole in a cavity in a grand canonical ensemble is locally thermodynamically stable.
Implementing a same procedure, the free energy of thermal AdS space can be calculated by means of the Euclidean action and we finally arrive at In order to simplify calculations, we rescale thermodynamic quantities by r B which is actually equivalent to setting r B = 1. Without loss of generality, we only consider the case when ω and Φ are positive. In the following part, we discuss the phase transitions of the three types of black holes, respectively.

A. Static and Neutral BTZ Black Hole
The temperature (11) and free energy (13) of the static and neutral black hole are both functions of the horizon radius and AdS radius: T ( r + , l), F ( r + , l). For the thermal AdS space, the free energy (45) is only the function of the AdS radius: F AdS ( l). We solve the equation F ( r + , l) = F AdS ( l) and plug its solution r + ( l) into the expression of temperature (11), which yields the temperature where the phase transition occurs We can also write it as T c = 1/2πr B , so that the phase transition temperature is only determined by the radius of the cavity. Interestingly, without a cavity, the the phase transition temperature T c = 1/2πl [35], which only relates to the AdS radius.

B. Rotating BTZ Black Hole
We consider the thermodynamic system in a grand canonical ensemble, which has the fixed temperature and angular velocity. The related thermodynamic quantities are T ( r + , J, l), G( r + , J, l) and ω( r + , J, l) in Eq. (18), Eq. (19) and Eq. (20). ω( r + , J, l) can be inverted to give the angular momentum J( r + , ω, l), which can be inserted in T ( r + , J, l) and G( r + , J, l) to yield T ( r + , ω, l) and G( r + , ω, l). It turns out that our expressions for the temperature, angular velocity and free energy are reasonable when r + < r B . For the case that the event horizon merges with the cavity, we are supposed to discuss it separately. We where we have used the expression of the energy (22). On this boundary we have ∂ G/∂ J = − ω < 0, which indicates that the lowest free energy point is located at the point with the maximal J. The lowest free energy point of this boundary is marked in red and dubbed as M state. The Gibbs free energy of M State thus is The lowest free energy is also located at the point with the maximal Q, which is dubbed as M State and marked in red. Therefore, the Gibbs free energy of M State is As AdS radius l increases, the area of Thermal AdS in phase space also increases.

IV. CONCLUSION AND DISCUSSION
Beginning with the gravitational action, we derived the spacetime solution of a static and neutral BTZ black hole. Through imposing the boundary condition, i.e., assigning the period of Euclidean time to 1/T f (r B ), we obtained the free energy of the black hole.
Then by computing the Euclidean action and free energy, we constructed the first law of thermodynamics of the system in a cavity. Analogously, the thermodynamic quantities of the rotating black hole and the electromagnetic field coupled black hole solutions were obtained. We proved that the heat capacities of these black holes in a canonical or grand canonical ensemble are always non-negative in appendix A, where we also proved that the The phase transitions of BTZ black holes without cavity were discussed in appendix B.
We found that the phase transitions of a cavity existing and without a cavity show some dissimilarities. On the one hand, the second-order phase transition only exists in a cavity but no for the cavity absenting. On the other hand, as the AdS radius increases, the area of Thermal AdS in phase space increases in a cavity. For the case that the cavity does not exist, the area of Thermal AdS always decreases with an increasing AdS radius.

Acknowledgments
We are grateful to Peng Wang, Bo Ning, Hanwen Feng and Yihe Cao for useful discussions and valuable comments. This work is supported by NSFC (Grant No.11947408 and   12047573).
Appendix A: Thermodynamic stability of BTZ black hole in a cavity In this appendix, we are about to prove that the four types of heat capacities C r B ,J , C r B ,ω , C r B ,Q , C r B ,Φ are non-negative as well as to analyse the thermodynamic stability of the BTZ black hole in a cavity. Notice that the heat capacity can always be written in form where the temperature T we always assume to be non-negative, and hence the heat capacity has the same sign of ∂T /∂r + . To simplify the calculation, we only consider this term.
According to the expression of temperature (18), we have It is easy to check that the denominator is positive since r + < r B and J ≤ 2r 2 + /l. We define a new function equals to the numerator g(J 2 ) = 4J 2 l 2 r 2 + −6r 2 B r 2 + + 3r 4 B + r 4 + + J 4 l 4 3r 2 which is regarded as a quadratic function of J 2 . It follows that the signs of ∂T /∂r + and g(J 2 ) are the same. On the endpoints of the interval (0, J 2 max ), we have g (0) = 16r 6 + r 4 B > 0, where J max = 2r 2 + /l is the maximum angular momentum of a BTZ black hole. The symmetry axis of g(J 2 ) is given by .

(A5)
We plot the curves of J 2 sa l 2 /r 4 B and J 2 max l 2 /r 4 B with respect to r + /r B in the left panel of FIG. 5. The characteristics of g(J 2 ) on the interval (0, J 2 max ) are discussed in three cases: • If r + /r B > √ 6/3, g(J 2 ) will open upwards and J 2 max < J 2 sa , which means that the values of g(J 2 ) on the interval (0, J 2 max ) are positive.
• If r + /r B = √ 6/3, g(J 2 ) will be a linear function about J 2 , which means that the values of g(J 2 ) on the interval (0, J 2 max ) are always positive.
• If r + /r B < √ 6/3, g(J 2 ) will open downwards and J 2 sa < J 2 max , which also ensures that g(J 2 ) on the interval (0, J 2 max ) is always positive.
Therefore, we infer that C r B ,J ≥ 0.
We invert Eq. (20) to obtain J(r + , r B , ω, l), which can be inserted into the expression of temperature (18) to give T (r + , r B , ω, l) Differentiating T with respect to r + gives Thus the heat capacity C r B ,ω ≥ 0.
According to Eq. (33), we arrive at of which the denominator is positive while the numerator is a quadratic function of Q 2 , which is denoted as k(Q 2 ). On the endpoints of the interval (0, Q 2 max ), we have where Q max = 2r + /l is the maximal charge that a BTZ black hole could have. The symmetry axis of k(Q 2 ) is We plot the curves of Q 2 sa l 2 /r 2 B and Q 2 max l 2 /r 2 B with respect to r + /r B in the right panel of FIG. 5. Further discussions are as follows: • If r + /r B > e −1/2 , k(Q 2 ) will open upwards and Q 2 sa > Q 2 max , which means k(Q 2 ) is positive on the interval (0, Q 2 max ).
• If r + /r B = e −1/2 , k(Q 2 ) will be a linear function with respect to Q 2 and thus k(Q 2 ) is always positive on the interval (0, Q 2 max ).
Therefore, we conclude C r B ,Q ≥ 0.
To obtain the heat capacity at constant r B and Φ, we first use Eq. (36) to give Q(r + , r B , Φ, l), then we insert it into the expression of temperature (33). A straightforward calculation yields where A, a, b, c are always positive. It follows that the sign of ∂T /∂r + is the same as the expression in the brackets of the first line, which can be regarded as a quadratic function of Φ 2 . The symmetry axis of the quadratic function −b/2a < 0, which implies that, for any given Φ the quadratic function is always positive since it opens upwards and Φ 2 is non-negative. Therefore, we have C r B ,Φ ≥ 0.
In a canonical ensemble, a stable equilibrium states that the internal energy is a locally minimum against the virtual variation δS, and hence the positive heat capacities are sufficient to ensure that the non-extreme black holes are locally thermodynamically stable. In a grand canonical ensemble, a stable equilibrium states that the Gibbs free energy is a locally minimum against the virtual variation (δS, δV ). A sufficient condition for this is the secondorder differential δ 2 G > 0. This could be transformed into requiring δ 2 E > 0. Equivalently, the Hessian matrix of δ 2 E in coordinates (δS, δV ) should be positive definite.
For the rotating BTZ black hole in a cavity, the Hessian matrix of δ 2 E in coordinates (S, J) is The first diagonal element ( ∂T ∂S ) J = 1 4π ( ∂T ∂r + ) J , which has been proved to be positive. The second diagonal element which can be easily verified to be positive by using the condition r + < r B and J ≤ 2r 2 + /l. The determinant of the Hessian matrix .

(A14)
Notice that determinant is only positive when J < 2r 2 + /l 2 , that is, T = 0. Therefore, we conclude that the non-extreme rotating BTZ black hole in a cavity is locally thermodynamically stable.
For the charged BTZ black hole in a cavity, the Hessian of the second order differential of energy δ 2 E in coordinates (S, Q) is The first diagonal element is positive, and the second diagonal element reads which is also positive. The determinant of the Hessian is The denominator of the expression is apparently positive. The numerator can be regarded as a quadratic function of Q 2 and we denote it as h(Q 2 ). The symmetric axis of h(Q 2 ) is given by We plot the curves of Q 2 sa l 2 /r 2 B and h min (Q 2 ) with respect to r + /r B in FIG. 6, where we find that the values of r + /r B that make Q 2 sa positive also make h min (Q 2 ) positive. That is to say, h min (Q 2 ) has to be positive since Q 2 sa must be positive. Therefore, we conclude that the system of a charged BTZ black hole in a cavity is locally thermodynamically stable.

Appendix B: Phase Transitions of BTZ Black Hole without Cavity
It is of great interest to investigate the phase transitions of a BTZ black hole without a cavity so as to make a comparison with the case of the cavity existing. For a asymptotically flat black hole in a cavity, thermodynamic quantities without a cavity could be straightforwardly obtained by imposing r B → ∞. However, this does not hold for the BTZ black hole whose spacetime is not asymptotically flat. For the static and neutral one, the thermodynamic quantities are (B1) The free energy of thermal AdS space is