1 Introduction

Alternate or extended theories of gravity have aroused considerable interest recently in view of difficulties with the general theory of relativity to explain anomalous behaviour of gravitational phenomena such as the late time expansion of the universe. The mathematical reason for this interest is that the higher order derivative curvature terms make a nonzero contribution to the dynamics. In particular, Einstein–Gauss–Bonnet (EGB) theory has proved promising in this regard, and therefore is the most extensively studied. It appears in a natural way in the effective action of heterotic string theory in the low energy limit [1]. Several new results have been reported especially dealing with the aspect of gravitational collapse. The causal structure of the singularities is different from general relativity for inhomogeneous distribution of dust and null dust [2].

Historically black hole models in EGB theory have been intensively studied. Boulware and Deser [3] generalized the higher dimensional solutions in the Einstein theory due to Tangherlini [4], and by Myers and Perry [5] to include the contribution of the EGB theory with quadratic curvature terms. Wheeler [6], Torii and Maeda [7] and Myers and Simons [8] have also considered black hole solutions in EGB theory. Inhomogeneous collapse of dust, that is, a pressure-free fluid with non-interacting particles, was studied by Maeda [9]. However, explicit exact solutions were obtained by Jhingan and Ghosh [10]. Dadhich et al. [11] proved that the constant density Schwarzschild interior solution is universal in the sense that it is valid in both higher dimensional Einstein theory and in EGB gravity. The matching of these exterior metrics to an interior for brane world stars to produce analytical models was investigated by Casadio and Ovalle [12]. The matching of isolated masses to a Schwarzschild exterior was analysed by Clifton et al. [13].

Models of compact spheres, with a static spherically symmetric metric, in general relativity have been widely studied in the past. A variety of exact solutions to the Einstein and Einstein–Maxwell system of field equations, have been found for neutral and charged matter distributions, respectively. For a physically acceptable model several conditions have to be satisfied: the gravitational potentials and matter variables are well behaved and regular in the stellar interior, the interior metric matches smoothly to the exterior Schwarzschild spacetime, the speed of sound is less than the speed of light and there is stability with respect to radial perturbations. A recent example of a charged anisotropic sphere in general relativity that can be related to observed stellar objects is given by Sunzu et al. [14]. However, in EGB theory there is less known about the interior of compact spheres. This is largely true because of the higher degree of nonlinearity in the field equations that arises because of the appearance of the terms associated with the Gauss–Bonnet coupling constant. Some progress can be made if we assume that the spacetime is specified and this then defines the matter variables; in this context Abbas et al. [15] generated a model for an anisotropic compact body in modified EGB gravity. However, in general the nonlinear EGB equations need to be solved, a much more difficult task than in general relativity, to produce the metric potentials in the interior. Exact solutions to the EGB equations are necessary to probe the physical features of the body. The physical features mentioned above in general relativity for a sphere will also be applicable for a realistic compact body in the EGB case. However, the external metric is now the 5-dimensional Boulware–Deser spacetime (in contrast to the Schwarzschild metric of general relativity). An exact model in EGB theory, which demonstrates matching to the Boulware–Deser metric, was found by Dadhich et al. [11] assuming the interior to have constant density. This suggests that we should investigate variable density models.

To date, there appears to exist no complete stellar model in 5-dimensional EGB theory for the perfect fluid configuration of static spherically symmetric matter. The constant density configuration of Dadhich et al. [11] and the static spherically symmetric star of Kang et al. [16] need to satisfy the junction conditions of EGB gravity so that matching is possible at the stellar surface. The junction conditions for EGB were derived in Davis [17] which are nontrivial and very different from general relativity. Note that the variable density model of Kang et al. [16] requires a further integration to produce an exact solution. As far as we are aware there is no known interior variable density spherically symmetric exact solution to the EGB field equations. This is the object of our study in this paper and to highlight the role of junction conditions of [17]. The problem of finding an exact interior metric in EGB theory for spherically symmetric distribution reduces to solving a system of three nonlinear partial differential equations in four unknowns: the dynamical quantities pressure and energy density and two gravitational potentials. As the system is under-determined, it is necessary to specify an additional constraint in order to close the system. This process is analogous to the standard Einstein gravity case. Traditionally, the approach has been to specify one of the four unknowns and by integration to resolve the remaining three. The reader is referred to the comprehensive listing of exact solutions found in this way by Stephani et al. [18] and Delgaty and Lake [19] for the Einstein case. When one of the field equations is replaced by the equation of hydrodynamic equilibrium, namely the vanishing divergence of the energy momentum tensor, then it is prudent to invoke an equation of state relating the energy density and pressure. This appears to have been the approach of [16] in their attempt to find an exact model. Interestingly the interior model presented in [16] generates the well-known vacuum metric [3] of EGB in the limit of vanishing pressure and density.

