 # Random matrix approach for primal-dual portfolio optimization problems

In this paper, we revisit the portfolio optimization problems of the minimization/maximization of investment risk under constraints of budget and investment concentration (primal problem) and the maximization/minimization of investment concentration under constraints of budget and investment risk (dual problem) for the case that the variances of the return rates of the assets are identical. We analyze both optimization problems by using the Lagrange multiplier method and the random matrix approach. Thereafter, we compare the results obtained from our proposed approach with the results obtained in previous work. Moreover, we use numerical experiments to validate the results obtained from the replica approach and the random matrix approach as methods for analyzing both the primal and dual portfolio optimization problems.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

When investors invest in financial instruments traded in the securities market, it is important for them to implement an appropriate risk management strategy since the return of an asset is uncertain. For this reason, Markowitz formulated the portfolio optimization problem to mathematically analyze risk management based on diversified investment . Following his pioneering work, many mathematical models and analytical approaches have been reported in operations research [2, 3]. Recently, the properties of the optimal portfolio of the portfolio optimization problem have been actively explored using the analytical approaches developed in the cross-disciplinary research fields involving econophysics and statistical mechanical informatics. For instance, Laloux et al. investigated the statistical structure of the empirical correlation matrix for 406 assets in the

based on daily normalized returns for a total of 1309 days during 1991–1996 and proposed a technique for pruning the noise from the empirical correlation matrix by comparing the eigenvalue distribution of the empirical correlation matrix with that of a random matrix

[4, 5]. Plerou et al. analyzed the eigenvalue spacing distribution to investigate whether the empirical correlation matrix exhibits the universal statistical properties predicted by random matrix theory. For that purpose, they used stock price data of U.S. publicly traded companies over the 2-year period 1994-1995 . Pafka et al. quantitatively evaluated the correlation between assets by comparing the eigenvalue distribution of the empirical correlation matrix of return calculated from actual data with the Marenko-Pastur distribution . Ciliberti et al.

applied the replica analysis method to the mean-absolute deviation model and the expected shortfall model, and analyzed the phase transition that occurs when the number of data periods is large relative to the number of assets

. Shinzato showed that the minimal investment risk and its investment concentration satisfy the self-averaging property by using the large deviation principle, and he compared the minimal investment risk per asset derived using replica analysis with the minimal expected investment risk per asset derived using operations research and concluded that a portfolio which can minimize the expected investment risk does not necessarily minimize the investment risk . Additionally, Shinzato analyzed the minimization of investment risk under constraints of budget and investment concentration along with the dual problem by using replica analysis in order to clarify their primal-dual structure [10, 11]. Varga-Haszonits et al. examined the minimization of risk function defined by the sample variance under constraints of the budget and the expected return by using replica analysis and analyzed the stability of the replica symmetric solution . Shinzato examined the optimal portfolio which can minimize the investment risk with short selling using replica analysis and disclosed the phase transition of this investment system . Kondor et al. also analyzed the minimization of investment risk under constraints of budget and short selling in the case that the variances of the return rates of the assets are not identical by using replica analysis and reconfirmed that this disordered system involves a phase transition .

Although Ciliberti et al., Kondor et al., and Shinzato et al. have all studied the properties of the optimal solution of the portfolio optimization problem by using replica analysis, it is generally known that the validities of several methods used in replica analysis, for example, the analytic continuation of the replica number, have not been guaranteed theoretically[15, 16]. Therefore, we need to validate results obtained from replica analysis by another approach that is mathematically guaranteed, such as the random matrix approach. In addition, as mentioned above, the application of random matrix theory to the portfolio optimization problem is mainly based on the evaluation of the correlation matrix of the return rate, whereas its application to investment risk and investment concentration of the optimal portfolio has not been sufficiently examined.

