Real Lines on Random Cubic Surfaces

We give an explicit formula for the expectation of the number of real lines on a random invariant cubic surface, i.e. a surface $Z\subset \mathbb{R}P^3$ defined by a random gaussian polynomial whose probability distribution is invariant under the action of the orthogonal group $O(4)$ by change of variables. Such invariant distributions are completely described by one parameter $\lambda\in [0,1]$ and as a function of this parameter the expected number of real lines equals: \begin{equation} E_\lambda=\frac{9(8\lambda^2+(1-\lambda)^2)}{2\lambda^2+(1-\lambda)^2}\left(\frac{2\lambda^2}{8\lambda^2+(1-\lambda)^2}-\frac{1}{3}+\frac{2}{3}\sqrt{\frac{8\lambda^2+(1-\lambda)^2}{20\lambda^2+(1-\lambda)^2}}\right). \end{equation} This result generalizes previous results by Basu, Lerario, Lundberg and Peterson for the case of a Kostlan polynomial, which corresponds to $\lambda=\frac{1}{3}$ and for which $E_{\frac{1}{3}}=6\sqrt{2}-3.$ Moreover, we show that the expectation of the number of real lines is maximized by random purely harmonic cubic polynomials, which corresponds to the case $\lambda=1$ and for which $E_1=24\sqrt{\frac{2}{5}}-3$.


Introduction
A classical result from complex algebraic geometry tells that on a generic cubic surface in complex projective space there are exactly 27 lines. This is still true for a generic real cubic surface, i.e., on the zero set in complex projective space of a real cubic polynomial, however these lines might not be real. In fact the number of real lines on the real zero locus Z(P ) ⊂ RP 3 , for a generic P ∈ R[x 0 , . . . , x 3 ] (3) in the space of real homogeneous polynomials of degree 3 can be either 27, 15, 7 or 3, depending on the coefficients of the chosen polynomial [33]. This is a typical phenomenon in real algebraic geometry, where in general there is no "generic" answer to such counting problems. There is however a recent interest into looking at these questions from the probabilistic point of view, replacing the word generic with "random", which in the case of the current paper means asking for the expectation of the number of real lines on a random real cubic surface. This approach has its origin in classical works of Kac [17], Edelman and Kostlan [10], Shub and Smale [34,35], and it has recently seen new progress [13,14,15,12,27,28,31,32,25,22,23,24,9,26,31,7], leading to the emergence of the field of Random real algebraic geometry.
Of course, when talking about expected quantities, one should specify what is meant by "random". In this paper we will endow the space R[x 0 , . . . x 3 ] (3) with a centered, nondegenerate gaussian distribution, which we require to be invariant under the action of the orthogonal group O(4) by change of variables -so that there are no preferred points or directions in the projective space RP 3 . Notice that Darmois-Skitovich Theorem together with a straightforward generalization of Theorem 4.5 of [19] guarantee that the gaussianity is a consequence of the independence of the coefficients of the monomials and the orthogonal invariance. Such a probability distribution will be called an invariant distribution and a polynomial sampled from it will be called an invariant polynomial. Invariant distributions on R[x 0 , . . . x 3 ] (3) can be explicitly described: they correspond to scalar products on R[x 0 , . . . x 3 ] (3) which are invariant under the action of the orthogonal group O(4) by change of variables, and they are parametrized by a point in the positive quadrant (λ 1 , λ 2 ) ∈ (0, ∞) × (0, ∞), see [19]. This comes from the fact that there is a decomposition where H 3 and H 1 denotes respectively the space of harmonic cubic polynomials and harmonic linear polynomials (i.e., just linear polynomials). The remarkable fact here is that the decomposition (1.1) is orthogonal with respect to any invariant scalar product; moreover the action of the orthogonal group by change of variables preserves the two spaces of harmonics and in addition the induced representation on these spaces is irreducible. In particular, in each space of harmonics, there is a unique (up to multiples) scalar product which is O(4)-invariant; this explains the two positive parameters needed to describe an invariant distribution. In practice, in order to construct a random invariant polynomial, we proceed as follows. First observe that the quantity we are interested in (the number of lines on the zero set, and in fact the zero set itself) does not depend on the multiple of the defining polynomial that we take and we can normalize our parameters to satisfy λ 1 + λ 2 = 1. In particular we can work with a single parameter λ ∈ (0, 1) such that (λ 1 , Then we fix bases {H 3,j } j∈J 3 ={1,...,16} for H 3 and {H 1,j } j∈J 1 ={1,...,4} for H 1 which are orthonormal with respect to the L 2 -scalar product. With these choices we define a random polynomial P λ as a linear combination of random harmonics, weighted by the parameters: where {ξ 3,j } j∈J 3 and {ξ 1,j } j∈J 1 are two independent families of independent standard gaussians. We include in our study also the choices λ = 0 and λ = 1, which correspond to purely harmonic polynomials (but not to scalar products). The case λ = 0 is special also for another reason: the associated hypersurface is a degenerate cubic, namely a hyperplane.
Example 1 (The Kostlan distribution). A Kostlan random polynomial is defined by where {ξ α } |α|=3 is a family of independent standard gaussians. The resulting probability distribution on R[x 0 , . . . x 3 ] (3) is invariant and corresponds to the choice of λ = 1 3 in (1.2) (see Corollary 3). The authors of [4] have proved that the expectation of the number of real lines on the zero set of a random Kostlan cubic equals: Generalizing the work of [4], in this paper we give an explicit formula for the expectation of the number of real lines on a random invariant cubic, as a function of the parameter λ ∈ [0, 1]. Theorem 1. The expected number of real lines on the zero set of the random cubic polynomial P λ equals: An interesting corollary of the previous Theorem is the fact that one can analytically prove that the expectation is maximized at λ = 1, i.e., for random purely harmonic cubics.

Corollary 2.
The function E λ is monotone increasing and attains its maximum at λ = 1: Remark 1. The previous corollary is particularly interesting because it confirms the intuition that purely harmonic polynomials of maximum degree exhibit complicated topological configurations, see [20].
Remark 2. On the other hand the minimum of the function E λ is 3, and this number has a precise meaning. In fact we prove in Proposition 6 that there exists a neighborhood of the set of purely harmonic polynomials of degree one (i.e. linear form times x 2 ), such that the smooth cubic surfaces in this neighborhood contain exactly three lines. The proof of this fact does not involve the expression of the function E λ , therefore we could deduce that E 0 = 3 without knowing (1.4).  Table 1.2]. Remark 4. Yet another model of randomness can be obtained by looking at random determinantal cubics. To be more specific, consider random 3 × 3 matrices A 0 , A 1 , A 2 , A 3 filled with independent standard gaussians, and define the random polynomial:

Random determinantal cubics are O(4)-invariant.
Smooth cubics admit a determinantal representation (i.e., they can be written as the zero set of some F as in (1.5)), see [5,6]. It is natural therefore to ask for the expectation of the number of real lines on a random determinantal cubic surface Z(F ) ⊂ RP 3 , however this problem seems to be considerably more complicated than the gaussian one considered here (the coefficients of F in (1.5) are cubic in gaussian variables and they are also highly dependent) and we leave this as an open question.
Remark 5. As said in the beginning, our approach will be probabilistic and our answer will depend on the probability distribution we have chosen. It is important to mention that there exists also a certain signed count of lines on a (generic) real cubic surface that is independent of the surface itself. For this type of count, following classical work of Segre [33] (later rediscovered and extended by Okonek and Teleman [29] and Kharlamov and Finashin [11]), one can classify the lines lying on the cubic into elliptic and hyperbolic. This corresponds to giving a sign to each line. The number e of elliptic lines plus the number h of hyperbolic lines depend on the cubic, but their difference h − e is always 3. Following [18], one can further extend this type of signed count to a different field K (for instance the p-adic numbers K = Q p ). In this case a line is a closed point in the Grassmannian of lines in P 3 K . The sign, which is now called type, takes value in the Grothendieck-Witt group GW(K) of nondegenerate bilinear forms and it depends on the field of definition of the line. With these specifications we get a similar invariant count, see [18,Theorem 2]. An interesting question is: what happens over the p-adic numbers? In this direction, [18, Theorem 2] gives a way to perform a well defined enriched count but, in the spirit of the current paper, it makes sense to ask for the expected number of Q p -lines on a random p-adic cubic. This question has been studied by the first named author of this paper together with Lerario in [2] and the answer is Remark 6. The study of cubic surfaces has been recently enriched by the famous 27 questions posed by Sturmfels, that are collected in [30]. By the same logic of this paper, it can be noticed that some of those questions can be restated according to a probabilistic point of view. For example looking at question 23 and putting a probability distribution on RP 19 , instead of asking for a semialgebraic description of the set of smooth hyperbolic cubics in RP 19 , one could seek the probability of a smooth cubic to be hyperbolic.
Acknowledgements. We, the authors, wish to thank Antonio Lerario, our professor and the person without whom this article would not exist. Thank you for believing in us, in us who "attiriamo altre basi reali su armoniche random" (=we attract other real bases on random harmonics), and for your amazing ability in creating anagrams. Special thanks also to SISSA, the place where this article was born, and to the Max Planck Institute for Mathematics in the Sciences, Leipzig, for making our first little research experience great. We would also like to thank the ICERM for the beautiful workshop on Symmetry, Randomness, and Computations in Real Algebraic Geometry, that was the occasion for interesting discussions.