Recently Izaurieta and Rodriguez [20] argued that the 4-dimensional gravitational field may effectively emerge from 5-dimensional EGB theory. The addition of diffeomorphism invariant terms to the action principle leads to second order equations of motion and are therefore physically palatable. Consequently investigations in five dimensions are laboratories for examining the impact of extra dimensions on physics, for example by demonstrating that a new exact solution satisfies elementary physical properties demanded of astrophysical objects. In four dimensions the higher order curvature terms in EGB theory do not affect gravity. It is only with spacetime dimensions five or greater that the Gauss–Bonnet term contributes nontrivially to the dynamics. The simplest case in higher dimensions is five, which has been extensively studied in several physical scenarios. We point out that the addition of the extra spatial dimension has been investigated by Kang et al. [16] in static stars, Brihaye and Reidel [21] in rotating boson stars, Ghosh et al. [2] in spherical collapsing bodies, and Chervon et al. [22] in emergent universe models. The presence of additional dimensions may have a dramatic effect on the behaviour of matter. For example Maeda [9] showed that massive timelike naked singularities may exist in five dimensions and massless ingoing null naked singularities are formed in dimensions greater than five in EGB theory. Massive timelike naked singularities do not exist in general relativity. Also note that the dynamics of charged radiating gravitational collapse of shear-free matter has been studied recently in the so-called modified Gauss–Bonnet gravity [23].

Our intention in this paper is to solve the nonlinear EGB equations for a static spherically symmetric matter distribution. In Sect. 2 we briefly outline the basic equations in EGB gravity. The field equations in 5-dimensional EGB gravity are presented for a spherically symmetric metric, and they are then transformed to an equivalent form in Sect. 3. An exact solution to the EGB equations is found in Sect. 4. In Sect. 5 a corresponding exact solution, in the Einstein case, to the 5-dimensional case is presented. The physical features of the model are investigated in Sect. 6. Some concluding remarks are made in Sect. 7. In the appendix we present several exact solutions in the Einstein case in five dimensions by specifying a form for one of the metric potentials.

2 Einstein–Gauss–Bonnet gravity

The Gauss–Bonnet action in five dimensions is written as

$$\begin{aligned} S = \int \sqrt{-g} \left[ \frac{1}{2} \left( R - 2\Lambda + \alpha L_{\mathrm{GB}}\right) \right] d^5 x + S_{ \text{ matter }}, \end{aligned}$$
(1)

where \(\alpha \) is the Gauss–Bonnet coupling constant. The strength of the action \(L_{\mathrm{GB}}\) lies in the fact that despite the Lagrangian being quadratic in the Ricci tensor, Ricci scalar and the Riemann tensor, the equations of motion turn out to be second order quasilinear and are compatible with a theory of gravity. The Gauss–Bonnet term is of no consequence for \(n \le 4\) but is generally nonzero for \(n > 4\).

The EGB field equations may be written as

$$\begin{aligned} G_{a b} + \alpha H_{a b} = T_{a b}, \end{aligned}$$
(2)

with metric signature \((- + + + +)\) where \(G_{ab}\) is the Einstein tensor. The Lanczos tensor is given by

$$\begin{aligned} H_{a b}= & {} 2 \left( R R_{a b} - 2 R_{a c}R^{c}_{b} - 2 R^{c d} R_{a c b d} + R^{c d e}_{a} R_{b c d e} \right) \nonumber \\&- \frac{1}{2} g_{a b} L_{\mathrm{GB}}, \end{aligned}$$
(3)

where the Lovelock term has the form

$$\begin{aligned} L_{\mathrm{GB}} = R^2 + R_{a b c d} R^{a b c d} - 4R_{c d} R^{c d}. \end{aligned}$$
(4)

3 Field equations

The generic 5-dimensional line element for static spherically symmetric spacetimes is taken as

$$\begin{aligned} \mathrm{d}s^{2}&= -e^{2 \nu } \mathrm{d}t^{2} + e^{2 \lambda } \mathrm{d}r^{2} \nonumber \\&\quad + r^{2} \left( \mathrm{d}\theta ^{2} + \sin ^{2} \theta \mathrm{d} \phi ^2 + \sin ^{2} \theta \sin ^{2} \phi \mathrm{d}\psi ^2 \right) , \end{aligned}$$
(5)

where \(\nu (r)\) and \(\lambda (r)\) are the gravitational potentials. We utilise a comoving fluid velocity of the form \(u^a = e^{-\nu } \delta _{0}^{a}\) and the matter field is that of a perfect fluid with energy momentum tensor \(T_{a b} = (\rho + p) u_a u_b + p g_{a b}\). Accordingly the EGB field Eq. (2) reduces to