In the present paper, we reassess the minimal/maximal investment risk per asset with budget and investment concentration constraints and the maximal/minimal investment concentration with constraints of budget and investment risk using the random matrix approach. Moreover, we consider whether it can be applied to the evaluation of the minimal/maximal investment risk per asset and investment concentration derived by the asymptotic eigenvalue distribution when the number of assets is sufficiently large but finite (not the thermodynamical limit).

This paper is organized as follows: In the next section, we formulate the minimization/maximization of investment risk under constraints of budget and investment concentration (primal problem) and the counterpart problems, the maximization/minimization of investment concentration under constraints of budget and investment risk (dual problem). In Sec. III, we analyze these two problems using the Lagrange multiplier method and the random matrix approach. In Sec. IV, numerical experiments for the portfolio optimization problems are carried out to validate the replica approach and the random matrix approach. Finally, in Sec. V, we devote our conclusions and future work.

## 2 Model Setting

The present study considers the optimal diversification investment based on the mean variance model as the primal problem and dual problem with assets over periods in a stable investment market where short selling is not regulated. The position on asset is denoted as , and the portfolio of assets is represented as , where notation indicates the transpose operator. Note that takes any real number due to there being no restriction on short selling. Furthermore, shows the return rate of asset at period , where the return rates are independent and identically distributed with mean and variance .

Herein, the objective function of the primal problem, , is defined as follows:

 HP(→w) = 12Np∑μ=1(N∑i=1¯xiμwi−N∑i=1E[¯xiμ]wi)2, (1)

where is the return rate of the portfolio at period and is its expectation. We will call in Eq. (1) investment risk hereafter. Investment risk can be rewritten as follows:

 HP(→w) = 12→wTJ→w, (2)

where is the variance-covariance matrix (or Wishart matrix) with components given by in terms of the modified return rate . In the primal problem, the portfolio is under the constraints defined as follows:

 N∑i=1wi = N, (3) N∑i=1w2i = Nττ≥1, (4)

where Eq. (3) is the budget constraint and Eq. (4) is the investment concentration constraint. in Eq. (4) is a constant which characterizes an investment concentration of risk management strategy. Investment concentration is an index for assessing the dispersion of the portfolio , and it shows the achievement of diversified investment in the same way as the Herfindahl-Hirschman index . In addition, the budget constraint in Eq. (3), which is different from the budget constraint used in operations research, is rescaled so that is in the limit as the number of assets approaches infinity, and it is possible to give a statistical interpretation to investment concentration by using Eq. (3) . Moreover, the subset of feasible portfolios, that is, those satisfying Eqs. (3) and (4), , is defined as follows:

 WP = {→w∈RN∣∣→wT→e=N, →wT→w=Nτ}, (5)

where

is the ones vector. For the primal problem, we consider the minimal investment risk per asset

and the maximal investment risk per asset :

 εmin = limN→∞min→w∈WP{1NHP(→w)}, (6) εmax = limN→∞max→w∈WP{1NHP(→w)}. (7)

Note, the primal problem and the dual problem have been evaluated already by replica analysis in previous work and the validity of the findings by replica analysis were verified by numerical experiments . However, the validity of the analytical approach of replica analysis has not been mathematically guaranteed. Thus, it is expected that there may be some resistance to conducting investment actions based on the results of replica analysis. For this reason, we reevaluate the primal problem and the dual problem by using the random matrix approach guaranteed mathematically. In previous work, using replica analysis, the minimal investment risk per asset was derived as follows:

 εmin = ⎧⎪ ⎪⎨⎪ ⎪⎩ατ+τ−1−2√ατ(τ−1)21−1τ≤α0otherwise, (8)

where the period ratio is used . In addition, the maximal investment risk per asset is as follows:

 εmax = ατ+τ−1+2√ατ(τ−1)2α>0. (9)

Similarly, we set the dual problem corresponding to this primal problem. In this case, the objective function, , is defined as follows:

 HD(→w) = 12N∑i=1w2i. (10)

This function corresponds to the investment concentration in Eq. (4), which is one of the constraints of the primal problem. The constraints of the dual problem are the budget constraint in Eq. (3) and the investment risk constraint defined as follows:

 12→wTJ→w = Nκε0. (11)

