**5. Discussion**

In this paper, we have reviewed various problems from different disciplines, including high-dimensional random geometry, finance, binary classification with a perceptron, game theory, and random linear algebra, which all have at their root the problem of dichotomies, that is, the linear separability of points carrying a binary label and scattered randomly over a high-dimensional space. No doubt there are several further problems belonging to this class; those that spring to mind are theoretical ecology alluded to at the end of the previous Section, or linear programming with random parameters [8]. Some of these conceptual links are obvious, and have been known for decades (for example, the link between dichotomies and the perceptron), and others are far less clear at first sight, such as the relationship with the two finance problems discussed in Section 3. We regard as one of the merits of this paper the establishment of this network of conceptual connections between seemingly faraway areas of study. Apart from the occasional use of the heavy machinery of the replica theory, in most of the paper we offered transparent geometric arguments, where our only tool was basically the Farkas' lemma.

The phase transitions we encountered in all of the problems discussed here are similar in spirit to the geometric transitions discovered by Donoho and Tanner [33] and interpreted at a very high level of abstraction by [42]. One of the central features of these transitions is the universality of the critical point. This universality is different from the one observed in the vicinity of continuous phase transitions in physics, where the value of the critical point can vary widely, even between transitions belonging to the same universality class. The universality in physical phase transitions is a property of the critical indices and other critical parameters. Critical indices also appear in our abstract geometric problems, and they are universal, but we omitted their discussion which might have led far from the main theme.

At the bottom of our geometric problems, there is the optimization of a convex objective function (which is, by the way, the key to the replica symmetric solutions we found). The recent evolution of neural networks, machine learning, and artificial intelligence is mainly concerned with a radical lack of convexity, which points to the direction in which we may try to extend our studies. Another simplifying feature we exploited was the independence of the random variables. The moment that correlations appear, these problems become hugely more complicated. We left this direction for future exploration. However, it is evident that progress in any of these problems will induce progress in the other fields, and we feel that revealing their fundamental unity may help the transfer of methods and ideas between these fields. This may be the most important achievement of this analysis.

**Author Contributions:** Conceptualization, I.K. and A.E.; formal analysis, A.P., I.K. and A.E.; software, A.P.; writing—original draft, A.P., I.K. and A.E. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding. **Data Availability Statement:** The data presented in this study are available on request from the corresponding author.

**Acknowledgments:** A.P. and A.E. are grateful to Stefan Landmann for many interesting discussions. **Conflicts of Interest:** The authors declare no conflict of interest.

#### **Appendix A. Replica Calculation of Maximal Loss**

In this appendix, we provide some details for the determination of the maximal loss of a random portfolio using the replica trick. The calculation is a generalization of the one presented in [3] for random zero-sum games. A presentation at full length can be found in [43]. As we pointed out in the main text, maximal loss is a special limit of the Expected Shortfall risk measure, corresponding to the so-called confidence level going to 100%. In [44] a detailed study of the behavior of ES was carried out, including the limiting case of maximal loss. That treatment is completely different from the one in here, so the present calculation can be regarded as complementary to that in [44].

The central quantity of interest is the fractional volume

$$\Omega(\mathbf{x}, \gamma, \mathbf{z}) = \frac{\int\_{\gamma}^{\infty} \prod\_{i=1}^{N} dw\_i \,\delta(\sum\_{i} w\_i - N) \prod\_{l=1}^{nN} \Theta\left(\sum\_{i} w\_i r\_i^t + \mathbf{x}\right)}{\int\_{\gamma}^{\infty} \prod\_{i=1}^{N} dw\_i \,\delta(\sum\_{i} w\_i - N)}\tag{A1}$$

defined in (28). Although not explicitly indicated, <sup>Ω</sup>(*<sup>κ</sup>*, *γ*, *α*) depends on all the random parameters *rti* and is therefore by itself a random quantity. The calculation of its complete probability density *P*(Ω) is hopeless but for large *N* this distribution gets concentrated around the typical value <sup>Ω</sup>typ(*<sup>κ</sup>*, *γ*, *<sup>α</sup>*). Because Ω involves a product of many independent random factors this typical value is given by