$$\begin{aligned} \rho&= \frac{3}{e^{4 \lambda } r^{3}} \left( 4 \alpha \lambda ^{\prime } + r e^{2 \lambda } - r e^{4 \lambda } - r^{2} e^{2 \lambda } \lambda ^{\prime } - 4 \alpha e^{2 \lambda } \lambda ^{\prime } \right) , \end{aligned}$$
(6)
$$\begin{aligned} p&= \frac{3}{e^{4 \lambda } r^{3}} \left( - r e^{4 \lambda } + \left( r^{2} \nu ^{\prime } + r + 4 \alpha \nu ^{\prime } \right) e^{2 \lambda } - 3 \alpha \nu ^{\prime } \right) , \end{aligned}$$
(7)
$$\begin{aligned} p&= \frac{1}{e^{4 \lambda } r^{2}} \left( -e^{4 \lambda } - 4 \alpha \nu ^{\prime \prime } + 12 \alpha \nu ^{\prime } \lambda ^{\prime } - 4 \alpha \left( \nu ^{\prime } \right) ^{2} \right) \nonumber \\&\quad + \frac{1}{e^{2 \lambda } r^{2}} \left( 1 - r^{2} \nu ^{\prime } \lambda ^{\prime } + 2 r \nu ^{\prime } - 2 r \lambda ^{\prime } + r^{2} \left( \nu ^{\prime } \right) ^{2} \right) \nonumber \\&\quad + \frac{1}{e^{2 \lambda } r^{2}} \left( r^{2} \nu ^{\prime \prime } - 4 \alpha \nu ^{\prime } \lambda ^{\prime } + 4 \alpha \left( \nu ^{\prime } \right) ^{2} + 4 \alpha \nu ^{\prime \prime } \right) . \end{aligned}$$
(8)

Note that the system (6)–(8) comprises three field equations in four unknowns, which is similar to the standard Einstein case for spherically symmetric perfect fluids. Observe that the vacuum metric describing the gravitational field exterior to the 5-dimensional static perfect fluid may be described by the Boulware and Deser [3] spacetime as

$$\begin{aligned} \mathrm{d}s^2&= - F(r) \mathrm{d}t^2 + \frac{\mathrm{d}r^2}{F(r)} \nonumber \\&\quad + r^{2} (\mathrm{d}\theta ^{2} + \sin ^{2} \theta \mathrm{d}\phi + \sin ^{2} \theta \sin ^{2} \phi \mathrm{d}\psi ), \end{aligned}$$
(9)

where

$$\begin{aligned} F(r) = 1 + \frac{r^2}{4\alpha } \left( 1 - \sqrt{1 + \frac{8M\alpha }{r^4}} \right) . \end{aligned}$$

In the above M is associated with the gravitational mass of the hypersphere. The exterior solution is not unique and neither is there a Birkhoff type theorem analogous to the 4-dimensional gravity case. At least this metric involves branch cuts. Bogdanos et al. [24] have analysed the 6-dimensional case in EGB and demonstrated the validity of Birkhoff’s theorem for this order.

We invoke the transformation \(e^{2 \nu } = y^{2}(x) \), \(e^{-2 \lambda } = Z(x)\) and \(x = C r^{2}\) (C being an arbitrary constant) which was utilised successfully by Durgapal and Banerji [25], Finch and Skea [26] and Hansraj and Maharaj [27] to generate new exact solutions for neutral and charged isotropic spheres. For applications to charged anisotropic relativistic matter with this transformation see the recent works of Mafa Takisa and Maharaj [28] and Maharaj et al. [29] in four dimensions. The field equations (6)–(8) may be recast as

$$\begin{aligned}&3 \dot{Z} + \frac{3 (Z - 1) (1 - 4 \alpha C \dot{Z} )}{x} = \frac{\rho }{C}, \end{aligned}$$
(10)
$$\begin{aligned}&\frac{3 (Z - 1)}{x} + \frac{6 Z \dot{y}}{y} - \frac{24 \alpha C (Z - 1) Z \dot{y}}{x y} = \frac{p}{C}, \end{aligned}$$
(11)
$$\begin{aligned}&2 x Z \left( 4 \alpha C [Z - 1] - x \right) \ddot{y} - \big (x^{2} \dot{Z} + 4 \alpha C \big [ x \dot{Z} - 2 Z + 2 Z^{2} \nonumber \\&\quad -3 x Z \dot{Z} \big ] \big ) \dot{y} - \left( 1 + x \dot{Z} - Z \right) = 0, \end{aligned}$$
(12)

where the last equation is called the equation of pressure isotropy. Equation (12) has been arranged as a second order differential equation in y, which for some analyses in the 4-dimensional Einstein models, proves to be a useful form. Functional forms for Z(x) may be selected a priori so as to allow for the complete integration of the field equations. For example, the form \(Z=1+x\) produces a higher dimensional Schwarzschild solution with constant density. This corroborates the result of Dadhich et al. [11] that the constant density Schwarzschild solution is universal – that is it is independent of dimension. We have also found a number of other cases for Z for which (12) is integrable and these will be dealt with in the future.

For the present work it should be noted that (12) may also be regarded as a first order ordinary differential equation in Z, and may be expressed in the form

$$\begin{aligned}&\big (x^{2} \dot{y} + x y + 4 \alpha C x \dot{y} - 12 \alpha C x \dot{y} Z \big ) \dot{Z} + 8 \alpha C \left( \dot{y} - x \ddot{y} \right) Z^{2} \nonumber \\&\quad +\big (2 x^{2} \ddot{y} + 8 \alpha C x \ddot{y} - 8 \alpha C \dot{y} - y \big ) Z + y = 0. \end{aligned}$$
(13)