This equation uses the minimum investment risk per asset in the portfolio optimization problem with only the budget constraint imposed, . This constraint implies that the investment risk for assets is times the minimal investment risk imposed on the budget for assets, which is . We call the risk coefficient. Then the feasible portfolio subset satisfying Eq. (3) and Eq. (11) is defined as follows:

 WD = {→w∈RN∣∣∣→wT→e=N, 12→wTJ→w=Nκε0}. (12)

For the dual problem, we consider the maximal investment concentration and the minimal investment concentration :

 qw,max = limN→∞max→w∈WD{2NHD(→w)}, (13) qw,min = limN→∞min→w∈WD{2NHD(→w)}. (14)

In previous work, using replica analysis, the maximal investment concentration was also analyzed as

 qw,max = (√ακ+√κ−1)2α−1α>1, (15)

and the minimal investment concentration was assessed as

 qw,min = (√ακ−√κ−1)2α−1α>1. (16)

In the replica analysis of previous work, for instance, in the case of the primal problem, the minimum investment risk per asset was evaluated using the following equation:

 εmin = limβ→∞{−∂∂βlimN→∞1NE[logZ]}, (17)

where the partition function is defined using the Boltzmann distribution of the inverse temperature as

 Z = ∫→w∈WPd→we−βHp(→w), (18)

and the notation means the expectation with respect to the modified return rate , which is called the configuration average. In the process of evaluating included in the right-hand side of Eq. (17), an identity called a replica trick,

 E[logZ] = limn→0∂∂nlogE[Zn], (19)

is often used. In replica analysis, one first assumes that the replica number in Eq. (19), , is an integer and that one can implement a configuration average of (that is, calculate ). Then, we assume that the replica number is real and that analytic continuation of can be executed. However, the validity of the analytic continuation with respect to replica number from an integer to a real number has not yet been mathematically guaranteed for portfolio optimization problems, which is also the case for many problems in cross-disciplinary research fields . Therefore, we reexamine the primal problem and the dual problem mathematically in the present work by using the Lagrange multiplier method and the random matrix approach, as alternatives to replica analysis.

## 3 Lagrange multiplier method and random matrix approach

In this section, we consider the primal problem and the dual problem via the Lagrange multiplier method and the random matrix approach [17, 18, 19].

### 3.1 Minimal investment risk with budget and investment concentration constraints

First, we examine the minimal investment risk with budget and investment concentration constraints as the primal problem. The Lagrange function corresponding to the minimization problem of the investment risk is defined using Lagrange multipliers as follows:

 LP(→w,k,θ) = HP(→w)+k(N−→wT→e)+θ2(Nτ−→wT→w), s.t. k∈R (20) θ≤λi∀i=1,2,...,N,