The decomposition into harmonic polynomials and invariant scalar products.
Let us consider the space of real d-homogeneous polynomials The orthogonal group O(n + 1) acts on it by change of variables, so that we can view W n,d as a representation of O(n + 1). We want to find the decomposition of W n,d into its irreducible subrepresentations. Denote the space of real homogeneous harmonic polynomials of degree d in n + 1 variables by H n d := {H ∈ W n,d : △H = 0}. This space is invariant with respect to O(n + 1) and the following algebraic decomposition holds (see [4]): Moreover the spaces x d−j H n j form irreducible representations of O(n+1) and are orthogonal with respect to any O(n + 1)-invariant scalar product. Let us denote with (·, ·) a generic real scalar product on W n,d which is invariant under the action of the orthogonal group O(n + 1); we will use the notation (·, ·) 2 for the L 2 scalar product which is by definition As a consequence of Schur Lemma (see [36,Lemma 18.1.1]) the restriction of (·, ·) to the space x d−j H n j is a multiple of the L 2 scalar product. So given f, g ∈ W n,d we can write Given an invariant scalar product (·, ·) we can construct a gaussian probability distribution which is invariant under rotations. First we fix an orthonormal basis We construct a random polynomial with such a basis whose coefficients are given by centered gaussian random variables ξ j,i ∼ N (0, 1): In our case we have that and therefore we only need two parameters to classify all the scalar products Let us fix bases {H 3,i } i∈J 3 ={1,...,16} for H 3 3 and { x 2 H 1,i } i∈J 1 ={1,...,4} for x 2 H 3 1 which are orthonormal with respect to the L 2 -scalar product, and then we have that is an orthonormal basis with respect to our scalar product. Notice that since for our purposes we just need to classify scalar products up to constants, we can rescale our parameters such that they sum up to 1 and obtain the following random polynomial where ξ j,i ∼ N (0, 1) are independent standard gaussians. In Theorem 1 we will use the explicit orthogonal basis for P shown in table 1.
Remark 7. Notice that we will take into account also the limit cases λ = 0 and λ = 1 of pure harmonics of degree 1 and 3 respectively. Proof. Take the element x 0 x 1 x 2 of the basis. Its L 2 norm is 1, while its Kostlan norm is 1 √ 6 , therefore we get that µ 1 = 1 6 . Consider now the element x 0 (

Vector bundles and the
where Gr(2, 4) denotes the Grassmannian of 2-planes in R 4 , whose double cover is given by Gr + (2, 4). We recall now the following theorem which is an essential tool for this computation.
Theorem 4 (Kac-Rice formula [1]). Let (M, g) be a Riemannian manifold of dimension m and X : M → R m be a smooth random map such that (i) for every t ∈ M , the random vector X(t) has a gaussian nondegenerate distribution; (ii) the probability that X has degenerate zeroes in M is zero.
Then, denoting by p X(t) the density function of X(t), for every U ⊂ M measurable set the expected number of zeroes of X in U is given by the formula: where w U is the volume form induced by the Riemannian metric g andĴ X(t) denotes the matrix of the derivatives of the components of X with respect to an orthonormal frame field.
Hence φ −1 : U → R 2×2 is a coordinate chart on a neighborhood U of e 0 ∧ e 1 , and we get a trivialization of the bundle Sym 3 (τ * 2,4 ) over U as follows: Remark 8. Since Gr + (2, 4) is compact and connected, and the map φ is a Riemannian exponential map, then φ is surjective. We can take U to be the largest domain for which φ is a diffeomorphism: then Gr + (2, 4) \ U is the cut locus at e 0 ∧ e 1 (see [8, Theorem III.2.2]) and it has measure 0. So integrating over U is equivalent to integrating over Gr + (2, 4).
Take the polynomial P λ in (2.1) and definẽ in such a way that h(σ P λ (W )) = (W,σ P λ (W )). So we can apply the Kac-Rice formula to where here φ −1 (U ) is endowed with the pull-back metric φ * g, p(0, W ) denotes the density at zero ofσ P λ (W ) and J(W ) is the matrix of the derivatives at W of the components ofσ P λ with respect to an orthonormal frame field, that we will simply call Jacobian matrix.

The fact that the distribution of P λ is O(4)-invariant implies that the function
is a constant C which does not depend on W . Indeed, let W 1 and W 2 be two elements of Gr + (2, 4), and let k ∈ O(4) be such that k(W 1 ) = W 2 . Then, by the Kac-Rice formula, we have denoting by B(W i , ε) the ball around W i of radius ε. Therefore the expected number of zeros of the section is E#{σ P λ = 0} = C · vol(Gr + (2, 4)) where vol(Gr + (2, 4)) is the volume of Gr + (2, 4). Moreover we will show in the proof of Theorem 1 thatσ P λ (W ) and J(W ) are independent random variables (for a certain W ), and in that case E{| det(J(W ))| |σ P λ (W ) = 0} = E{| det(J(W ))|}. Because Gr + (2, 4) is a double covering of Gr (2,4), in the end we get that for a fixed W 0 ∈ Gr + (2, 4).
Let us now focus on the Jacobian matrix: write the polynomial P λ in the monomial basis as As in the proof of [4, Theorem 2] we can compute the matrix J(W 0 ) that turns out to be: This matrix will be used in the proof of the main theorem.

Proof of Theorem 1
Proof. Fix the orthogonal basis {H 3,j } j∈{1,...,16} ∪ {H 1,j } j∈{1,...,4} introduced in Table 1 for the space W 3,3 . Then our random polynomial is Expanding this harmonic basis in the monomial one we can compute directly the Jacobian as above and we obtain the expression: where these new gaussians Let us compute E{| det(J(W 0 ))|}. We will use the following notation: ift ∼ N (0, η) we will call t = 1 ηt ∼ N (0, 1). It turns out after some computations that Hence we can do again the same reasoning using the (M, N ) parameters, and we can compute for this polynomial the functioň To write then the expectation as a function of the λ parameter we need to remember that E λ =Ě λ µ(λ),(1−λ)µ(λ) , as the zero set does not change under multiplication of a polynomial by a constant.
With these new parameters the determinant becomes much simpler: In order to compute the expectation of | det(J(W 0 ))| we need the joint density ρ (α, β, γ). Surprisingly it can be recovered by the method of characteristic functions and using Theorem 2.1 of [16], as explained in [4], so that denoting by | · | the Euclidean norm: Therefore we can compute the expectation of | det(J(W 0 ))| as: where we used two changes of variables: and then solved the integral in the θ variable finding explicitly the intervals of positivity and negativity of the function in the absolute value.
We have to compute now the density ofσ P λ (W 0 ) at 0. It is a gaussian random vector with zero mean and covariance that can be computed by looking at the coefficients of P λ in the monomials where we simplified the expression of the determinant using the relation M 2 6 + N 2 48 = 1. Finally the volume of the Grassmannian [4, Remark 2] is vol(Gr(2, 4)) = 2π 2 , therefore we have thať (1−λ) 2 +8λ 2 λ, so we can come back to the original parameter λ and obtain that 3.1. Properties of the function E λ .

Proposition 5.
The function E λ is monotone increasing. Proof. In order to simplify the computation and because M is an increasing function of λ, we will prove the monotonicity of E as a function of M instead of λ.
Then, it is enough to prove that the denominator g(M ) = (8 − M 2 )( √ 4 + M 2 ) is decreasing. In fact, Topology of zero set Number of lines 1 Table 2. We present here in a schematic way the connected components of RP 19 \ ∆ C with the topology of the zero sets of the cubics in them and the number of lines on those cubics.
So for positive values of M , which are the ones we are interested in, g ′ (M ) ≤ 0 and therefore E λ is increasing.
The plot of the function E λ is shown in figure 1. Its minimum is E 0 = 3 whereas the maximun is reached by the other limit case λ = 1 and is E 1 = 24 2 5 − 3 ≃ 12, 179, as stated in Corollary 2. This value of λ corresponds to purely harmonic polynomials of degree 3.
Let us focus now on the minimum. The fact that it is 3 may be proved also with another approach, that gives some information about the deterministic situation. We now define different discriminants and explain the relation between them.
We call complex discriminant the subset of those cubics in RP 19 which have a complex singularity (their partial derivatives have a common complex zero) and we denote it with ∆ C . It is a known fact (see [3]) that RP 19 \ ∆ C has five connected components. If we fix a connected component among those five, all zero sets of cubics in there contain the same number of lines and are all homotopy equivalent (see Table 2). We call real discriminant the subset of cubics in ∆ C such that at least one singularity is real and we will denote it by ∆ R . Notice that every smooth cubic contains 27 lines and therefore every element in RP 19 \ ∆ C contains a finite number of lines.
In the next Proposition we will work in the space W 3,3 endowed with the L 2 norm. With some abuse of notation we denote by ∆ C ⊂ W 3,3 the set of those g ∈ W 3,3 whose projectivization is in ∆ C or g is the zero cubic. Same for ∆ R . Proposition 6. There exists ε > 0 such that for all 0 + a 2 1 + a 2 2 + a 2 3 ) = 1 and for all g ∈ W 3,3 \ ∆ C such that g − h 1 L 2 ≤ ε the zero set of g contains exactly 3 lines.
Proof. First of all notice that if we find the ε of the claim for a fixedh 1 , then the same ε works for any other polynomial h 1 as in the statement. In fact ∃R ∈ O(4) such that h 1 (x) =h 1 (Rx), where the L 2 norm of h 1 is again 1. Moreover, due to the O(4)-invariance of the L 2 -norm, that rotation R takes the ball of radius ε aroundh 1 into the ball of radius ε around h 1 , without changing the geometry of the zero sets of the cubics in there. So we are left to prove the claim for a fixed h 1 . The cubic h 1 belongs to ∆ C \∆ R , and its zero set is topologically RP 2 . Thanks to Thom's isotopy lemma [37] ∃ε > 0 such that for g ∈ W 3,3 with g − h 1 L 2 ≤ ε the zero sets Z(g) and Z(h 1 ) are ambient isotopic, and hence homeomorphic. This means that if g is a cubic as above and g ∈ ∆ C , then the projectivization of g belongs to the connected component of RP 19 whose zero set is topologically RP 2 and contains exactly 3 lines.
Remark 9. If h 1 L 2 = 1, the claim above remains true but in a slightly different neighborhood: for all g ∈ W 3,3 \ ∆ C such that g − h 1 L 2 ≤ ε h 1 L 2 , the zero set of g contains exactly 3 lines.
In view of Proposition 6, we can deduce that lim λ→0 E λ = 3 without knowing the explicit formula for E λ . In fact given any polynomial f ∈ W 3,3 , thanks to the harmonic decomposition, we can always write f = h 3 + h 1 where h 3 ∈ H 3 3 and h 1 ∈ x 2 H 3 1 . Taking the ε of the proposition above, we have where K is a normalization constant, Θ(θ) a function deriving from the spherical change of coordinates, The number of lines on Z(f ) in the first summand is exactly 3 for the generic f because we are in the nice neighborhood of Proposition 6. Therefore for K ′ a new constant that englobes all the others, andĥ 3 = h 3 λ . Using dominated convergence it is now easy to see that lim λ→0 I(λ) = 0. Indeed the last inequality of the explicit computation also proves P(h 3 + h 1 ∈ B(h 1 , ε h 1 )) → 0, which implies P(h 3 + h 1 ∈ B(h 1 , ε h 1 )) → 1 and therefore lim λ→0 E λ = 3. So it makes sense to ask for the number of lines inside a hypersurface of degree 2n − 3 in RP n . If for the case of cubics in RP 3 it was at least known that the maximum number of complex lines, 27, could be reached also in the real case, when moving to this more general setting it is not clear whether the generic number of complex lines can be realized or not by real lines. Following the same procedure explained in Section 2.1 we may wonder "What is the expected number of real lines inside a random invariant hypersurface of degree 2n − 3 in RP n ?" The idea is that the expectation might be maximized again by purely harmonic polynomials of top degree, and so the possible way of constructing hypersurfaces with many lines could be sampling random pure harmonics of degree 2n − 3.
In [4] the authors have proved that lim n→∞ log E Kostlan n log C n = 1 2 where E Kostlan n is the expected number of real lines inside a random invariant hypersurface Z(f ) of degree 2n − 3 in RP n sampled from the Kostlan distribution, and C n is the number of complex lines on a generic hypersurface of degree 2n − 3 in W n 3,3 . This led A. Lerario to a conjecture: sampling random pure harmonics of degree 2n−3 instead of Kostlan, the intuition is that lim n→∞ log E Harmonic n log C n > 1 2 (or maybe in a wonderful universe the limit could also be equal to 1).
Remark 10. Such results would be relevant also because they may give some information also about the deterministic case. In dimension n > 3, it is not even clear if there exist real hypersurfaces containing C n real lines, but for sure there must exist hypersurfaces with at least ⌈E n ⌉ real lines. Random results thus give a bound that may not be known yet.