This is an Abel equation of the second kind for which few solutions are known. However, note that by choosing forms for y should in theory result in the expressions for Z by integration. Therefore we seek choices for the metric potential y which will allow for a complete resolution of the geometrical and dynamical variables.

4 New exact interior solution in the EGB case

Locating exact solutions for (13) is difficult to achieve in view of its nonlinearity. One strategy is to investigate the consequence of one or more of the coefficients to vanish. In requiring that the coefficient of \(Z^2\) vanishes we obtain the restriction

$$\begin{aligned} \dot{y} - x \ddot{y} = 0, \end{aligned}$$
(14)

which may be solved to give

$$\begin{aligned} y = \frac{1}{2} C_{1} x^{2} + C_{2}, \end{aligned}$$
(15)

where \(C_{1}\) and \(C_{2}\) are constants of integration. Note that the restriction (14) simplifies (13) but does not remove its nonlinearity. Inserting (15) into (13) the condition of pressure isotropy is transformed to

$$\begin{aligned}&\left[ 3 C_{1} x^{3} + 8 \beta C_{1} x^{2} + 2 C_{2} x - 24 \beta C_{1} x^{2} Z \right] \dot{Z} \nonumber \\&\quad + \left[ 3 C_{1} x^{2} - 2 C_{2} \right] Z + C_{1} x^{2} + 2 C_{2} = 0, \end{aligned}$$
(16)

where for convenience we set \(\beta = \alpha C \). Renaming \(\frac{C_1}{C_2} = \epsilon \) Eq. (16) assumes the simpler form

$$\begin{aligned}&\big [ 3 \epsilon x^{3} + 8 \beta \epsilon x^{2} + 2 x - 24 \beta \epsilon x^{2} Z \big ] \dot{Z} \nonumber \\&\quad + \big [ 3 \epsilon x^{2} - 2 \big ] Z + \epsilon x^{2} + 2 = 0, \end{aligned}$$
(17)

which will aid our graphical investigations. The parameters \(\epsilon \) and \(\beta \) will have to be assigned values to obtain the qualitative features of the eventual model. On solving (17), we obtain the solutions

$$\begin{aligned} Z = \frac{3 \epsilon x^{2} + 8 \beta \epsilon x + 2 \pm \Upsilon }{24 \beta \epsilon x}, \end{aligned}$$
(18)

where

$$\begin{aligned} \Upsilon&= \big (4 (1 - 16 \beta \epsilon x) + 4 \epsilon \big (16 \beta ^{2} \epsilon + 3 + 144 \beta ^{2} \epsilon C_{3} \big ) x^{2}\\&\quad +3 \epsilon ^{2}(3 x^{4} + 32 \beta x^{3}) \big ) ^{\frac{1}{2}}, \end{aligned}$$

and \(C_{3}\) is an integration constant.

With the help of (18) and (10) the energy density for the EGB case is given by

$$\begin{aligned} \frac{\rho }{C}&= \frac{27 \epsilon ^{2} x^{4} - 48 \beta \epsilon ^{2} x^{3} - 32 \beta ^{2} \epsilon x }{48 \beta \epsilon ^{2} x^{4}} \nonumber \\&\quad + \frac{ 4 - 4 (1 - 4 \beta \epsilon x) \Upsilon }{48 \beta \epsilon ^{2} x^{4}} \nonumber \\&\quad - \frac{ x (3 \epsilon x^{2} + 16 \beta \epsilon x - 2) \Upsilon ^{\prime } - (\Upsilon - x \Upsilon ^{\prime } ) \Upsilon }{48 \beta \epsilon ^{2} x^{4}}, \end{aligned}$$
(19)

while the pressure p has the form

$$\begin{aligned} \frac{p}{C}&= \frac{ 27 \epsilon ^{2} x^{4} + 96 \epsilon ^{2} \beta x^{3} + 8 \epsilon (3 + 32 \epsilon \beta ^{2} ) x^{2} }{24 \epsilon \beta x ^{2} (\epsilon x^{2} + 2)} \nonumber \\&\quad - \frac{64 \epsilon \beta x - 4 + x (3 \epsilon x^{2} + 16 \epsilon \beta x - 2 + 2 \Upsilon ) \Upsilon }{24 \epsilon \beta x^{2} (\epsilon x^{2} + 2)}, \end{aligned}$$
(20)

via (11). The adiabatic sound-speed parameter is found to be

$$\begin{aligned} \frac{\mathrm{d} p}{\mathrm{d} \rho } = \frac{2 \epsilon x^{2} U(x)}{ \left( \epsilon x^{2} + 2 \right) ^{2} V(x) }, \end{aligned}$$
(21)

where U(x) and V(x) are, respectively, given by