where represents the eigenvalue of the Wishart matrix and the constraint in Eq. (3.1) is a condition to guarantee that the Lagrange function is convex with respect to [17, 18, 19]. This constraint can be rewritten as , for which in the limit as approaches infinity is known:

 λmin = {(1−√α)2α≥100<α<1, (21)

where the asymptotical spectrum of (Marenko-Pastur law) is used in the limit as goes infinity keeping . Note that the Lagrange multiplier method can also handle the investment risk with only the budget constraint imposed when (see Appendix C for details). From the extremum equations and ,

 →w∗ = k∗(J−θIN)−1→e, (22) k∗ = 1SN(θ), (23)

are obtained, where in Eq. (22) is the identity matrix, is a regular matrix because of Eq. (3.1), and is defined as follows:

 SN(θ) = →eT(J−θIN)−1→eN. (24)

Let us employ the properties of in the limit as approaches infinity in order to analyze briefly the optimal

of the Lagrange function. The singular value decomposition of the return rate matrix

is expressed as using orthogonal matrix , orthogonal matrix , and diagonal matrix , where are the singular values. Then the Wishart matrix is rewritten as . From this, can be rewritten as follows:

 SN(θ) = 1NN∑k=1u2kλk−θ (25) = ∫∞−∞1λ−θ1NN∑k=1u2kδ(λ−λk)dλ,

where is defined as and the Dirac delta function is used. Since satisfies , it is known that

is asymptotically, independently, and identically distributed according to the standard normal distribution in the limit that

goes to infinity [21, 22]. Further, has the self-averaging property in the thermodynamic limit of , so that converges to , which is given by the following equation:

 S(θ) = ∫∞−∞ρ(λ)λ−θdλ, (26)

where is an asymptotic eigenvalue distribution of the Wishart matrix , that is, the Marenko-Pastur law . The integral defined in Eq. (26), , is generally called the Stieltjes transform for the Marenko-Pastur law [23, 24]. For the details of the evaluation of Eq. (26), see Appendices A and B.

Based on the above argument, the investment risk per asset can be represented as a function of in the thermodynamic limit of as follows:

 ε(θ) = limN→∞1NLP(→w∗,k∗,θ) (27) = 12(1S(θ)+τθ).

Then the minimal investment risk per asset is given by the following extremum:

 εmin = supθ≤λminε(θ). (28)

From this, it is possible to analytically evaluate by using Eq. (27) and Eq. (58). Notice that this equation is equivalent to the minimization of investment risk per asset with respect to portfolio . In the following, we consider the minimal investment risk per asset in the ranges of (i) and (ii) .

(i)

First, in the range , is given in Eq. (21) and there exists in the range such that . This implies

 θ∗ = 1+α−(2τ−1)√ατ(τ−1). (29)

From this, the minimal investment risk per asset is obtained as follows:

 εmin = ατ+τ−1−2√ατ(τ−1)2. (30)
(ii)

Next, in the range , is already given in Eq. (21). Then is calculated. When , that is, , since the investment risk per asset is maximal at given by Eq. (29), the same result as Eq. (30) is derived. On the other hand, when , that is, , since the investment risk per asset is maximal at , the minimal investment risk per asset is

 εmin=0. (31)

By the above argument, is given by the following equation:

 θ∗ = ⎧⎪ ⎪ ⎪⎨⎪ ⎪ ⎪⎩1+α−(2τ−1)√ατ(τ−1)1−1τ<α0otherwise. (32)

Thus, the minimal investment risk per asset is

 εmin = ⎧⎪ ⎪⎨⎪ ⎪⎩ατ+τ−1−2√ατ(τ−1)21−1τ<α0otherwise. (33)

This result is consistent with the findings in previous work using replica analysis .

### 3.2 Maximal investment risk with budget and investment concentration constraints

Next, we consider the maximal investment risk with budget and investment concentration constraints as the primal problem. The Lagrange function corresponding to the maximization problem of the investment risk is defined as follows:

 LP(→w,k,θ) = HP(→w)+k(N−→wT→e)+θ2(Nτ−→wT→w) s.t. k∈R (34) θ≥λi∀i=1,2,...,N,

where the constraint in Eq. (3.2) is a condition to guarantee that the Lagrange function is concave with respect to [17, 18, 19]. This constraint can be rewritten as , where in the thermodynamical limit of is known to be given by

 λmax = (1+√α)2, (35)

which again uses the Marenko-Pastur law . Since the optimality of and are already shown in the previous subsection (Eqs. (22) and (23)), the maximal investment risk per asset is derived as follows:

 εmax = infθ≥λmaxε(θ), (36)

where is in Eq. (27). Note that this equation is equivalent to the maximization of investment risk per asset with respect to portfolio . For any , since there exists of in the range ,

 θ∗ = 1+α+(2τ−1)√ατ(τ−1), (37)

and thus the maximal investment risk per asset is as follows:

 εmax = ατ+τ−1+2√ατ(τ−1)2. (38)

This derived result also is consistent with findings in previous work .

### 3.3 Maximal investment concentration with constraints of budget and investment risk

Next, we consider the maximal investment concentration with constraints of budget and investment risk as the dual problem. The Lagrange function corresponding to the maximization problem of the investment concentration is defined using Lagrange multipliers as follows:

 LD(→w,h,φ) = HD(→w)+hφ(→wT→e−N)+1φ(κNε0−12→wTJ→w), s.t. h∈R (39) φ−1λi≥1∀i=1,2,...,N,

where the constraint in Eq. (3.3) is a condition to guarantee that the Lagrange function is concave with respect to [17, 18, 19]. This constraint can be rewritten as by using the Marenko-Pastur law in the limit that goes to infinity (we consider the maximal/minimal investment concentration in the range because ). From the extremum conditions and ,

 →w∗ = h∗(J−φIN)−1→e, (40) h∗ = 1SN(φ), (41)

are obtained and the investment concentration can be represented as a function of :

 qw(φ) = limN→∞2NLD(→w∗,h∗,φ) (42) = −1φ(1S(φ)−2κε0).

Thus, the maximal investment concentration is derived from the following extremum:

 qw,max = inf0≤φ≤λminqw(φ). (43)

Note that this equation is equivalent to the maximization of investment concentration with respect to portfolio . For any , since there exists of in the range of ,

 φ∗ = (κ−√ακ(κ−1))(κ−1−√ακ(κ−1))(κ−αα−1)(κ+1α−1), (44)

and the maximal investment concentration is calculated as follows:

 qw,max = (√ακ+√κ−1)2α−1. (45)

This result also is consistent with results of previous work .

### 3.4 Minimal investment concentration with constraints of budget and investment risk

Finally, we consider the minimal investment concentration with constraints of budget and investment risk as the dual problem. The Lagrange function corresponding to the minimization problem of the investment concentration is defined as follows:

 LD(→w,h,φ) = HD(→w)+hφ(→wT→e−N)+1φ(κNε0−12→wTJ→w), s.t. h∈R (46) φ−1λi≤1∀i=1,2,...,N,

where the constraint in Eq. (3.4) is a condition to guarantee that the Lagrange function is concave with respect to [17, 18, 19]. This constraint can be rewritten as or by using the Marenko-Pastur law when the number of assets is large enough. Since the optimality of and have already been shown in Eq. (40) and (41), the minimal investment concentration is given by the following equation:

 qw,min = supφ≤0,φ≥λmaxqw(φ), (47)

where is in Eq. (42). Note that this equation is equivalent to the minimization of investment concentration with respect to portfolio . We can derive of in the ranges of and as follows:

 φ∗ = (κ+√ακ(κ−1))(κ−1+√ακ(κ−1))(κ−αα−1)(κ+1α−1), (48)

where there exists such that when and when . Thus, the minimal investment concentration is obtained as follows:

 qw,min = (√ακ−√κ−1)2α−1. (49)

This result also is consistent with results of previous work .

From our results for the dual problem, if we assume that the maximal investment concentration in Eq. (45) is equal to , then since can be represented as , the investment risk per asset is as follows:

 ε = ατ+τ−1−2√ατ(τ−1)2, (50)

which agrees with the minimal investment risk per asset in Eq. (30). That is, the primal-dual relationship holds between the minimization of investment risk per asset under constraints of budget and investment concentration and the maximization of investment concentration under constraints of budget and investment risk. Similarly, if we also assume that the minimal investment concentration in Eq. (49) is consistent with , then since can be represented as , the investment risk per asset is as follows:

 ε = ατ+τ−1+2√ατ(τ−1)2, (51)

which agrees with the maximal investment risk per asset in Eq. (38). That is, the primal-dual relationship also holds between the maximization of investment risk under constraints of budget and investment concentration and the minimization of investment concentration under constraints of budget and investment risk.

## 4 Numerical experiments

In the analysis in the previous section, we used the asymptotic eigenvalue distribution based on random matrix theory without a detailed discussion of whether the upper and lower bounds of investment risk per asset and investment concentration in actual investment market size can be evaluated or not. In fact, it has not been confirmed whether the theoretical results (Eqs. (33), (38), (45), and (49)) are valid or not when the number of assets is sufficiently large but finite (not the thermodynamical limit of ). In this section, we confirm the consistency of theoretical results using the asymptotic eigenvalue distribution by calculating typical values of upper and lower bounds of investment risk and investment concentration in numerical experiments for the case that is sufficiently large but finite. In numerical experiments, the return rates of the assets are taken to be independently and identically distributed according to the standard normal distribution and return rate matrices are prepared as sample sets. Furthermore, the number of assets in a numerical simulation is set as and the period ratio is set as (also, is assumed). We assess the optimal solutions by using the steepest descent method for the Lagrange function defined by each return rate matrix and then calculate investment risk and investment concentration . We also evaluate their sample averages,

 ε = 1100100∑m=1εm, (52) qw = 1100100∑m=1qmw, (53)

and compare them with the findings derived using our proposed approach.

Firstly, the results of the primal problem are considered, shown in Figs. 2 and 2. Fig. 2 shows the minimal investment risk per asset and Fig. 2 shows the maximal investment risk per asset . In both figures, the vertical axis is the investment risk per asset and the horizontal axis is the coefficient of the investment concentration constraint . The solid lines (red) represent theoretical results and the symbols with error bars (black and gray) represent the results of numerical experiments. Using these figures, we confirm that the upper and lower bounds of the investment risk per asset for assets (finite market size) can be evaluated with the theoretical results, since the results for both cases are equivalent.

Next, the results of the dual problem are considered. Figs. 4 and 4 show respectively the maximal investment concentration and the minimal investment concentration . In both figures, the vertical axis is investment concentration and the horizontal axis is the risk coefficient . The solid lines (red) represent theoretical results and the symbols with error bars (black and gray) represent the results of numerical experiments. Using these figures, we also confirm that the upper and lower bounds of the investment concentration for assets (finite market size) can be evaluated with the theoretical results since in both cases the results are consistent.

## 5 Conclusion and future work

In this paper, we revisited the portfolio optimization problem, specifically the minimization/maximization of investment risk under constraints of budget and investment concentration (primal problem) and the maximization/minimization of investment concentration under constraints of budget and investment risk (dual problem). Both problems had already been analyzed using replica analysis in previous work. However, since the validity of the analytical continuation of the replica number from integer to real values has not been mathematically guaranteed, we formally reconsidered both problems by using the Lagrange multiplier method and the random matrix approach. Specifically, we expressed investment risk per asset and investment concentration as functions of Lagrange multipliers and applied Stieltjes transformation of the asymptotic eigenvalue distribution of the Wishart matrix so as to accurately assess the investment risk and investment concentration. In this assessment, it was possible to easily find the optimal value of each optimization problem. In addition, since the results obtained by replica analysis were consistent with the results derived by our proposed approach for both the primal problem and the dual problem, the validity of replica analysis for this portfolio optimization problem was confirmed. Furthermore, from the results of numerical experiments, it was confirmed that the upper and lower bounds of the investment risk and the investment concentration when the number of assets is large enough but finite can be consistent with the theoretical results based on the asymptotic eigenvalue distribution, which demonstrates the effectiveness of the random matrix approach and replica analysis for analyzing the portfolio optimization problem.

We showed in this study that investment risk per asset and investment concentration can be obtained analytically using Stieltjes transformation for the case that the variances of the return rates of assets are identical. As an extension of this result, we could evaluate easily the primal problem and the dual problem for the case that the variances of the return rates of assets are not identical in future work. Another issue to consider is that two constraints were used in the present study but it is also necessary to examine whether the random matrix approach is suitable for obtaining the optimal solution of the portfolio optimization problem under even more realistic conditions, for instance, when short selling regulations or other linear inequality constraints are imposed.

###### Acknowledgements.
The authors are grateful for detailed discussions with H. Hojo, A. Seo, M. Aida, Y. Kainuma, S. Masuda, and X. Xiao. One of the authors (DT) also appreciates T. Nakamura and T. Ishikawa for their fruitful comments. This work was supported in part by Grants-in-Aid Nos. 15K20999, 17K01260, and 17K01249; Research Project of the Institute of Economic Research Foundation at Kyoto University; and Research Project No. 4 of the Kampo Foundation.

## Appendix A Stieltjes transformation for Marˇcenko-Pastur distribution

In this appendix, we evaluate Eq. (26) by using the residue theorem. If we assume that the modified return rates are independently and identically distributed with mean and variance , then the empirical eigenvalue distribution of Wishart matrix converges to the asymptotic eigenvalue distribution called the Marenko-Pastur distribution in the limit as approaches infinity as follows :

 ρ(λ) = [1−α]+δ(λ)+√[λ+−λ]+[λ−λ−]+2πλ. (54)

where and . Initially, we calculate in the range by using Eq. (54). for can be rewritten using as follows:

 S(θ) = i4π∮|ξ|=1(ξ2−1)2(ξ−ξ0)(ξ−ξ1)(ξ−ξ2)(ξ−ξ3)(ξ−ξ4)dξ, (55)

where the poles are as follows:

 ξ0 = 0, ξ1 = −√α, ξ2 = −1√α, (56) ξ3 = −(1+α−θ)+√(1+α−θ)2−4α2√α, ξ4 = −(1+α−θ)−√(1+α−θ)2−4α2√α.

The residues at the poles, , , are

 Res[ξ0] = 1, Res[ξ1] = α−1θ, Res[ξ2] = −α−1θ, (57) Res[ξ3] = √(1+α−θ)2−4αθ, Res[ξ4] = −√(1+α−θ)2−4αθ.

Since and are satisfied, one of () and () satisfies and the other satisfies . Thus, owing to because , the combination of poles present inside the unit circle is (i) when and (ii) when . Furthermore, and can be rewritten as and , respectively, for , so that becomes the real-valued function given by the following equation:

 S(θ) = ⎧⎪ ⎪ ⎪ ⎪ ⎪ ⎪⎨⎪ ⎪ ⎪ ⎪ ⎪ ⎪⎩α−1−θ−√(1+α−θ)2−4α2θλ−>θα−1−θ+√(1+α−θ)2−4α2θλ+<θ, (58)

In contrast, the real part of diverges in the range since the denominator of the integrand can be 0. As a result, for example, since there does not exist an upper bound of in the range , we cannot solve Eq. (28). That is, the optimization problems derived with the Lagrange function cannot be solved in the range . For this reason, in this paper, we consider only the optimization problems for and , where takes only real values. Furthermore, in the range , it is also possible to calculate poles and fortunately the same result as Eq. (58) is obtained.

## Appendix B Replica approach for Stieltjes transformation

In this appendix, we reexamine from a different direction than in Appendix A. Initially, we consider a partition function to obtain as follows:

 Z = ∫∞−∞d→w(2π)N2e−12→wT(J−θIN)→w. (59)

Then, the logarithm of this partition function is summarized as follows:

 logZ = −12logdet|J−θIN|. (60)

can be obtained using the following identities:

 S(θ) = 2∂ϕ(θ)∂θ, (61) ϕ(θ) = limN→∞1NE[logZ], (62)

where configuration averaging is performed in Eq. (62) since satisfies the self-averaging property in a similar way to in Sec. 3.1. From Eqs. (61) and (62), it can be seen that we need to analytically assess in order to derive . Therefore, is calculated with for as follows:

 ϕ(n,θ) = limN→∞1NlogE[Zn] (63) = ExtrQw,~Qw{−α2logdet|In+Qw|+12TrQw~Qw −12logdet|~Qw−θIn|},

where and are symmetric matrices and is the identity matrix. We will also use the notation as the extrema of with respect to . Furthermore, extremum conditions with respect to are the following equations:

 ~Qw = α(In+Qw)−1