$$
\Omega\_{\rm typ}(\kappa,\gamma,\mathfrak{a}) = \mathfrak{e}^{\langle\langle \ln \Omega(\kappa,\gamma,\mathfrak{a})\rangle\rangle} \tag{A2}
$$

rather than by Ω(*<sup>κ</sup>*, *γ*, *<sup>α</sup>*). Here ... denotes the average over the *rti* . A direct calculation of ln Ω is hardly possible. It may be circumvented by exploiting the identity

$$\langle\langle \ln(\Omega(\kappa,\gamma,a))\rangle\rangle = \lim\_{n\to 0} \frac{1}{n} [\langle\langle \Omega^n(\kappa,\gamma,a)\rangle\rangle - 1] \tag{A3}$$

For natural *n* the determination of Ω*n* is feasible. The main problem then is to continue the result to real *n* in order to perform the limit *n* → 0.

The explicit calculation starts with

$$\langle\langle\Omega(\mathbf{x},\gamma,\mathbf{a})^{n}\rangle\rangle = \left\langle\left\langle\frac{\int\_{\gamma}^{\infty}\prod\_{i=1}^{N}\prod\_{a=1}^{n}dw\_{i}^{a}\prod\_{a=1}^{n}\delta(\sum\_{i}w\_{i}^{a}-N)\prod\_{i=1}^{nN}\prod\_{a=1}^{n}\Theta(\sum\_{i}w\_{i}^{a}r\_{i}^{t}+\kappa)}{\int\_{\gamma}^{\infty}\prod\_{i=1}^{N}\prod\_{a=1}^{n}dw\_{i}^{a}\prod\_{i=1}^{n}\delta(\sum\_{i}w\_{i}^{a}-N)}\right\rangle\right\rangle. \tag{A4}$$

Using

$$\int\_{\gamma}^{\infty} \prod\_{i=1}^{N} dw\_i \, \delta(\sum\_{i} w\_i - N) \sim \exp\{N[1 + \ln(1 - \gamma)]\}\tag{A5}$$

for large *N* and representing the *δ*-functions and Θ-functions by integrals over auxiliary variables *Ea*, *λat* , and *yat* we arrive at

$$\begin{split} \langle\langle\Omega(\boldsymbol{\kappa},\boldsymbol{\gamma},\boldsymbol{a}^{\rm n})\rangle\rangle &= \exp\{-nN[1+\ln(1-\gamma)]\} \\ &\times \int\_{\gamma}^{\infty} \prod\_{i,\boldsymbol{a}} dw\_{i}^{4} \int \prod\_{\boldsymbol{a}} \frac{dE\_{\boldsymbol{a}}}{2\pi} \exp\left[iN\sum\_{\boldsymbol{a}} E\_{\boldsymbol{a}} \left(\frac{1}{N} \sum\_{i} w\_{i}^{\boldsymbol{a}} - 1\right)\right] \\ &\times \int\_{-\pi}^{\infty} \prod\_{t,\boldsymbol{a}} d\lambda\_{t}^{a} \int \prod\_{t,\boldsymbol{a}} \frac{dy\_{t}^{4}}{2\pi i} \exp\left(i\sum\_{t,\boldsymbol{a}} y\_{t}^{\boldsymbol{a}} \lambda\_{t}^{a}\right) \left\langle \left\langle \exp\left(-i\sum\_{i,\boldsymbol{a}} y\_{t}^{\boldsymbol{a}} w\_{i}^{\boldsymbol{a}} \boldsymbol{r}\_{t}^{\boldsymbol{1}}\right)\right\rangle \right. \end{split} \tag{A6}$$