$$\begin{aligned} U(x)&= - 96 \epsilon ^{3} \beta x^{5} + 4 \epsilon ^{2} (15 - 128 \epsilon \beta ^{2} ) x^{4} \\&\quad + 384 \epsilon ^{2} \beta x^{3} - 16 \epsilon x^{2} + 128 \epsilon \beta x - 16 \\&\quad + 8 (\epsilon x^{2} + 1 ) \Upsilon ^{2} - 4 x (\epsilon x ^{2} + 2 ) \Upsilon \Upsilon ^{\prime } \\&\quad + 2 (3 \epsilon ^{2} x^{4} + 24 \epsilon ^{2} \beta x^{3} - 4 \epsilon x ^{2} + 16 \epsilon \beta x - 4) \Upsilon \\&\quad - x (3 \epsilon ^{2} x^{4} + 16 \epsilon ^{2} \beta x ^{3} + 4 \epsilon x ^{2} + 32 \beta \epsilon x - 4) \Upsilon ^{\prime }, \end{aligned}$$

and

$$\begin{aligned} V(x)&= 48 \epsilon ^{2} x ^{3} + 96 \beta \epsilon x - 16 + 16 (1 - 3 \beta \epsilon x ) \Upsilon - 4 \Upsilon ^{2} \\&\quad + x (3 \epsilon x^{3} + 48 \epsilon \beta - 10 ) \Upsilon ^{\prime } + x (5 \Upsilon + x \Upsilon ^{\prime }) \Upsilon ^{\prime } \\&\quad - x ^{2} (3 \epsilon x ^{2} + 16 \epsilon \beta x - 2 + \Upsilon ) \Upsilon ^{ \prime \prime }. \end{aligned}$$

To study the energy conditions we need to obtain forms for \(\rho - p\), \(\rho + p\) and \(\rho + 3 p\). Explicit forms for these expressions can be immediately generated from (19) and (20). We will compare these expressions with the corresponding forms of the 5-dimensional Einstein case later.

Other restrictions in (13) may lead to new models in addition to that considered in this section. For example on setting the coefficient of Z in (13) to zero, we obtain

$$\begin{aligned} x \left( x + 1 \right) \ddot{y} - \dot{y} - \frac{1}{2} y = 0, \end{aligned}$$
(22)

where we have set \(4 \alpha C = 1\) for simplicity. This produces a differential equation which is of the hypergeometric type, and consequently is not readily expressible in terms of elementary functions. Therefore the prospects of establishing Z explicitly are remote for the resultant form for y. This case may be treated with the other methods and this will be considered later. Additionally, it should be noted that the vanishing of the coefficient of \(\dot{Z}\) is not mathematically feasible as it involves both y and Z.

5 New exact interior solution in the Einstein case

The 5-dimensional Einstein version of the above is obtained by setting \(\alpha = 0\) in (13) to give the differential equation

$$\begin{aligned} 2x^2 Z \ddot{y} + x^2 \dot{Z} \dot{y} + (1-Z + \dot{Z}x) y =0. \end{aligned}$$
(23)

This differs from its 4-dimensional counterpart

$$\begin{aligned} 4x^2 Z \ddot{y} + 2x^2 \dot{Z} \dot{y} + (1-Z + \dot{Z}x) y =0, \end{aligned}$$
(24)

in the coefficients of its first two terms [25]. Invoking the metric ansatz (15), Eq. (23) reduces to

$$\begin{aligned} x(3\epsilon x^2 + 1)\dot{Z} + (3\epsilon x^2 - 1) Z + (\epsilon x^2 + 1) = 0, \end{aligned}$$
(25)

where we have set \(\tilde{\epsilon } = \frac{C_{1}}{ 2 C_{2}}\). The general solution to (25) is given by

$$\begin{aligned} Z(x)=\frac{1 + C_{3} x - \tilde{\epsilon } x^2}{1 + 3 \tilde{\epsilon } x^2}. \end{aligned}$$
(26)

It is important to observe that this does not follow as a special case of solution (18) since \(\beta \) and consequently \(\alpha \) appears in the denominator. Now the dynamical quantities, pressure, energy density, sound-speed index, and energy conditions have the forms