The average over the *rti* may now be performed for independent Gaussian *rti* with average zero and variance *σ*<sup>2</sup> = 1/*N*. The result is valid also for more general distributions. First, multiplying the variance by a constant just rescales the maximal loss but does not influence the optimal **w**. Second, for *N* → ∞ only the first two cumulants of the distribution matter due to the central limit theorem. Crucial is, however, the assumption of the *rti* being independent.

Performing the average we find

$$\begin{split} \left< \left< \left< \exp \left( -i \sum\_{i,t,a} y\_i^a w\_i^a r\_i^t \right) \right> \right> &= \prod\_{i,t} \left[ \int \frac{dr\_i^t}{\sqrt{2\pi\sigma^2}} \exp \left( -\frac{(r\_i^t)^2}{2r^2} - ir\_i^t \sum\_a y\_i^a w\_i^a \right) \right] \\ &= \exp \left( -\frac{1}{2N} \sum\_{i,t} \sum\_{a,b} w\_i^a w\_i^b y\_t^a y\_t^b \right). \end{split} \tag{A7}$$

To disentangle in (A6) the *w*-integrals from those over *λ* and *y* we introduce the order parameters

$$q\_{ab} = \frac{1}{N} \sum\_{i} w\_i^a w\_i^b, \quad a \ge b \tag{A8}$$

together with the conjugate ones *q*<sup>ˆ</sup>*ab*. Using standard techniques [11] we end up with

$$\begin{split} \langle \langle \Omega(\mathbf{x}, \gamma, a)^{n} \rangle \rangle = \int \prod\_{a \ge b} \frac{dq\_{ab} d\hat{q}\_{ab}}{2\pi/N} \int \prod\_{a} \frac{dE\_{a}}{2\pi} \\ \times \exp \left\{ -i N \sum\_{a \ge b} q\_{ab} \mathfrak{f}\_{ab} - i N \sum\_{a} \mathbb{E}\_{\mathbf{z}} - nN[1 + \ln(1 - \gamma)] + N \mathcal{G}\_{\mathbf{s}} + a N \mathcal{G}\_{\mathbf{E}} \right\}, \end{split} \tag{A9}$$

where

$$G\_S = \ln\left[\int\_{\gamma}^{\infty} \prod\_a dw^a \exp\left(i\sum\_{a\ge b} \mathfrak{q}\_{ab} w^a w^b + i\sum\_a E\_a w^a\right)\right] \tag{A10}$$

and

$$G\_E = \ln \left[ \int\_{-\kappa}^{\infty} \prod\_a d\lambda^a \int \prod\_a \frac{dy^a}{2\pi} \exp \left( -\frac{1}{2} \sum\_{a,b} q\_{ab} y^a y^b + i \sum\_a y^a \lambda^a \right) \right]. \tag{A11}$$

For *N* → ∞ the integrals over the order parameters in (A9) may be calculated using the saddle-point method. The essence of the so-called replica-symmetric ansatz is the assumption that the values of the order parameters at the saddle-point are invariant under permutation of the replica indices *a* and *b*. In [43] arguments are given why the replicasymmetric saddle-point should yield correct results in the present context. We therefore assume for the saddle-point values of the order parameters

$$\begin{aligned} q\_{a4} &= \, \, q\_1 & \, \, i \hat{q}\_{a4} &= \, -\frac{1}{2} \hat{q}\_1 & \, \, iE\_4 &= E & \, \forall a \\ q\_{ab} &= \, \, q\_0 & \, \, i \hat{q}\_{ab} &= \dot{q}\_0 & \, \, \forall a &> b. \end{aligned} \tag{A12}$$

which implies various simplifications in (A9)–(A11). Employing standard manipulations [11] we arrive at

$$\langle\langle\langle\Omega(\mathbf{x},\gamma,a)^{n}\rangle\rangle\rangle \sim \exp\left\{N\_{q\_{0}\not p\_{0}\not p\_{1}\not p\_{0}\not E} \left[-\frac{n(n-1)}{2}q\_{0}\not q\_{0} + \frac{n}{2}q\_{1}\not q\_{1} - nE - n(1+\ln(1-\gamma)) + G\_{S} + nG\_{E}\right]\right\}.\tag{A13}$$

Using the shorthand notations (17) the functions *GS* and *GE* are now given by

$$G\_S = \ln \int Dl \left[ \exp\left(\frac{(\sqrt{\hat{q}\_0}l + E)^2}{2(\hat{q}\_0 + \hat{q}\_1)}\right) \sqrt{\frac{2\pi}{\hat{q}\_0 + \hat{q}\_1}} H \left(-\frac{\sqrt{\hat{q}\_0}l + E - \gamma(\hat{q}\_0 + \hat{q}\_1)}{\sqrt{\hat{q}\_0 + \hat{q}\_1}}\right) \right]^n \tag{A14}$$

and

$$G\_E = \ln \int Dm \, H \left( \frac{\sqrt{q\_0} m - \kappa}{\sqrt{q\_1 - q\_0}} \right)^n. \tag{A15}$$

We may now treat *n* as a real number and perform the limit *n* → 0. In this way we find for the averaged entropy

$$S(\mathbf{x}, \gamma, a) := \lim\_{N \to \infty} \frac{1}{N} \langle \langle \ln[\Omega(\mathbf{x}, \gamma, a)] \rangle \rangle = \lim\_{N \to \infty} \frac{1}{N} \lim\_{n \to 0} \frac{1}{n} [\langle \langle \Omega(\mathbf{x}, \gamma, a)^n \rangle \rangle - 1] \tag{A16}$$

the expression

$$\begin{split} S(\kappa,\gamma,a) &= \mathop{\rm extr}\limits\_{q\_{0},\dot{q}\_{0},\dot{q}\_{1},\dot{q}\_{1},\mathcal{E}} \Big[ \frac{q\_{0}\dot{q}\_{0}}{2} + \frac{q\_{1}\dot{q}\_{1}}{2} - E - 1 - \ln(1-\gamma) + \frac{1}{2}\ln(2\pi) - \frac{1}{2}\ln(\dot{q}\_{0} + \dot{q}\_{1}) \\ &+ \frac{\hat{q}\_{0} + E^{2}}{2(\dot{q}\_{0} + \dot{q}\_{1})} + \int D\mathcal{I}\ln H \Big( -\frac{\sqrt{\mathcal{q}\_{0}}l + E - \gamma(\dot{q}\_{0} + \dot{q}\_{1})}{\sqrt{\dot{q}\_{0} + \dot{q}\_{1}}} \Big) \\ &+ \boldsymbol{\kappa} \int D\boldsymbol{m}\ln H \Big( \frac{\sqrt{\mathcal{q}\_{0}}m - \kappa}{\sqrt{q\_{1} - q\_{0}}} \Big) \Big]. \end{split} \tag{A17}$$

The remaining extremization has to be done numerically. Before embarking on this task it is useful to remember that Ω and *S* are only instrumental in determining the maximal loss which in turn is given by the value *κc* of *κ* for which Ω tends to zero. At the same time the typical overlap *q*0 between two different vectors in Ω has to tend to the self-overlap *q*1. To investigate this limit we replace the order parameter *q*1 by

$$
v := q\_1 - q\_0 \tag{A18}$$

and study the saddle-point equations for *v* → 0. In this limit it turns out that the remaining order parameters may either also tend to zero or diverge. It is therefore convenient to make the replacements

$$\mathfrak{q}\_0 \to \frac{\mathfrak{q}\_0}{\upsilon^2}, \quad \mathfrak{q}\_1 \to \mathfrak{p} := \frac{\mathfrak{q}\_1 + \mathfrak{q}\_0}{\upsilon}, \quad E \to \frac{E}{\upsilon}. \tag{A19}$$

Rescaled in this way the saddle-point values of the order parameters remain O(1) for *v* → 0. After some tedious calculations the saddle-point equations acquire the form

$$\begin{aligned} 0 &= \hat{w} - aH\left(\frac{\kappa\_c}{\sqrt{\hat{q}\_0}}\right) \\ 0 &= -\hat{q}\_0 + \hat{w}(q\_0 + \kappa\_c^2) - a\sqrt{\hat{q}\_0}\kappa\_c \operatorname{G}\left(\frac{\kappa\_c}{\sqrt{\hat{q}\_0}}\right) \\ 0 &= E(1 - \gamma) - \hat{w}(q\_0 - \gamma) + \hat{q}\_0 \\ 0 &= \hat{w} - H\left(-\frac{E - \gamma\hat{w}}{\sqrt{\hat{q}\_0}}\right) \\ 0 &= \hat{w}(E - 1) + \sqrt{\hat{q}\_0}\operatorname{G}\left(\frac{E - \gamma\hat{w}}{\sqrt{\hat{q}\_0}}\right) + \gamma\hat{w}(1 - \hat{w}) \end{aligned} \tag{A20}$$

where

$$G(x) := \frac{1}{\sqrt{2\pi}} e^{-\frac{x^2}{2}}.\tag{A21}$$

From the numerical solution of the system (A20) we determine *<sup>κ</sup>c*(*<sup>α</sup>*, *γ*) as shown in Figure 3.