$$\begin{aligned} p&= \frac{ 3 C \left[ C_{3} + 5 C_{3} \tilde{\epsilon } x^{2} - 8 \tilde{\epsilon } ^{2} x^{3} \right] }{(\tilde{\epsilon } x^{2} + 1) (1 + 3 \tilde{\epsilon } x^{2}) }, \end{aligned}$$
(27)
$$\begin{aligned} \rho&= \frac{ 6 C \left[ C_{3} - 6 \tilde{\epsilon } x - 6 \tilde{\epsilon } ^{2} x^{3} \right] }{ (1 + 3 \tilde{\epsilon } x^{2})^{2} }, \end{aligned}$$
(28)
$$\begin{aligned} \frac{\mathrm{d}p}{\mathrm{d}\rho }&= x (1 + 3 \tilde{\epsilon } x^2 ) \nonumber \\&\quad \times \frac{ 12 \tilde{\epsilon } ^3 x - 15 C_3 \tilde{\epsilon } ^{2} x ^4 - 16 \tilde{\epsilon } ^2 x ^3 - 6 C_3 \tilde{\epsilon } x ^2 - 12 \tilde{\epsilon } x + C_{3} }{ 6 (\tilde{\epsilon } x^{2} + 1)^{2} \left[ 3 \tilde{\epsilon } ^{2} x ^{4} + 6 \tilde{\epsilon } x ^{2} - 2 C_{3} x - 1 \right] },\end{aligned}$$
(29)
$$\begin{aligned} \frac{\rho - p}{3C}&= \frac{ C_{3} - 12 \tilde{\epsilon } x - 6 C_{3} \tilde{\epsilon } x^{2} }{(1 + \tilde{\epsilon } x ^{2}) (1 + 3 \tilde{\epsilon } x ^{2})^{2}} \nonumber \\&\quad - \frac{ 16 \tilde{\epsilon } ^{2} x ^{3} + 15 C_{3} \tilde{\epsilon } ^{2} x ^{4} - 12 \tilde{\epsilon } ^{3} x ^{5} }{(1 + \tilde{\epsilon } x ^{2}) (1 + 3 \tilde{\epsilon } x ^{2})^{2}}, \end{aligned}$$
(30)
$$\begin{aligned} \frac{\rho + p}{3C}&= \frac{ 3 C_{3} - 12 \tilde{\epsilon } x + 6 C_{3} \tilde{\epsilon } x^{2} }{(1 + \tilde{\epsilon } x ^{2}) (1 + 3 \tilde{\epsilon } x ^{2})^{2}},\nonumber \\&\quad - \frac{ 32 \tilde{\epsilon } ^{2} x ^{3} - 15 C_{3} \tilde{\epsilon } ^{2} x ^{4} + 36 \tilde{\epsilon } ^{3} x ^{5} }{(1 + \tilde{\epsilon } x ^{2}) (1 + 3 \tilde{\epsilon } x ^{2})^{2}}, \end{aligned}$$
(31)
$$\begin{aligned} \frac{\rho + 3p}{3C}&= \frac{ 5 C_{3} - 12 \tilde{\epsilon } x + 26 C_{3} \tilde{\epsilon } x^{2} }{(1 + \tilde{\epsilon } x ^{2}) (1 + 3 \tilde{\epsilon } x ^{2})^{2}},\nonumber \\&\quad - \frac{ 48 \tilde{\epsilon } ^{2} x ^{3} - 45 C_{3} \tilde{\epsilon } ^{2} x ^{4} + 84 \tilde{\epsilon } ^{3} x ^{5} }{(1 + \tilde{\epsilon } x ^{2}) (1 + 3 \tilde{\epsilon } x ^{2})^{2}}, \end{aligned}$$
(32)

respectively. In the plots to follow, we exhibit the above quantities in comparison with their EGB counterparts to investigate the role of the Gauss–Bonnet term in the solution.

6 Physical features

We extrapolate from the familiar conditions imposed on stellar configurations in the usual Einstein theory of gravity to the 5-dimensional EGB case. It would be interesting to see if the models generated in this modified theory of gravity satisfy these standard conditions. We require that the energy density \(\rho \) and pressure p, and the metric potentials \(e^{2 \nu }\) and \(e^{2 \lambda }\), should be regular in the interior. The radial pressure should vanish at the boundary \(r = R.\) The gradients \(\rho ^{\prime }\) and \(p^{\prime }\) should be negative for barotropic matter. The speed of sound should remain subluminal throughout the interior of the star. At the boundary \(r = R\) the metric functions should match smoothly to the exterior Boulware and Deser [3] solution

$$\begin{aligned} e^{2\nu (R)} = 1 + \frac{R^2}{4\alpha } \left( 1 - \sqrt{1 + \frac{8M\alpha }{R^4}} \right) = e^{- 2\lambda (R)}. \end{aligned}$$

For realistic matter we require compliance with the energy conditions: weak energy condition \((\rho - p > 0 )\), strong energy condition \((\rho + p > 0 )\), and dominant energy condition \((\rho + 3p > 0 )\).

Clearly a complete analytic treatment of our solution is ostensibly not possible given its complexity. From an examination of the pressure (20) it is evident that solving for x in terms of p is not attainable as this reduces to solving an eighth degree polynomial equation, and there is no general way of doing this. This in turn means that it is not possible to write the density as a function of pressure to obtain a barotropic equation of state; the form \(p=p(\rho )\) is not possible.

We proceed to select a set of values for the various constants in the problem in order to determine a model that harmonises best with the physical conditions. The graphs in Figs. 1, 2, 3 and 4 displayed were produced by assuming the values \(C_1 =-0.02 \), \(C_2 = -50\), \(C_3 = -0.05\), \(\alpha = -150\), \(C = 0.0002\) and \(\beta = \alpha C\). (Observe that the use of a negative coupling constant \(\alpha \) is not novel—see for example Guo and Schwarz [30]). For these choices it is pleasing to note from Fig. 2 that a pressure-free hypersurface does indeed exist and is defined approximately by \(x = 40.94339\) geometric units. The approximation of x identified graphically does produce a vanishing value in the analytic expression for the pressure. Within this boundary we note that the pressure is positive definite, and decreases monotonically outwards from the central regions to the boundary \(r=R\). Additionally, Fig. 1 demonstrates that the density is positive and decreasing everywhere within the spherical distribution. Importantly we observe that the causality criterion \(0 < \frac{\mathrm{d}p}{\mathrm{d}\rho } < 1\) is satisfied everywhere in the interior of the star as evidenced by Fig. 3. This implies that the sound speed is never superluminal within the boundary. The energy conditions are depicted in Fig. 4. From these we infer that all the conditions: weak (solid line), strong (dashed line) and dominant (dotted line) are satisfied within the radius of the distribution. Using the values of the aforesaid constants as well as the boundary value \(x=40.94339\) allows us to compute the mass as \(M= 1.51 \times 10^7\) geometric units. Working in these same units we find that the mass to radius ratio is \(\frac{M}{R} = 369700\), which clearly violates the Buchdahl [31] limit \(\frac{M}{R} < \frac{4}{9}\) valid for stars in the Einstein general theory of relativity. This suggests that the Buchdahl upper bound may not hold in this model in EGB gravity theory.

Fig. 1
figure 1

Plot of energy density versus radial coordinate x

Fig. 2
figure 2

Plot of pressure versus radial coordinate x

Fig. 3
figure 3

Plot of sound-speed parameter versus radial coordinate x

Fig. 4
figure 4

Plot of energy conditions versus radial coordinate x

The dashed curve in each of Figs. 1 and 2 reflects the situation when the EGB coupling constant is set to 0. In other words, it shows the 5-dimensional Einstein analogue. It can be seen from Fig. 2 that there is no discernible difference between the pressure profiles in the Einstein and the EGB scenarios. The density plot in Fig. 1 however, demonstrates that the radius for a positive energy density is improved by the presence of the EGB coupling constant. This implies that the gravitational field in the Gauss–Bonnet theory can sustain a greater amount of matter per unit radius as opposed to its Einstein counterpart. Note that the central singularity in this model is an artefact of the non-removable curvature singularity. A way of avoiding the singularity is to call upon a two-fluid scenario such as in a core-envelope model. This idea is popularly invoked in the standard 4-dimensional theory; see for example the deconfined quark core model surrounded by an envelope of barotopic matter of Sharma and Mukherjee [32].

Matching of the interior metric with an exterior metric such as the Boulware–Deser solution is achieved via setting

$$\begin{aligned}&\left( \frac{1}{2} C_{1} C^{2} R^{4} + C_{2} \right) ^{2} = 1 + \frac{R^2}{4 \alpha } \left( 1 - \sqrt{1+ \frac{ 8 M \alpha }{R^4}} \right) , \end{aligned}$$
(33)
$$\begin{aligned}&1 + \frac{R^2}{4\alpha } \left( 1 - \sqrt{1 + \frac{8 M \alpha }{R^4}} \right) \nonumber \\&\quad =\frac{3 C_{1} C^{2} R^{4} + 8 \beta C_{1} C R^{4} + 2 C_{2} \pm C_{2} \Upsilon }{24 \beta C_{1} C R^{4}}, \end{aligned}$$
(34)
$$\begin{aligned}&0 = 27 C_{1} ^{2} C^{4} R^{8} + 96 C_{1} ^{2} \beta C^{3} R^{6} \nonumber \\&\qquad + 8 C_{1} (3 C_{2} + 32 C_{1} \beta ^{2}) C^{2} R^{4} - 64 C_{1} C_{2} \beta C R^{2} + 4 C_{2} ^{2} \nonumber \\&\qquad - \left( 3 C_{1} C_{2} C^{2} R^{4} + 16 C_{1} C_{2} \beta C R^{2} - 2 C_{2} ^{2} + 2 C_{2} ^{2} \Upsilon \right) \Upsilon . \end{aligned}$$
(35)

The last equation arises as a result of the vanishing of the pressure at \(r = R\). There are sufficient free parameters in the model to ensure that conditions (33)–(35) are satisfied. We find that

$$\begin{aligned} C_{1}&= \frac{-b \pm 2 a E}{4 a} \pm \frac{1}{2} \sqrt{\frac{4 a^{3} E B \pm [ 4 a b e - b^{3} - 8 a^{2} f]}{4 a ^{3} E}},\end{aligned}$$
(36)
$$\begin{aligned} C_{2}&= \frac{2 A - C_{1} C^{2} R^{4}}{2}, \end{aligned}$$
(37)
$$\begin{aligned} C_{3}&= \frac{ \left( A + C_{1} C^{2} R^{4} + 4 \beta C_{1} C R^{2} \left[ 1 - 3 A^{2} \right] \right) ^{2} }{27 \beta ^{2} C _{1} ^{2} C^{2} R^{4} (2 A - C_{1} C^{2} R^{4}) ^{2} } \nonumber \\&\quad + \frac{ 64 \beta C_{1} C_{2} C R^{2} - 4 C_{2} ^{2} }{432 \beta ^{2} C _{1} ^{2} C^{2} R^{4} } \nonumber \\&\quad - \frac{ 9 C_{1} ^{2} C^{4} R^{8} + 96 \beta C_{1} ^{2} C^{3} R^{6} }{432 \beta ^{2} C _{1} ^{2} C^{2} R^{4} } \nonumber \\&\quad - \frac{ 4 C_{1} C^{2} R^{4} \left( 16 \beta ^{2} C_{1} + 3 C_{2} \right) }{432 \beta ^{2} C _{1} ^{2} C^{2} R^{4} }, \end{aligned}$$
(38)

where

$$\begin{aligned} A&= \sqrt{ 1 + \frac{R^2}{4 \alpha } \left( 1 - \sqrt{1+ \frac{ 8 M \alpha }{R^4}} \right) }, \\ a&= 11 C^{8} R^{16} + 112 \beta C^{7} R^{14} + 240 A^{2} \beta C^{7} R^{14} \\&\quad - 192 \beta ^{2} C^{6} R^{12} + 768 \beta ^{2} C^{6} R^{12}, \\ b&= -196 A C^{6} R^{12} - 576 A \beta C^{5} R^{10} - 1152 A^{3} \beta C^{5} R^{10} \\&\quad - 1024 A \beta ^{2} C^{4} R^{8} - 3072 A^{3} \beta ^{2} C^{4} R^{8}, \\ e&= - 76 A^{2} C^{4} R^{8} - 16 C^{4} R^{8} + 1088 A^{2} C^{3} R^{6} \\&\quad + 1724 A^{4} C^{3} R^{6} + 1792 A \beta ^{2} C^{2} R^{4} - 256 \beta ^{2} C^{2} R^{4}, \\ f&= 68 A C^{2} R^{4} + 640 A^{3} C R^{2} - 128 A C R^{2} - A^{5} \beta C R^{2}, \\ h&= 64 A^{4}, \end{aligned}$$

with

$$\begin{aligned} E&= \sqrt{\frac{2^{\frac{1}{3}} b^{2} + \left( 3 \times 2^{\frac{1}{3}} b^{2} - 2^{\frac{10}{3}} a e + 4 a g^{\frac{1}{3}} \right) g^{\frac{1}{3}} }{3 \times 2^{\frac{7}{3}} a ^{2} g ^{\frac{1}{3}}}}, \\ B&= \frac{3 \times 2^{\frac{8}{3}} a \left( e^{2} - 3 b f + 12 a h \right) }{3 \times 2^{\frac{4}{3}} a ^{2} g ^{\frac{1}{3}}} \\&\quad + \frac{ 3 \times 2^{\frac{1}{3}} b^{2} g^{\frac{1}{3}} - 2^{\frac{10}{3}} a e g^{\frac{1}{3}}}{3 \times 2^{\frac{4}{3}} a ^{2} g ^{\frac{1}{3}}} \\&\quad - \frac{ 2^{\frac{5}{3}} a \left[ e^{2} - 3 b f - 12 a h \right] - 2 a g^{\frac{2}{3}} }{3 \times 2^{\frac{4}{3}} a ^{2} g ^{\frac{1}{3}}} \end{aligned}$$

and

$$\begin{aligned} g&= 2 e^{2} - 9 b e f + 27 a f^{2} + 27 b^{2} h - 72 a e h \\&\quad + \big (-4 [ e^{2} - 3 b f + 12 a h] ^{3}\\&\quad + [ 2 e^{2} - 9 b e f + 27 a f^{2} + 27 b^{2} h - 72 a e h] ^{2} \big )^{\frac{1}{2}}. \end{aligned}$$

From (36)–(38) we observe that the free parameters \(C_{1}\), \(C_{2}\), \(C_{3}\) in the model are defined in terms of \(\alpha , M, R\) (and C). It is interesting to note that the parameters that arise in the integration are defined in terms of physically relevant quantities: \(\alpha \) is the Gauss–Bonnet coupling constant, R is the radius and M is the mass of the star.

7 Conclusion

We have produced an exact solution for a static spherically symmetric distribution of perfect fluid in the modified EGB gravity theory. The model has been studied for physical admissibility and has been found to satisfy several elementary tests for physical reality. The pressure function vanishes for a particular radius and this hypersurface identifies the boundary of the fluid. Within this boundary the pressure and energy density profiles are positive for the choice of constants made. Importantly the fluid is found to be causal as the sound speed is subluminal. The weak, strong and dominant energy conditions are found to be satisfied everywhere in the interior. Finally matching with the Boulware–Deser exterior metric is permitted. We point out that the general junction conditions for matching in EGB gravity has been considered by Davis [17]. The higher order curvature terms lead to a modified set of junction conditions to be satisfied at the stellar surface. These surface equations are very different from general relativity, and their complexity makes it unlikely to easily demonstrate an exact solution. For a complete stellar model of a star in EGB gravity those boundary equations should be satisfied. In this treatment we have shown that it is possible to find bound EGB interior solutions with variable densities and pressures with desirable physical features.