Skip to main content

Quantum algorithm for calculating risk contributions in a credit portfolio


Finance is one of the promising field for industrial application of quantum computing. In particular, quantum algorithms for calculation of risk measures such as the value at risk and the conditional value at risk of a credit portfolio have been proposed. In this paper, we focus on another problem in credit risk management, calculation of risk contributions, which quantify the concentration of the risk on subgroups in the portfolio. Based on the recent quantum algorithm for simultaneous estimation of multiple expected values, we propose the method for credit risk contribution calculation. We also evaluate the query complexity of the proposed method and see that it scales as \(\widetilde{O} (\sqrt{N_{\mathrm{gr}}}/\epsilon )\) on the subgroup number \(N_{\mathrm{gr}}\) and the accuracy ϵ, in contrast with the classical method with \(\widetilde{O} (\log(N_{\mathrm{gr}})/\epsilon^{2} )\) complexity. This means that, for calculation of risk contributions of finely divided subgroups, the advantage of the quantum method is reduced compared with risk measure calculation for the entire portfolio. Nevertheless, the quantum method can be advantageous in high-accuracy calculation, and in fact yield less complexity than the classical method in some practically plausible setting.

1 Introduction

Following the recent advance of quantum computing technology, people are now looking for industrial applications. Finance is one of promising fields (see [14] as comprehensive reviews). In particular, credit portfolio risk measurement is a problem for which applications of quantum algorithms are actively investigated. Every bank has a credit portfolio that consists of loans it has issued, and it is exposed to the credit risk, that is, the risk to incur the loss by defaults of obligors. In order to monitor such a risk, banks calculate risk measures that quantify the amount of the risk, such as the value at risk (VaR), the percentile (e.g. 99%) of the loss distribution, and the conditional VaR (CVaR), the conditional expectation of the loss given that it exceeds the VaR (see [5] as a recent review). They are often evaluated by the Monte Carlo method [6], in which defaults are randomly generated by some mathematical model and many sample values of the loss are taken. Generating many samples, whose number is typically of order 106, for a large credit portfolio, which can contain millions of obligors for major banks, is of high computational cost. On the other hand, there are some quantum algorithms for Monte Carlo integration [79] based on quantum amplitude estimation [8, 1017]. Although the classical Monte Carlo integration has sample complexity scaling as \(O(\epsilon^{-2})\) on ϵ, the error tolerance for the integral, query complexity in the quantum counterparts scales as \(O(\epsilon^{-1})\), which is often referred to as quantum quadratic speedup. Therefore, quantum Monte Carlo integration has been applied to credit portfolio risk measurement in previous studies [1820], and is expected to provide speedup and sophistication for credit risk management in banks in the future.

In this paper, we focus on another problem in credit risk management, that is, calculation of risk contributions. VaR and CVaR indicate the amount of the risk in the entire portfolio, but we sometimes want to know how each subportfolio contributes to the risk measures. In other words, we want to quantitatively evaluate the concentration of the risk to subgroups of obligors. If a bank has such measures, they will help it to analyze and disperse the risk. For example, it can notice that the risk concentrates on obligors in some specific industrial sector or some specific region, and that some business division in it are taking the risk too much. In fact, such measures called risk contributions have been defined and how to calculate them has been studied [5, 2129]. They are written as conditional expected values, and therefore calculating them by Monte Carlo is more costly than the entire risk measures, since only a small fraction of samples matches the conditions and we need to generate more samples.

Then, this paper aims at quantum speedup of credit risk contribution calculation. Note that original quantum algorithms for Monte Carlo integration [79] output an estimate of a single expected value, and that sequentially applying such an algorithm to calculation of risk contributions of \(N_{\mathrm{gr}}\) obligor groups, which leads to \(O(N_{\mathrm{gr}}/\epsilon)\) complexity, is not efficient. Instead, we resort to the recently proposed quantum algorithm for simultaneous calculation of expected values of multiple random variables [30] (see also [31]). This algorithm outputs d expected values with accuracy ϵ, making \(\widetilde{O} (\sqrt{d}/\epsilon )\) queriesFootnote 1 to two oracles, of which one generates a state that encodes the probability distribution in amplitudes and the other computes the random variables. Presenting how to construct these oracles concretely, we show that this quantum algorithm can be in fact applied to risk contribution calculation. We then see that the number of queries to building-block operations in the proposed method scales as \(\widetilde{O} (\sqrt{N_{\mathrm{gr}}}/\epsilon )\) on \(N_{\mathrm{gr}}\) and ϵ. This means quantum quadratic speedup with respect to ϵ, but not with respect to \(N_{\mathrm{gr}}\), since the classical Monte Carlo method has \(\widetilde{O} (\log(N_{\mathrm{gr}})/\epsilon^{2} )\) complexity. In general, the more finely divided obligor groups we set, the more the advantage of the quantum method is reduced. Nevertheless, as we will see later, in some practically plausible problem setting, the proposed method seems to be advantageous against the classical method in terms of query complexity.

The rest of this paper is organized as follows. In Sect. 2, we review the Merton model [32], a widely-used mathematical model for credit portfolio risk measurement, and introduce risk measures such as VaR and CVaR and risk contributions. Section 3 is the main part of this paper. In this section, as preparations, we present some oracles used as building blocks in the proposed method such as arithmetic operations, controlled rotation and generation of a state corresponding to a standard normal random variable, and introduce quantum multiple expected value estimation [30] and fixed-point quantum amplitude amplification (QAA) [33], which is another important base quantum algorithm. Then, we present the proposed quantum method as Theorem 3, the main result of this work, and discuss its complexity and comparison with the classical method. Section 4 summarizes this paper.

1.1 Notations

Here, we summarize some notations we later use. \(\mathbb{R}_{+}\) denotes the set of all positive real number: \(\mathbb{R}_{+}:=\{x\in\mathbb{R} | x>0\}\). For \(n\in\mathbb{N}\), we define \([n]:=\{1,\ldots,n\}\). For \(\epsilon\in\mathbb{R}_{+}\), we say that \(x\in\mathbb{R}\) is a ϵ-approximation of \(y\in\mathbb{R}\) if \(|x-y|\le\epsilon\). \(1_{C}\) denotes the indicator function, which takes 1 if the condition C is satisfied and 0 otherwise. \(\delta_{a,b}\) denotes the Kronecker delta: for integers a and b, \(\delta_{a,b}=1\) if \(a=b\) and 0 otherwise.

2 Credit risk measures and risk contributions

In this section, we introduce some risk measures and risk contributions for a credit portfolio.

2.1 Credit risk model

First, we introduce a mathematical model for credit portfolio risk measurement, the Merton model [32], which is widely used in practical business and considered in this paper. Let us consider a credit portfolio consisting of \(N_{\mathrm{obl}}\) obligors, whose exposuresFootnote 2 are \(e_{1},\ldots,e_{N_{\mathrm{obl}}}\in\mathbb{R}_{+}\). Then, in the Merton model, we model the loss L in the portfolio as follows, using independent random variables \(X_{0},X_{1},\ldots,X_{N_{\mathrm{obl}}}\) that follows the standard normal distribution:

$$\begin{aligned} L(X_{0},X_{1},\ldots,X_{N_{\mathrm{obl}}})=\sum _{k=1}^{N_{\mathrm{obl}}} e_{k}Y_{k}(X_{0},X_{k}). \end{aligned}$$

Here, for each \(k\in[N_{\mathrm{obl}}]\), \(Y_{k}\) is defined as

$$\begin{aligned} Y_{k}(X_{0},X_{k}):=1_{Z_{k}(X_{0},X_{k})< z_{k}}, \end{aligned}$$

and \(Z_{k}\) is defined as

$$\begin{aligned} Z_{k}(X_{0},X_{k}):=a_{k} X_{0} + \sqrt{1-a_{k}^{2}}X_{k}, \end{aligned}$$

with constants \(z_{k}\in\mathbb{R}\) and \(a_{k}\in(0,1)\). \(Y_{k}=1\) and \(Y_{k}=0\) mean that the kth obligor defaults and not, respectively. \(Z_{k}\) is called the value of the firm of the kth obligor, and it defaults if \(Z_{k}\) falls below some threshold \(z_{k}\). It is set according to the default probability of the obligor, which is usually set based on some credit rating model. Note that \(X_{0}\) is common for all the obligors but \(X_{1},\ldots,X_{N_{\mathrm{obl}}}\) affect only the first,…, \(N_{\mathrm{obl}}\)th obligors, respectively. \(X_{0}\) is called a systematic risk factor, which reflects the situation of macro economy, and \(X_{1},\ldots,X_{N_{\mathrm{obl}}}\) are called idiosyncratic risk factors, which reflect the matters unique to the credit of the individual obligor.Footnote 3\(Z_{k}\) is the linear combination of \(X_{0}\) and \(X_{k}\) as (3), and follows the standard normal distribution too. The coefficients \(a_{1},\ldots,a_{N_{\mathrm{obl}}}\) control correlations between the values of the firms: \({\mathrm{Cor}}(Z_{k},Z_{k^{\prime}})=\alpha_{k}\alpha_{k^{\prime }}\) for different \(k,k^{\prime}\in[N_{\mathrm{obl}}]\). Therefore, setting these coefficients close to 1 leads to strong correlations, which make simultaneous defaults of many obligors more probable and fatten the tail of the loss distribution. Also note that, under the condition that \(X_{0}\) takes a value \(x_{0}\in\mathbb{R}\), \(Y_{k}\) follows a Bernoulli distribution with the probability that \(Y_{k}=1\) being

$$\begin{aligned} P^{\mathrm{def}}_{k}(x_{0}):=\Phi_{\mathrm{SN}} \biggl( \frac{z_{k}-a_{k}x_{0}}{\sqrt{1-a_{k}^{2}}} \biggr), \end{aligned}$$

where \(\Phi_{\mathrm{SN}}\) is the cumulative distribution function (CDF) of the standard normal distribution.

2.2 Risk measures

In order to quantitatively assess the risk in a portfolio, some risk measures have been proposed. Most widely used one is the VaR. Given \(\alpha\in(0,1)\), which is typically set so that \(1-\alpha=0.99\) (99%) or 0.999 (99.9%), we define the \(100(1-\alpha)\)% VaR as

$$\begin{aligned} V_{\alpha}:= \inf \bigl\{ x\in\mathbb{R} | {\mathrm{Pr}} \bigl(L(X_{0},X_{1},\ldots,X_{N_{ \mathrm{obl}}})\ge x \bigr)\le \alpha \bigr\} . \end{aligned}$$

This means that the probability that the loss larger than \(100(1-\alpha)\)% VaR occurs is at most α.

Another widely used measure is the CVaR, which is also known as the expected shortfall. Given \(v\in\mathbb{R}_{+}\), we define

$$\begin{aligned} C_{v} := \mathbb{E}_{\mathrm{Mer}} \bigl[L(X_{0},X_{1}, \ldots,X_{N_{\mathrm{obl}}}) | L(X_{0},X_{1}, \ldots,X_{N_{\mathrm{obl}}})\ge v \bigr], \end{aligned}$$

where \(\mathbb{E}_{\mathrm{Mer}}[\cdot]\) denotes the (conditional) expected value with respect to randomness of \(X_{0},X_{1},\ldots,X_{N_{\mathrm{obl}}}\). Then, \(100(1-\alpha)\)% CVaR is defined as \(C_{V_{\alpha}}\), that is, (6) with \(v=V_{\alpha}\). In practice, we first obtain some estimation v of the VaR, and then calculate \(C_{v}\) as an estimation of the CVaR.

2.3 Risk contributions

In practice, calculating only risk measures for the entire portfolio is not sufficient. Sometimes, we need to decompose the risk measures to contributions from the subgroups in the portfolio, in order to, for example, analyze concentration of the risk. There are some studies on how to define and calculate such risk contributions [2129], which we now outline.

First, we present how to represent the subgroups. We assume that the obligors in the portfolio are divided into \(N_{\mathrm{gr}}\) groups, in which the numbers of obligors are \(n_{1},\ldots,n_{N_{\mathrm{gr}}}\in\mathbb{N}\). Without loss of generality, we can assign small indexes to the obligors in the group with a small index. That is, for each \(K\in[N_{\mathrm{gr}}]\), we assume that the Kth group contains \(\kappa^{K}_{1}\)th,…, \(\kappa^{K}_{n_{K}}\)th obligors, where

$$\begin{aligned} \kappa^{K}_{k} := \textstyle\begin{cases} k; & {\text{for }} K=1,k\in[n_{1}], \\ \sum_{K^{\prime}=1}^{K-1} n_{K^{\prime}} + k; & {\text{for }} K\in \{2,\ldots,N_{\mathrm{gr}}\},k\in[n_{K}]. \end{cases}\displaystyle \end{aligned}$$

Under this indexing, the loss in the Kth group is given as

$$\begin{aligned} L_{K}(X_{0},X_{\kappa^{K}_{1}},\ldots,X_{\kappa^{K}_{n_{K}}}):= \sum_{k= \kappa^{K}_{1}}^{\kappa^{K}_{n_{K}}} e_{k}Y_{k}(X_{0},X_{k}). \end{aligned}$$

We set the group according to how finely we want to analyze the risk. For example, if we want risk contributions of all individual obligors, we set \(N_{\mathrm{obl}}\) groups, each of which contains only one obligor. If not, we try appropriate grouping according to our purpose. For example, we can group obligors by their industrial and/or regional sectors, in order to monitor which sector the risk concentrate on and how large it is.

Now, we define the risk contributions as follows. With respect to the VaR, the risk contribution of the Kth group is

$$\begin{aligned} V^{K}_{\alpha}:= \mathbb{E}_{\mathrm{Mer}} [L_{K} | L= V_{ \alpha} ], \end{aligned}$$

and that with respect to the CVaR is

$$\begin{aligned} C^{K}_{v}:= \mathbb{E}_{\mathrm{Mer}} [L_{K} | L\ge v ]. \end{aligned}$$

Note that the sum of risk contributions over the groups is equal to the risk measure for the entire portfolio: \(\sum_{K=1}^{N_{\mathrm{gr}}}V^{K}_{\alpha}=V_{\alpha}\) and \(\sum_{K=1}^{N_{\mathrm{gr}}}C^{K}_{v}=C_{v}\), which makes these definitions of risk contributions plausible.

Also note that Monte Carlo estimation of risk contributions is harder than that of the risk measure for the entire portfolio. This is because of the definitions of risk contributions as conditional expected values. When we randomly generate samples of the random variable set \((X_{0},X_{1},\ldots,X_{N_{\mathrm{obl}}})\) or \((X_{0},Y_{1},\ldots,Y_{N_{\mathrm{obl}}})\), only the small fraction of them satisfy the condition \(L=V_{\alpha}\) or \(L\ge v\). Although we can nonetheless estimate CVaR contributions with the probability that \(L\ge v\) being not too small (say 0.01), estimating VaR contributions is much harder since the probability that the loss takes a specific value \(V_{\alpha}\) is much smaller. Even if we resort to quantum algorithms, estimating VaR contributions is hard, since the probability that the condition for the conditional expected value is satisfied affects the complexity, as we will see below. In light of this, we hereafter focus on CVaR contributions, only referring to some existing studies on VaR contribution calculation, such as the Monte Carlo method combined with importance sampling [26] and semi-analytical methods based on saddle-point approximation [2729].

3 Quantum algorithm for measuring risk contributions in a credit portfolio

3.1 Fixed-point binary representation by qubits

Before we present the quantum algorithm for CVaR contribution calculation, we need some preparations. First of all, we now present the current setting for numerical calculation on a quantum computer. In this paper, we consider systems consisting of some qubits, and use the bit string on a quantum register as the real number in fixed-point binary representation. More strictly, in this paper, a quantum register, or simply a register, means a system consisting of \(N_{\mathrm{dig}}\) qubits, where \(N_{\mathrm {dig}}\) is sufficiently large, and, for every \(x\in\mathbb{R}\), \(\mathopen{\vert }x\mathclose{\rangle}\) denotes a computational basis state on such a register with a bit string corresponding to \({\mathrm{argmin}}_{a\in\mathcal{G}}|x-a|\), where \(\mathcal{G}\) is some set of fixed-point binary numbers with \(N_{\mathrm{dig}}\) digits. We assume that \(\mathcal{G}\) covers the sufficiently wide range on the real axis with the sufficiently small interval, and that therefore approximating a real numbers with an element of G yields only a small error, which we hereafter neglect. Besides, for \(\vec{v}=(v_{1},\ldots,v_{d})^{T}\in\mathbb{R}^{d}\), \(\mathopen {\vert}\vec{v}\mathclose{\rangle}\) denotes a state on d-registers system such that \(\mathopen{\vert}\vec{v}\mathclose{\rangle}:=\mathopen{\vert }v_{1}\mathclose{\rangle}\cdots\mathopen{\vert}v_{d}\mathclose {\rangle}\).

3.2 Building-block oracles

Next, we introduce some oracles, which are used as parts of the algorithm.

Definition 1

We call the following oracles on a multi-register system arithmetic circuits.

  • Addition \(U_{\mathrm{add}}\): for any \(x,y\in\mathbb{R}\), \(U_{\mathrm{add}}\mathopen{\vert}x\mathclose{\rangle}\mathopen {\vert}y\mathclose{\rangle}=\mathopen{\vert}x\mathclose{\rangle }\mathopen{\vert}x+y\mathclose{\rangle}\)

  • Multiplication \(U_{\mathrm{mul}}\): for any \(x,y\in\mathbb{R}\), \(U_{\mathrm{add}}\mathopen{\vert}x\mathclose{\rangle}\mathopen {\vert}y\mathclose{\rangle}\mathopen{\vert}0\mathclose{\rangle }=\mathopen{\vert}x\mathclose{\rangle}\mathopen{\vert}y\mathclose {\rangle}\mathopen{\vert}xy\mathclose{\rangle}\)

  • Comparison \(U_{\mathrm{comp}}\): for any \(x,y\in\mathbb{R}\), \(U_{\mathrm{comp}}\mathopen{\vert}x\mathclose{\rangle}\mathopen {\vert}y\mathclose{\rangle}\mathopen{\vert}0\mathclose{\rangle }=\mathopen{\vert}x\mathclose{\rangle}\mathopen{\vert}y\mathclose {\rangle}(1_{x\ge y}\mathopen{\vert}1\mathclose{\rangle}+1_{x< y}\mathopen{\vert}0\mathclose{\rangle})\)

  • Standard normal CDF \(U_{\Phi_{\mathrm{SN}}}\): for any \(x\in\mathbb{R}\), \(U_{\Phi_{\mathrm{SN}}}\mathopen{\vert}x\mathclose{\rangle }\mathopen{\vert}0\mathclose{\rangle}=\mathopen{\vert}x\mathclose {\rangle}\mathopen{\vert}\Phi_{\mathrm{SN}}(x)\mathclose{\rangle}\)

  • Arccos and square root \(U_{\mathrm{acsr}}\): for any \(x\in[0,1]\), \(U_{\mathrm{acsr}}\mathopen{\vert}x\mathclose{\rangle}\mathopen {\vert}0\mathclose{\rangle}=\mathopen{\vert}x\mathclose{\rangle }\mathopen{\vert}\arccos(\sqrt{x})\mathclose{\rangle}\)

In fact, many proposals on circuit implementations for addition and multiplication have been made [3445]. Comparison of x and y is virtually a subtraction \(y-x\), since, when we use the 2’s complement method to represent a negative number, the top bit of \(y-x\) is 1 if \(y-x\le0\) and 0 otherwise. Also note that subtraction can be done as addition in the 2’s complement method. For the CDF of the standard normal distribution \(\Phi_{\mathrm{SN}}\), or, equivalently, the error function \({\mathrm{erf}}(x)=2\Phi_{\mathrm{SN}}(\sqrt{2}x)-1\), many accurate approximations with elementary functions have been proposed: for example, \({\mathrm{erf}}(x)\approx1-1/(1+a_{1}x+\cdots a_{6}x^{6})^{16}\) with \(a_{1} = 0.0705230784,a_{2} = 0.0422820123,a_{3} = 0.0092705272,a_{4} = 0.0001520143,a_{5} = 0.0002765672,a_{6} = 0.0000430638\) [46]. Therefore, \(U_{\Phi_{\mathrm{SN}}}\) can be approximately implemented with circuits for addition, multiplication and division (note that division circuits have also been proposed [4750]). For \(U_{\mathrm{acsr}}\), we can use implementation of inverse trigonometric functions in [51], and that of square root in [52].

Definition 2

We call the following oracles \(U_{\mathrm{CRY}}\) on a system consisting of a quantum register and a qubit the angle-controlled Y rotation:

$$\begin{aligned} U_{\mathrm{CRY}}:=\sum_{\theta\in\mathcal{G}} \mathopen{\vert }\theta \mathclose{\rangle}\mathopen{\langle}\theta\mathclose {\vert} \otimes R_{Y}(\theta) \end{aligned}$$

Here, R Y (θ):= ( cos θ sin θ sin θ cos θ ) for any \(\varphi\in\mathbb{R}\).

That is, \(U_{\mathrm{CRY}}\) is the rotation on the Bloch sphere around the Y-axis, whose angle θ is specified by another register. These gates can be implemented as a series of multi-controlled rotation gates with fixed angles [18].

Definition 3

We call the following oracle on a quantum register the SN state generation oracle:

$$\begin{aligned} U^{\mathrm{SN}}\mathopen{\vert}0\mathclose{\rangle}=\mathopen {\vert} \mathrm{SN}\mathclose{\rangle}:=\sum_{i=1}^{N_{\mathrm{SN}}} \sqrt{p^{\mathrm{SN}}_{i}} \mathopen{\bigl\vert }x^{\mathrm {SN}}_{i} \mathclose{\bigr\rangle }, \end{aligned}$$

where \(N_{\mathrm{SN}}\) is an integer not less than 2,

$$\begin{aligned} p^{\mathrm{SN}}_{i}:= \textstyle\begin{cases} \int_{-\infty}^{\frac{x^{\mathrm{SN}}_{1}+x^{\mathrm{SN}}_{2}}{2}} \phi_{\mathrm{SN}}(x)\,dx ;& {\text{for }} i=1; \\ \int_{\frac{x^{\mathrm{SN}}_{i-1}+x^{\mathrm{SN}}_{i}}{2}}^{ \frac{x^{\mathrm{SN}}_{i}+x^{\mathrm{SN}}_{i+1}}{2}} \phi_{\mathrm {SN}}(x)\,dx ;& { \text{for }} i\in\{2,\ldots,N_{\mathrm{SN}}-1\}, \\ \int^{\infty}_{ \frac{x^{\mathrm{SN}}_{N_{\mathrm{SN}}-1}+x^{\mathrm {SN}}_{N_{\mathrm{SN}}}}{2}} \phi_{ \mathrm{SN}}(x)\,dx; & {\text{for }} i=N_{\mathrm{SN}}, \end{cases}\displaystyle \end{aligned}$$

\(\phi_{\mathrm{SN}}\) is the probability density function for the standard normal distribution, and, for \(i\in[N_{\mathrm{SN}}]\), \(x^{\mathrm{SN}}_{i}:=-D+2D(i-1)/(N_{\mathrm{SN}}-1)\) with \(D\in\mathbb{R}_{+}\).

This can be interpret as an oracle to generate a state in which the standard normal distribution is approximately encoded in the amplitudes. That is, with sufficiently large \(N_{\mathrm{SN}}\) and D, the random variable \(X_{\mathrm{DiscSN}}\) that takes \(x^{\mathrm{SN}}_{1},\ldots,x^{\mathrm{SN}}_{N_{\mathrm{SN}}}\) with probabilities \(p^{\mathrm{SN}}_{1},\ldots,p^{\mathrm{SN}}_{N_{\mathrm{SN}}}\), respectively, can be viewed as a discretized approximation of a standard normal random variable, and we obtain \(x^{\mathrm{SN}}_{i}\) with probability \(p_{i}\) when we measure \(\mathopen{\vert}\mathrm{SN}\mathclose{\rangle}\). We hereafter use \(X_{\mathrm{DiscSN}}\) as if it followed the standard normal distribution and neglect any errors caused by this approximation.

Some implementations for this type of oracle have been proposed. Originally, the implementation as a series of arithmetic circuits and controlled rotation was proposed in [53], and some extensions and modifications on this have been also proposed recently [5456]. In another direction, some state preparation methods based on variational algorithms with parametric quantum circuits have been considered [5761].

3.3 Quantum algorithm for estimating multiple expected values

We next explain the quantum algorithm for simultaneous estimation of expected values of multiple random variables, which is the core of the proposed CVaR contribution calculation method. There are some recent proposals on such a quantum algorithm [30, 31]. In this paper, we use the algorithm in [30]. Formally, we have the following theorem.

Theorem 1

(Theorem 3.4 in [30])

Let \((\Omega,2^{\Omega},\mathbb{P})\) be a probability space where the sample space Ω is finite and elements ω in Ω are associated with mutually orthogonal states \(\mathopen{\vert}\omega \mathclose{\rangle}\) on a quantum register. Let ξ⃗ be a \(\mathbb{R}^{d}\)-valued random variable on \((\Omega,2^{\Omega},\mathbb{P})\), and suppose that ξ⃗ has a mean \(\vec{\mu}=(\mu_{1},\ldots,\mu_{d})^{T}\in\mathbb{R}^{d}\) and a covariance matrix \(\Sigma\in\mathbb{R}^{d\times d}\). Suppose that we have accesses to an oracle \(U_{\mathbb{P}}\) on a quantum register, which acts as

$$\begin{aligned} U_{\mathbb{P}}\mathopen{\vert}0\mathclose{\rangle}=\sum _{\omega \in\Omega} \sqrt{\mathbb{P}( \omega)}\mathopen{\vert}\omega \mathclose{\rangle}, \end{aligned}$$

and an oracle \(U_{\vec{\xi}}\) on a \((d+1)\)-registers system, which acts as

$$\begin{aligned} U_{\vec{\xi}}\mathopen{\vert}\omega\mathclose{\rangle}\mathopen {\vert}0 \mathclose{\rangle}^{\otimes d}=U_{\vec{\xi}} \mathopen {\vert}\omega \mathclose{\rangle} \mathopen{\bigl\vert }\vec{\xi}(\omega)\mathclose{\bigr\rangle } \end{aligned}$$

for any \(\omega\in\Omega\). Then, for given \(\delta\in(0,1)\) and \(n\in\mathbb{N}\) such that \(n\ge\log(d/\delta)\), there is a quantum algorithm \(\textup {\textsf {QEstimator}}_{d}(\vec{\xi},n,\delta)\) that outputs an estimate \(\vec{\mu}^{\prime}=(\mu^{\prime}_{1},\ldots,\mu^{\prime }_{d})^{T}\) of μ⃗ such that

$$\begin{aligned} \bigl\vert \mu_{i}-\mu^{\prime}_{i} \bigr\vert \le \frac{\sqrt{{\mathrm{Tr}}\Sigma}\log(d/\delta)}{n} \end{aligned}$$

for every \(i\in[d]\) with probability at least \(1-\delta\), making \(\widetilde{O}(n)\) calls to \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\).

On the oracles \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\) needed for this algorithm, we will later present the concrete way to construct for CVaR contribution calculation. Note that, along with \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\), \(\textup {\textsf {QEstimator}}_{d}(\vec{\xi},n,\delta)\) contains \(\widetilde{O}(dn)\) uses of arithmetic circuits, since we calculate the inner product \(\vec{u}\cdot\vec{\xi}\) with some \(\vec{u}\in\mathbb{R}^{d}\) in the algorithm [30]. However, we neglect them when we later count arithmetic computations in the proposed quantum method, since \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\) in the method contain more arithmetic computations. That is, as we will see later, they use arithmetic circuits \(O(N_{\mathrm{obl}})\) times, and the total number in \(\textup {\textsf {QEstimator}}_{d}(\vec{\xi},n,\delta)\) is therefore \(O(nN_{\mathrm{obl}})\), which is larger than \(\widetilde{O}(dn)\) since \(d=N_{\mathrm{gr}}\le N_{\mathrm{obl}}\) in the current problem.

3.4 Fixed-point quantum amplitude amplification

We also explain the fixed-point QAA presented in [33], which is an important subroutine in the proposed method. This is a modified version of the original QAA algorithm in [10]. Unlike the original one, the fixed-point QAA, as an unitary operation, amplifies the squared amplitude of the marked state in a superposition state to the value arbitrarily close to 1, without the unintended amplitude decay by too much iterative operations. Formally, we have the following theorem.

Theorem 2


Let \(\mathopen{\vert}\Phi\mathclose{\rangle}=\sqrt{p}\mathopen{\vert }\phi\mathclose{\rangle}\mathopen{\vert}1\mathclose{\rangle }+\sqrt{1-p}\mathopen{\vert}\phi^{\prime}\mathclose{\rangle} \mathopen{\vert}0\mathclose{\rangle}\) be a state on a system R with a qubit A attached, where \(\mathopen{\vert}\phi\mathclose{\rangle}\) and \(\mathopen{\vert }\phi^{\prime}\mathclose{\rangle}\) are states on R and \(p\in(0,1)\). Suppose that we are given an access to the oracle U that prepares \(\mathopen{\vert}\Phi\mathclose{\rangle}\): \(U\mathopen {\vert}0\mathclose{\rangle}\mathopen{\vert}0\mathclose{\rangle }=\mathopen{\vert}\Phi\mathclose{\rangle}\). Then, for any \(\delta\in(0,1)\), there is an unitary V that prepares a state \(\mathopen{\vert}\Phi^{\prime}\mathclose{\rangle}\) in the form of \(\mathopen{\vert}\Phi^{\prime}\mathclose{\rangle}=\sqrt{1-\delta ^{\prime}}\mathopen{\vert}\phi\mathclose{\rangle}\mathopen{\vert }1\mathclose{\rangle}+ \sqrt{\delta^{\prime}}\mathopen{\vert}\phi^{\prime\prime }\mathclose{\rangle}\mathopen{\vert}0\mathclose{\rangle}\), where \(\delta^{\prime}\in[0,\delta)\) and \(\mathopen{\vert}\phi^{\prime \prime}\mathclose{\rangle}\) is some state on R, making \(O (\frac{\log(\delta^{-1})}{\sqrt{p}} )\) calls to U.

Here, we assume that the marked state and other states are distinguished by whether a specific qubit A is \(\mathopen{\vert}1\mathclose {\rangle}\) or \(\mathopen{\vert}0\mathclose{\rangle}\), which suffices for the current problem of CVaR contribution calculation. [33] assumes that we can use the oracle \(U_{T}\) such that, for the market state \(\mathopen{\vert}T\mathclose{\rangle}\) with an ancilla qubit, \(U_{T}\mathopen{\vert}T\mathclose{\rangle}\mathopen{\vert }b\mathclose{\rangle}=\mathopen{\vert}T\mathclose{\rangle }\mathopen{\vert}b\otimes1\mathclose{\rangle}\), and that, for any state \(\mathopen{\vert}T^{\prime}\mathclose{\rangle}\) orthogonal to \(\mathopen{\vert}T\mathclose{\rangle}\), \(U_{T}\mathopen{\vert}T^{\prime}\mathclose{\rangle}\mathopen {\vert}b\mathclose{\rangle}=\mathopen{\vert}T^{\prime}\mathclose {\rangle}\mathopen{\vert}b\mathclose{\rangle}\), where \(b\in\{0,1\}\). Now, this is just a CNOT gate controlled by A, and therefore we will not consider the number of calls to it hereafter.

3.5 Proposed algorithm

We finally present the quantum algorithm for calculating CVaR contributions. Formally, we have the following theorem.

Theorem 3

Suppose that \(N_{\mathrm{obl}}\in\mathbb{N}\), \(e_{1},\ldots,e_{N_{\mathrm{obl}}}\in\mathbb{R}_{+}\), \(a_{1},\ldots,a_{N_{\mathrm{obl}}}\in(0,1)\), \(z_{1},\ldots,z_{N_{\mathrm{obl}}}\in\mathbb{R}\), \(\alpha\in (0,1)\) and \(\delta\in(0,1)\) are given. Suppose that \(N_{\mathrm{gr}}\in\mathbb{N}\) and \(n_{1},\ldots,n_{N_{\mathrm{gr}}}\in\mathbb{N}\) such that \(\sum_{K=1}^{N_{\mathrm{gr}}}n_{K}=N_{\mathrm{obl}}\) are given. Let v be a positive real number such that \(p:={\mathrm{Pr}}(L\ge v)>0\), where L is given in (1). Suppose that we are given \(C_{\mathrm{max}}\in\mathbb{R}\) satisfying

$$\begin{aligned} \max \bigl\{ C^{1}_{v}(e_{1}, \ldots,e_{N_{\mathrm{obl}}}),\ldots,C^{N_{\mathrm{gr}}}_{v}(e_{1}, \ldots,e_{N_{ \mathrm{obl}}}) \bigr\} \le C_{\mathrm{max}}. \end{aligned}$$

Suppose that we are given \(\sigma_{\mathrm{max}}\in\mathbb{R}\) satisfying

$$\begin{aligned} \max\{\sigma_{1},\ldots,\sigma_{N_{\mathrm{gr}}}\}\le\sigma _{\mathrm{max}}, \end{aligned}$$

where \((\sigma_{K})^{2}\) is the conditional variance of the random variable \(L_{K}\) in (8) given that \(L\ge v\). Suppose that we have an access to the SN state generation oracle \(U^{\mathrm{SN}}\). Then, for any \(\epsilon\in\mathbb{R}_{+}\) satisfying \(\epsilon\le\sigma_{\mathrm{max}}\sqrt{N_{\mathrm{gr}}}\), there is a quantum algorithm that, with probability at least \(1-\delta\), outputs the ϵ-approximations \(c_{1},\ldots,c_{N_{\mathrm{gr}}}\in\mathbb{R}\) of \(C^{1}_{v}(e_{1},\ldots,e_{N_{\mathrm{obl}}}),\ldots,C^{N_{\mathrm {gr}}}_{v}(e_{1},\ldots,e_{N_{ \mathrm{obl}}})\), respectively, using \(U^{\mathrm{SN}}\)

$$\begin{aligned} \widetilde{O} \biggl( \frac{\sigma_{\mathrm{max}}\sqrt{N_{\mathrm {gr}}}}{\epsilon\sqrt{p}}\log \biggl(\max \biggl\{ \frac{C_{\mathrm{max}}}{\epsilon}, \frac{E_{\mathrm{max}}}{\sigma _{\mathrm{max}}} \biggr\} \biggr)\log \biggl( \frac{N_{\mathrm{gr}}}{\delta} \biggr) \biggr) \end{aligned}$$

times, and arithmetic circuits and angle-controlled Y rotations

$$\begin{aligned} \widetilde{O} \biggl( \frac{\sigma_{\mathrm{max}}N_{\mathrm {obl}}\sqrt{N_{\mathrm{gr}}}}{\epsilon\sqrt{p}} \log \biggl(\max \biggl\{ \frac{C_{\mathrm{max}}}{\epsilon}, \frac{E_{\mathrm{max}}}{\sigma _{\mathrm{max}}} \biggr\} \biggr)\log \biggl( \frac{N_{\mathrm{gr}}}{\delta} \biggr) \biggr) \end{aligned}$$

times. Here, \(E_{\mathrm{max}}:=\max\{E_{1},\ldots,E_{N_{\mathrm {gr}}}\}\), where, for \(K\in[N_{\mathrm{gr}}]\), \(E_{K}:=\sum_{k=\kappa^{K}_{1}}^{\kappa^{K}_{n_{K}}}e_{k}\).


Consider the following probability space \((\Omega,2^{\Omega},\mathbb{P})\). The sample space is

$$\begin{aligned} \Omega= [N_{\mathrm{SN}}]\times\{0,1\}^{N_{\mathrm{obl}}}. \end{aligned}$$

The probability measure \(\mathbb{P}\) takes the form that, for each \(\omega=(i,y_{1},\ldots,y_{N_{\mathrm{obl}}})\in\Omega\),

$$\begin{aligned} \mathbb{P}(\omega)= \textstyle\begin{cases} \frac{1-\epsilon^{\prime}}{p}\mathcal{P}(i;y_{1},\ldots ,y_{N_{\mathrm{obl}}}) ;& {\text{if }} \sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v, \\ \frac{\epsilon^{\prime}}{1-p}\widetilde{\mathbb{P}}(i,y_{1},\ldots,y_{N_{ \mathrm{obl}}}) ;& {\text{otherwise}}. \end{cases}\displaystyle \end{aligned}$$


$$\begin{aligned} &\mathcal{P}(i;y_{1},\ldots,y_{N_{\mathrm{obl}}}) \\ &\quad:= p^{\mathrm{SN}}_{i}\prod_{k=1}^{N_{\mathrm{obl}}} \bigl(P^{\mathrm{def}}_{k} \bigl(x^{ \mathrm{SN}}_{i} \bigr) \delta_{y_{k},1}+ \bigl(1-P^{\mathrm{def}}_{k} \bigl(x^{\mathrm{SN}}_{i} \bigr) \bigr) \delta_{y_{k},0} \bigr) \end{aligned}$$

is the probability that \(X_{0}=x^{\mathrm{SN}}_{i},Y_{1}=y_{1},\ldots,Y_{N_{\mathrm {obl}}}=y_{N_{\mathrm{obl}}}\), and \(\frac{1}{p}\mathcal{P}(i;y_{1},\ldots,y_{N_{\mathrm{obl}}})\) is the conditional probability of the same event given \(\sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v\). \(\epsilon^{\prime}\) is some real number satisfying

$$\begin{aligned} 0\le\epsilon^{\prime}\le\min \biggl\{ \frac{\epsilon}{2C_{\mathrm {max}}}, \biggl( \frac{\sigma_{\mathrm{max}}}{E_{\mathrm{max}}} \biggr)^{2} \biggr\} . \end{aligned}$$

\(\widetilde{\mathbb{P}}\) is some probability measure on a measurable space \((\Omega,2^{\Omega})\). Note that

$$\begin{aligned} \epsilon^{\prime}\le1 \end{aligned}$$

holds because of \((\sigma_{\mathrm{max}})^{2}\le(E_{\mathrm {max}})^{2}\), which follows from \(L_{K}\le E_{\mathrm{max}}\) for every \(K\in[N_{\mathrm {gr}}]\), and that (25) makes \(\mathbb{P}\) non-negative and therefore well-defined. Besides, consider the following random variable \(\vec{\xi}=(\xi_{1},\ldots,\xi_{N_{\mathrm{gr}}})^{T}\in\mathbb{R}^{N_{ \mathrm{gr}}}\) on \((\Omega,2^{\Omega},\mathbb{P})\): for any \(K\in[N_{\mathrm{gr}}]\) and \(\omega=(i,y_{1},\ldots,y_{N_{\mathrm{obl}}},w)\in\Omega\),

$$\begin{aligned} \xi_{K}(\omega) := \textstyle\begin{cases} \sum_{k=\kappa^{K}_{1}}^{\kappa^{K}_{n_{K}}}e_{k}y_{k}; & {\text{if }} \sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v, \\ 0 ;& {\text{otherwise}}. \end{cases}\displaystyle \end{aligned}$$

Then, the expected value of \(\xi_{K}\) is

$$\begin{aligned} \mathbb{E}[\xi_{K}]= \bigl(1-\epsilon^{\prime} \bigr)C^{K}_{v}(e_{1},\ldots,e_{N_{ \mathrm{obl}}}). \end{aligned}$$

Because of (17) and (24),

$$\begin{aligned} \bigl\vert C^{K}_{v}(e_{1}, \ldots,e_{N_{\mathrm{obl}}})-\mathbb{E}[\xi_{K}] \bigr\vert \le \frac{\epsilon}{2} \end{aligned}$$

holds. Therefore, if we obtain \(\epsilon/2\)-approximations \(\bar{\xi}_{1},\ldots,\bar{\xi}_{N_{\mathrm{gr}}}\) of \(\mathbb{E}[\xi_{1}],\ldots,\mathbb{E}[\xi_{N_{\mathrm{gr}}}]\), they are also ϵ-approximations of \(C^{1}_{v},\ldots,C^{N_{\mathrm{gr}}}_{v}\).

Thus, we hereafter consider how to obtain such \(\bar{\xi}_{1},\ldots,\bar{\xi}_{N_{\mathrm{gr}}}\) by QEstimator. To use this, we need the oracles \(U_{\mathbb{P}}\) in (14) and \(U_{\vec{\xi}}\) in (15). First, let us consider \(U_{\mathbb{P}}\). Define

$$\begin{aligned} &\mathopen{\vert}\Psi_{\ge v}\mathclose{\rangle} \\ &\quad :=\frac{1}{\sqrt{p}}\sum_{i=1}^{N_{\mathrm{SN}}}\sum _{ \substack{y_{1},\ldots,y_{N_{\mathrm{obl}}}\in\{0,1\} \\ \sum _{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v}} \sqrt{\mathcal {P}(i;y_{1},\ldots ,y_{N_{\mathrm{obl}}})} \mathopen{\bigl\vert }x^{\mathrm {SN}}_{i}\mathclose{ \bigr\rangle }\mathopen{\vert}y_{1}\mathclose {\rangle} \cdots\mathopen{ \vert}y_{N_{\mathrm{obl}}}\mathclose{\rangle}, \end{aligned}$$

as a quantum state on a system S consisting of a quantum register and \(N_{\mathrm{obl}}\) qubits. On the system consisting of S and an additional qubit, we can perform the following operation:

$$\begin{aligned} & \mathopen{\vert}0\mathclose{\rangle}\mathopen{\vert }0\mathclose{ \rangle}^{\otimes N_{\mathrm{obl}}}\mathopen{\vert }0\mathclose{\rangle} \\ &\quad\rightarrow\sum_{i=1}^{N_{\mathrm{SN}}}\sqrt {p^{\mathrm{SN}}_{i}} \mathopen{\bigl\vert }x^{\mathrm{SN}}_{i} \mathclose {\bigr\rangle } \mathopen{\vert}0\mathclose{\rangle}^{\otimes N_{\mathrm {obl}}}\mathopen{ \vert}0\mathclose{\rangle} \\ &\quad\rightarrow\sum_{i=1}^{N_{\mathrm{SN}}}\sqrt {p^{\mathrm{SN}}_{i}} \mathopen{\bigl\vert }x^{\mathrm{SN}}_{i} \mathclose {\bigr\rangle } \Bigl(\sqrt{P^{\mathrm{def}}_{1} \bigl(x^{\mathrm{SN}}_{i} \bigr)} \mathopen{\vert}1\mathclose{ \rangle}+\sqrt{1-P^{\mathrm{def}}_{1} \bigl(x^{\mathrm{SN}}_{i} \bigr)}\mathopen{\vert}0\mathclose {\rangle} \Bigr) \\ &\qquad{} \otimes\cdots\otimes \Bigl(\sqrt{P^{\mathrm{def}}_{N_{ \mathrm{obl}}} \bigl(x^{\mathrm{SN}}_{i} \bigr)}\mathopen{\vert}1\mathclose { \rangle}+\sqrt{1-P^{\mathrm{def}}_{N_{\mathrm{obl}}} \bigl(x^{ \mathrm{SN}}_{i} \bigr)}\mathopen{\vert}0\mathclose{\rangle} \Bigr)\mathopen{\vert}0\mathclose{ \rangle} \\ &\quad=\sum_{i=1}^{N_{\mathrm{SN}}}\sum _{y_{1},\ldots,y_{N_{\mathrm{obl}}}\in\{0,1 \}}\sqrt{\mathcal{P}(i;y_{1},\ldots ,y_{N_{\mathrm{obl}}})} \mathopen{\bigl\vert }x^{\mathrm {SN}}_{i}\mathclose{ \bigr\rangle }\mathopen{\vert}y_{1}\mathclose {\rangle} \cdots\mathopen{ \vert}y_{N_{\mathrm{obl}}}\mathclose{\rangle }\mathopen{\vert}0\mathclose{\rangle} \\ &\quad\rightarrow \sum_{i=1}^{N_{\mathrm{SN}}}\sum _{y_{1},\ldots,y_{N_{\mathrm{obl}}} \in\{0,1\}}\sqrt{\mathcal{P}(i;y_{1},\ldots ,y_{N_{\mathrm{obl}}})} \mathopen{\bigl\vert }x^{\mathrm {SN}}_{i}\mathclose{ \bigr\rangle }\mathopen{\vert}y_{1}\mathclose {\rangle} \cdots\mathopen{ \vert}y_{N_{\mathrm{obl}}}\mathclose{\rangle} \\ &\qquad{} \otimes(1_{\sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k} \ge v}\mathopen{\vert}1\mathclose{\rangle}+1_{\sum _{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}< v} \mathopen{\vert}0\mathclose {\rangle} ) \\ &\quad=\sqrt{p}\mathopen{\vert}\Psi_{\ge v}\mathclose{\rangle }\mathopen{ \vert}1\mathclose{\rangle}+\sqrt{1-p} \mathopen{\vert }\Psi _{\mathrm{gar}} \mathclose{\rangle}\mathopen{\vert }0\mathclose{\rangle}, \end{aligned}$$

where \(\mathopen{\vert}\Psi_{\mathrm{gar}}\mathclose{\rangle}\) is some state on S and some ancillary registers are not displayed. In (30), we use \(U^{\mathrm{SN}}\) at the first arrow. At the second arrows, we calculate \(\arccos (\sqrt{P^{\mathrm{def}}_{1}(x^{\mathrm{SN}}_{i})} ),\ldots, \arccos (\sqrt{P^{\mathrm{def}}_{N_{\mathrm{obl}}}(x^{\mathrm{SN}}_{i})} )\) onto undisplayed ancillary registers using arithmetic circuits, and then operate \(U_{\mathrm{CRY}}\) with the rotation angles specified by these ancillary registers. At the third arrow, we calculate \(\sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\) by \(N_{\mathrm{obl}}\) additions and multiplications, then use \(U_{\mathrm{comp}}\). We denote by \(U_{\ge v}\) the oracle that acts as (30). Then, because of Theorem 2, we can generate a state

$$\begin{aligned} \mathopen{\vert}\Phi_{\ge v}\mathclose{\rangle}:=\sqrt{1-\epsilon ^{\prime}}\mathopen{\vert}\Psi _{\ge v}\mathclose{\rangle} \mathopen{ \vert}1\mathclose{\rangle}+\sqrt{\epsilon^{\prime }}\mathopen{\bigr\vert }\Psi _{\mathrm{gar}}^{\prime}\mathclose{\bigr\rangle } \mathopen{\vert}0\mathclose{ \rangle}, \end{aligned}$$

where \(\mathopen{\vert}\Psi_{\mathrm{gar}}^{\prime}\mathclose {\rangle}\) is some state and \(\epsilon^{\prime}\) is some real number satisfying (24), making

$$\begin{aligned} O \biggl( \frac{\log (\max \{\frac{C_{\mathrm{max}}}{\epsilon },\frac{E_{\mathrm{max}}}{\sigma_{\mathrm{max}}} \} )}{\sqrt{p}} \biggr) \end{aligned}$$

calls to \(U_{\ge v}\). Note that \(\mathopen{\vert}\Phi_{\ge v}\mathclose{\rangle}\) is in fact \(\sum_{\omega\in\Omega} \sqrt{\mathbb{P}(\omega)}\mathopen {\vert}\omega\mathclose{\rangle}\) with identification that

$$\begin{aligned} \mathopen{\vert}\omega\mathclose{\rangle} = \textstyle\begin{cases} \mathopen{\vert}x^{\mathrm{SN}}_{i}\mathclose{\rangle}\mathopen {\vert}y_{1}\mathclose{\rangle}\cdots\mathopen{\vert }y_{N_{\mathrm{obl}}}\mathclose{\rangle}\mathopen{\vert }1\mathclose{\rangle}; & {\text{if }} \sum_{k=1}^{N_{\mathrm{obl}}} e_{k}y_{k}\ge v, \\ \mathopen{\vert}x^{\mathrm{SN}}_{i}\mathclose{\rangle}\mathopen {\vert}y_{1}\mathclose{\rangle}\cdots\mathopen{\vert }y_{N_{\mathrm{obl}}}\mathclose{\rangle}\mathopen{\vert }0\mathclose{\rangle}; & {\text{otherwise}}, \end{cases}\displaystyle \end{aligned}$$

for each \(\omega=(i,y_{1},\ldots,y_{N_{\mathrm{obl}}})\in\Omega\). Therefore, we hereafter denote by \(U_{\mathbb{P}}\) the oracle that generates \(\mathopen{\vert}\Phi_{\ge v}\mathclose{\rangle}\) from \(\mathopen{\vert}0\mathclose{\rangle}\mathopen{\vert}0\mathclose {\rangle}^{\otimes N_{\mathrm{obl}}}\mathopen{\vert}0\mathclose {\rangle}\).

On the other hand, constructing \(U_{\vec{\xi}}\) is more simple. Given a state \(\mathopen{\vert}\omega\mathclose{\rangle}\) in (33) for \(\omega\in\Omega\), we can add \(N_{\mathrm{gr}}\) registers and perform the operation

$$\begin{aligned} &\mathopen{\bigl\vert }x^{\mathrm{SN}}_{i}\mathclose{\bigr\rangle }\mathopen { \vert}y_{1}\mathclose{\rangle}\cdots \mathopen{\vert}y_{N_{\mathrm{obl}}} \mathclose{\rangle}\mathopen {\vert}w\mathclose{\rangle} \mathopen{\vert}0 \mathclose{\rangle }^{N_{\mathrm{gr}}} \\ &\quad\rightarrow\mathopen{\bigl\vert }x^{\mathrm{SN}}_{i}\mathclose { \bigr\rangle }\mathopen{\vert}y_{1}\mathclose{\rangle}\cdots \mathopen{ \vert}y_{N_{\mathrm{obl}}}\mathclose{\rangle}\mathopen {\vert}w\mathclose{\rangle} \bigotimes_{K=1}^{N_{\mathrm{gr}}} \mathopen{\Biggl\vert }w\sum _{k=\kappa^{K}_{1}}^{\kappa ^{K}_{n_{K}}}e_{k}y_{k} \mathclose{\Biggr\rangle }, \end{aligned}$$

where \(w\in\{0,1\}\). This can be done by \(O(N_{\mathrm{obl}})\) multiplications and additions. Note that (34) is in fact \(U_{\vec{\xi}}\) for ξ⃗ in (26), since \(w=1\) is \(\sum_{k=1}^{N_{\mathrm{obl}}} e_{k}y_{k}\ge v\) and 0 otherwise.

With \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\) constructed as above, we perform \(\textup {\textsf {QEstimator}}_{N_{\mathrm{gr}}} (\vec{\xi},n,\delta )\) with

$$\begin{aligned} n= \biggl\lceil \frac{2\sqrt{2}\sigma_{\max}\sqrt{N_{\mathrm {gr}}}\log(N_{\mathrm{gr}}/\delta)}{\epsilon} \biggr\rceil . \end{aligned}$$

Because of (16), each of outcomes \(\bar{\xi}_{1},\ldots,\bar{\xi}_{N_{\mathrm{gr}}}\) of this satisfies

$$\begin{aligned} \bigl\vert \bar{\xi}_{K}-\mathbb{E}[\xi_{K}] \bigr\vert &\le \frac{\sqrt{{\mathrm{Tr}}\widetilde{\Sigma}}\log (N_{\mathrm{gr}}/\delta)}{n} \\ &\le \frac{\sqrt{N_{\mathrm{gr}}(\widetilde{\sigma}_{\max })^{2}}\log(N_{\mathrm{gr}}/\delta)}{n} \\ &\le \frac{\sqrt{2N_{\mathrm{gr}}(\sigma_{\max})^{2}}\log (N_{\mathrm{gr}}/\delta)}{n} \\ &\le \frac{\epsilon}{2}, \end{aligned}$$

where Σ̃ is the covariance matrix of \(\xi_{1},\ldots,\xi_{N_{\mathrm{gr}}}\), and \((\widetilde{\sigma}_{\max})^{2}\) is its largest diagonal element, that is, the maximum of the variances of \(\xi_{1},\ldots,\xi_{N_{\mathrm {gr}}}\). The third inequality in (36) holds since

$$\begin{aligned} (\widetilde{\sigma}_{\max})^{2} \le2(\sigma _{\max})^{2}, \end{aligned}$$

whose proof is postponed to Appendix 4. (36) means that \(\bar{\xi}_{1},\ldots,\bar{\xi}_{N_{\mathrm{gr}}}\) are \(\epsilon/2\)-approximations of \(\mathbb{E}[\xi_{1}],\ldots,\mathbb{E}[\xi_{N_{\mathrm {gr}}}]\), and also ϵ-approximations of \(C^{1}_{v},\ldots,C^{N_{\mathrm {gr}}}_{v}\), as discussed above.

Finally, let us count the numbers of calls to building-block circuits in this algorithm. \(\textup {\textsf {QEstimator}}_{N_{\mathrm{gr}}} (\vec{\xi},n,\delta )\) calls \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\) \(\widetilde{O}(n)\) times, that is,

$$\begin{aligned} \widetilde{O} \biggl( \frac{\sigma_{\max}\sqrt{N_{\mathrm {gr}}}\log(N_{\mathrm{gr}}/\delta)}{\epsilon} \biggr) \end{aligned}$$

times. \(U_{\mathbb{P}}\) makes iterative calls to \(U_{\ge v}\), whose number is evaluated as (32). In \(U_{\ge v}\), \(U^{\mathrm{SN}}\) is called once, and arithmetic circuits and \(U_{\mathrm{CRY}}\) are called \(O(N_{\mathrm{obl}})\) times. On the other hand, \(U_{\vec{\xi}}\) consists of \(O(N_{\mathrm{obl}})\) arithmetic circuits. In total, for the numbers of calls to building-block circuits, we obtain evaluations (19) and (20). □

3.6 Comparison with the classical Monte Carlo method

We have seen that the proposed quantum algorithm estimates \(N_{\mathrm{gr}}\) CVaR contributions with accuracy ϵ and has query complexity scaling on \(N_{\mathrm{gr}}\) and ϵ as \(O(\sqrt{N_{\mathrm{gr}}}/\epsilon)\). Seemingly, this means so-called quadratic quantum speedup with respect to both \(N_{\mathrm{gr}}\) and ϵ. However, if we do not require the scaling on ϵ to be \(O(\epsilon^{-1})\), we can achieve the better dependence on \(N_{\mathrm{gr}}\) classically. In classical Monte Carlo integration, we generate many samples of \(X_{0}\) and \(Y_{1},\ldots,Y_{N_{\mathrm{gr}}}\), calculate \(\widetilde{L}_{1},\ldots,\widetilde{L}_{N_{\mathrm{gr}}}\) for these samples, and take averages. By this procedure, we obtain ϵ-approximations for \(N_{\mathrm{gr}}\) CVaR contributions with high probability with \(\widetilde{O}(\log N_{\mathrm{gr}}/\epsilon^{-2})\) sample complexity [30]. This implies that, depending on \(N_{\mathrm{gr}}\) and ϵ, the quantum method might not be the best way.

In order to identify the situation where the quantum or classical method is better more precisely, let us evaluate the complexity in the classical method in more detail. The sample complexity to obtain ϵ-approximations for \(C^{1}_{v},\ldots,C^{N_{\mathrm{gr}}}_{v}\) with probability at least δ in the classical method is [30]

$$\begin{aligned} \widetilde{\Theta} \biggl( \frac{(\sigma_{\mathrm{max}})^{2}\log (N_{\mathrm{gr}}/\delta)}{\epsilon^{2}p} \biggr). \end{aligned}$$

Here, the factor \(1/p\) appears since we randomly generate \(\Theta(N/p)\) samples of \(X_{0},Y_{1},\ldots, Y_{N_{\mathrm{obl}}}\) in order to obtain N samples such that \(L\ge v\). In one sample generation, one standard normal random variable is generated, \(\Theta(N_{\mathrm{obl}})\) arithmetic operations are done, and \(N_{\mathrm{obl}}\) Bernoulli random variables are generated. In total, in the classical method, the number of standard normal random variable generations is evaluated as (39), and the numbers of arithmetic operations and Bernoulli random variable generations are

$$\begin{aligned} \widetilde{\Theta} \biggl( \frac{(\sigma_{\mathrm {max}})^{2}N_{\mathrm{obl}}\log(N_{\mathrm{gr}}/\delta)}{\epsilon ^{2}p} \biggr). \end{aligned}$$

Then, let us compare these complexity estimations with those for the proposed quantum method. We see that the quantum method is advantageous in query complexity if

$$\begin{aligned} \frac{(\sigma_{\mathrm{max}})^{2}}{\epsilon^{2}p}\gg N_{\mathrm {gr}}, \end{aligned}$$

although this is a rough discussion with logarithmic factors neglected.

As an extreme case, let us assume that we want CVaR contributions for all the individual obligors. In this case, \(N_{\mathrm{gr}}\) takes the maximum \(N_{\mathrm{obl}}\), and therefore it is most disadvantageous for the quantum method. Besides, we roughly evaluate \((\sigma_{\mathrm{max}})^{2}\) as \(\bar{p}_{\mathrm{def}}(1-\bar{p}_{\mathrm{def}})\bar{e}^{2}\), where \(\bar{p}_{\mathrm{def}}\) and ē are the typical scale of conditional default probabilities of obligors given \(L\ge v\) and that of exposures, respectively. Moreover, we set the accuracy ϵ relative to \(C_{\mathrm{max}}\) and roughly evaluate \(C_{\mathrm{max}}\) as \(\bar{p}_{\mathrm{def}}\bar{e}\). With these evaluations, (41) becomes

$$\begin{aligned} \biggl(\frac{C_{\mathrm{max}}}{\epsilon} \biggr)^{2} \frac{1-\bar {p}_{\mathrm{def}}}{p\bar{p}_{\mathrm{def}}}\gg N_{\mathrm{obl}}. \end{aligned}$$

Under a plausible assumption that \(p=0.01,p_{\mathrm{def}}\sim0.01,C_{\mathrm{max}}/{\epsilon}\sim 0.01\), the left hand side of (42) is of order 108, and therefore the quantum method is promising to be advantageous when \(N_{\mathrm{obl}}\ll10^{8}\), which is usually satisfied. In the case that \(N_{\mathrm{gr}}\ll N_{\mathrm{obl}}\), which means that we need CVaR contributions not for individual obligors but for some obligor groups, the quantum method becomes more advantageous.

4 Summary

In this paper, we considered application of quantum algorithms to CVaR contribution calculation, which is an important problem in financial risk management but has not been focused in the context of quantum computing. We clarified how to apply the recent quantum algorithm for multiple expected value estimation [30] to this problem as estimation of many conditional expected value, constructing the oracles needed in the algorithm with fixed-point QAA [33]. We then evaluated the numbers of queries to the building-block oracles, arithmetic operations, controlled rotation and SN state generation, as (19) and (20). In terms of query complexity, the proposed method achieves quantum quadratic speedup with respect to the accuracy ϵ, but the scaling of complexity on the number of obligor groups \(N_{\mathrm{gr}}\) is better in the classical method. This means that, for small ϵ and \(N_{\mathrm{gr}}\), the proposed method becomes advantageous against the classical method. We saw that, even when we calculate CVaR contributions for all the individual obligors, which is most disadvantageous for the quantum method, its query complexity is smaller than the classical method in some plausible setting.

But, unfortunately, it is obvious that the need for risk contributions of many finely divided obligor groups, which enable a bank to analyze the risk in details, reduces the quantum advantage compared with calculating only the risk measures for the entire portfolio, which was originally considered in [18]. As future works, not only for credit risk management but also for other types of financial problems, we should extend discussion on quantum computing application to various problem settings arising in practice and scrutinize the degree of quantum advantage.

Availability of data and materials

Not applicable.


  1. \(\widetilde{O}(\cdot)\) denotes \(O(\cdot)\) in the big-O notation with some logarithmic factors hidden.

  2. An exposure of an obligor is the amount of loss that occurs when it defaults. It is expressed as the product of the loan amount and the loss given default (LGD), the fraction of the amount which is not recovered. Although the LGD is sometimes modeled as a random variable, it is treated as a constant and therefore so is the exposure in this paper.

  3. Although the model with multiple systematic risk factors are often used, we consider the single-factor case for simplicity in this paper. Extending the discussion in this paper to the multi-factor case is straightforward.



value at risk


conditional value at risk


quantum amplitude amplification


loss given default


cumulative distribution function


  1. Orus R et al.. Quantum computing for finance: overview and prospects. Rev Phys. 2019;4:100028.

    Article  Google Scholar 

  2. Egger DJ et al.. Quantum computing for finance: state of the art and future prospects. IEEE Trans Quantum Eng. 2020;1:3101724.

    Article  Google Scholar 

  3. Bouland A, et al. Prospects and challenges of quantum finance. 2020. arXiv:2011.06492.

  4. Herman D, et al. A Survey of Quantum Computing for Finance. 2022. arXiv:2201.02773.

  5. Fischer M, Moser T, Pfeuffer M. A discussion on recent risk measures with application to credit risk: calculating risk contributions and identifying risk concentrations. Risks. 2018;6(4):142.

    Article  Google Scholar 

  6. Glasserman P. Monte Carlo methods in financial engineering. Berlin: Springer; 2003.

    Book  MATH  Google Scholar 

  7. Montanaro A. Quantum speedup of Monte Carlo methods. Proc R Soc Lond Ser A. 2015;471:2181.

    MathSciNet  MATH  Google Scholar 

  8. Suzuki Y et al.. Amplitude estimation without phase estimation. Quantum Inf Process. 2020;19:75.

    Article  MathSciNet  Google Scholar 

  9. Herbert S. Quantum Monte-Carlo integration: the full advantage in minimal circuit depth. Quantum. 2022;6:823.

    Article  Google Scholar 

  10. Brassard G et al.. Quantum amplitude amplification and estimation. Contemp Math. 2002;305:53.

    Article  MathSciNet  MATH  Google Scholar 

  11. Aaronson S, Rall P. Quantum approximate counting, simplified. In: Proceedings of symposium on simplicity in algorithms. Philadelphia: SIAM; 2020. p. 24–32.

    Chapter  Google Scholar 

  12. Nakaji K. Faster amplitude estimation. Quantum Inf Comput. 2020;20:1109.

    MathSciNet  Google Scholar 

  13. Giurgica-Tiron T, et al.. Low depth algorithms for quantum amplitude estimation. Quantum. 2022;6:745.

    Article  Google Scholar 

  14. Grinko D et al.. Iterative quantum amplitude estimation. npj Quantum Inf. 2021;7:52.

    Article  Google Scholar 

  15. Tanaka T et al.. Amplitude estimation via maximum likelihood on noisy quantum computer. Quantum Inf Process. 2021;20:293.

    Article  MathSciNet  Google Scholar 

  16. Uno S et al.. Modified Grover operator for amplitude estimation. New J Phys. 2021;23:083031.

    Article  MathSciNet  Google Scholar 

  17. Wang G et al.. Bayesian inference with engineered likelihood functions for robust amplitude estimation. PRX Quantum. 2021;2:010346.

    Article  Google Scholar 

  18. Egger DJ et al.. Credit risk analysis using quantum computers. IEEE Trans Comput. 2020;70(12):2136.

    Article  MathSciNet  MATH  Google Scholar 

  19. Miyamoto K, Shiohara K. Reduction of qubits in a quantum algorithm for Monte Carlo simulation by a pseudo-random-number generator. Phys Rev A. 2020;102:022424.

    Article  Google Scholar 

  20. Kaneko K et al.. Quantum speedup of Monte Carlo integration with respect to the number of dimensions and its application to finance. Quantum Inf Process. 2021;20:185.

    Article  MathSciNet  Google Scholar 

  21. Litterman R. Hot spots and hedges. J Portf Manag. 1996;23(5):52.

    Article  Google Scholar 

  22. Tasche D. Risk contributions and performance measurement. 1999. Working paper. Zentrum Mathematik (SCA), TU München.

  23. Kurth A, Tasche D. Contributions to credit risk. Risk. 2003;16(3):84.

    Google Scholar 

  24. Kalkbrener M. An axiomatic approach to capital allocation. Math Finance. 2003;15:425.

    Article  MathSciNet  MATH  Google Scholar 

  25. Kalkbrener M, Lotter H, Overbeck L. Sensible and efficient capital allocation for credit portfolios. Risk. 2004;17(1):S19–S24.

    Google Scholar 

  26. Glasserman P. Measuring marginal risk contributions in credit portfolios. 2005. FDIC Center for Financial Research Working Paper 2005-01.

  27. Martin R, Thompson K, Browne C. VaR: who contributes and how much? Risk. 2001;14(8):99.

    Google Scholar 

  28. Muromachi Y. A conditional independence approach for portfolio risk evaluation. J Risk. 2004;7(1):27.

    Article  Google Scholar 

  29. Muromachi Y. Improved estimation methods for value-at-risk, expected shortfall and risk contributions with high precision. J Risk. 2015;17(6):1.

    Article  Google Scholar 

  30. Cornelissen A, Hamoudi Y, Jerbi S. Near-optimal quantum algorithms for multivariate mean estimation. In: Proceedings of the 54th Symposium on Theory of Computing (STOC). 2022. p. 33.

    Google Scholar 

  31. Huggins WJ, et al. Nearly Optimal Quantum Algorithm for Estimating Multiple Expectation Values. 2021. arXiv:2111.09283.

  32. Merton RC. On the pricing of corporate debt: the risk structure of interest rates. J Finance. 1974;29:449.

    Google Scholar 

  33. Yoder TY, Low GH, Chuang IL. Fixed-point quantum search with an optimal number of queries. Phys Rev Lett. 2014;113:210501.

    Article  Google Scholar 

  34. Vedral V, Barenco A, Ekert A. Quantum networks for elementary arithmetic operations. Phys Rev A. 1996;54:147.

    Article  MathSciNet  Google Scholar 

  35. Beckman D et al.. Efficient networks for quantum factoring. Phys Rev A. 1996;54:1034.

    Article  MathSciNet  Google Scholar 

  36. Draper TG. Addition on a quantum computer. 2000. arXiv:quant-ph/0008033.

  37. Cuccaro SA et al.. A new quantum ripple-carry addition circuit. In: Proceeding of the eighth workshop on quantum information processing. 2004.

    Google Scholar 

  38. Takahashi Y, Kunihiro N. A linear-size quantum circuit for addition with no ancillary qubits. Quantum Inf Comput. 2005;5(6):440.

    MathSciNet  MATH  Google Scholar 

  39. Draper TG et al.. A logarithmic-depth quantum carry-lookahead adder. Quantum Inf Comput. 2006;6(4):351.

    MathSciNet  MATH  Google Scholar 

  40. Alvarez-Sanchez JJ, Alvarez-Bravo JV, Nieto LM. A quantum architecture for multiplying signed integers. J Phys Conf Ser. 2008;128:012013.

    Article  Google Scholar 

  41. Takahashi Y, Kunihiro N. A fast quantum circuit for addition with few qubits. Quantum Inf Comput. 2008;8(6):636.

    MathSciNet  MATH  Google Scholar 

  42. Takahashi Y, Tani S, Kubihiro N. Quantum addition circuits and unbounded fan-out. Quantum Inf Comput. 2010;10(9&10):872.

    MathSciNet  MATH  Google Scholar 

  43. Babu HMH. Cost-efficient design of a quantum multiplier-accumulator unit. Quantum Inf Process. 2016;16(1):30.

    Article  MATH  Google Scholar 

  44. Jayashree HV et al.. Ancilla-input and garbage-output optimized design of a reversible quantum integer multiplier. J Supercomput. 2016;72(4):1477.

    Article  Google Scholar 

  45. Muñoz-Coreas E, Thapliyal H. Quantum circuit design of a T-count optimized integer multiplier. IEEE Trans Comput. 2019;68(5):729.

    Article  MathSciNet  MATH  Google Scholar 

  46. Abramowitz M, Stegun I. Handbook of mathematical functions with formulas, graphs, and mathematical tables. New York: Dover; 1964.

    MATH  Google Scholar 

  47. Khosropour A, Aghababa H, Forouzandeh B. Quantum division circuit based on restoring division algorithm. In: Proceedings of 2011 eighth international conference on information technology: new generations (ITNG). 2011. p. 1037.

    Google Scholar 

  48. Jamal L, Babu HMH. Efficient approaches to design a reversible floating point divider. In: Proceedings of 2013 IEEE international symposium on circuits and systems (ISCAS). 2013. p. 3004.

    Chapter  Google Scholar 

  49. Dibbo SV, Babu HMH, Jamal L. An efficient design technique of a quantum divider circuit. In: Proceedings of 2016 IEEE international symposium on circuits and systems (ISCAS). 2016. p. 2102.

    Chapter  Google Scholar 

  50. Thapliyal H et al.. Quantum circuit designs of integer division optimizing T-count and T-depth. IEEE Trans Emerg Top Comput. 2019;9(2):1045.

    Article  Google Scholar 

  51. Häner T, Roetteler M, Svore KM. Optimizing Quantum Circuits for Arithmetic. 2018. arXiv:1805.12445.

  52. Muñoz-Coreas E, Thapliyal H. T-count and qubit optimized quantum circuit design of the non-restoring square root algorithm. ACM J Emerg Technol Comput Syst. 2018;14(3):36.

    Article  Google Scholar 

  53. Grover L, Rudolph T. Creating superpositions that correspond to efficiently integrable probability distributions. 2002. arXiv:quant-ph/0208112.

  54. Sanders YR. Black-box quantum state preparation without arithmetic. Phys Rev Lett. 2019;122:020502.

    Article  Google Scholar 

  55. Kaneko K et al.. Quantum pricing with a smile: implementation of local volatility model on quantum computer. EPJ Quantum Technol. 2022;9:7.

    Article  Google Scholar 

  56. Marin-Sanchez G, Gonzalez-Conde J, Sanz M. Quantum algorithms for approximate function loading. 2021. arXiv:2111.07933.

  57. Zhu D et al.. Training of quantum circuits on a hybrid quantum computer. Sci Adv. 2019;5:eaaw9918.

    Article  Google Scholar 

  58. Zoufal C, Lucchi A, Woerner S. Quantum generative adversarial networks for learning and loading random distributions. npj Quantum Inf. 2019;5:103.

    Article  Google Scholar 

  59. Chakrabarti S et al.. A threshold for quantum advantage in derivative pricing. Quantum. 2021;5:463.

    Article  Google Scholar 

  60. Nakaji K et al.. Approximate amplitude encoding in shallow parameterized quantum circuits and its application to financial market indicator. Phys Rev Res. 2022;4:023136.

    Article  Google Scholar 

  61. Alcazar J et al.. Quantum algorithm for credit valuation adjustments. New J Phys. 2022;24:023036.

    Article  MathSciNet  Google Scholar 

Download references


Not applicable.


This work was supported by MEXT Quantum Leap Flagship Program (MEXT Q-LEAP) Grant Number JPMXS0120319794.

Author information

Authors and Affiliations



KM as the sole author of the manuscript, conceived, designed and performed the analysis; he also wrote and reviewed the paper. The author read and approved the final manuscript.

Corresponding author

Correspondence to Koichi Miyamoto.

Ethics declarations

Competing interests

The authors declare no competing interests.

Appendix:  Proof of (37)

Appendix:  Proof of (37)

Let \(\mathbb{P}_{0}\) be a probability measure on the measurable space \((\Omega,2^{\Omega})\) such that

$$\begin{aligned} \mathbb{P}_{0}(\omega)= \textstyle\begin{cases} \frac{1}{p}\mathcal{P}(i;y_{1},\ldots,y_{N_{\mathrm{obl}}}); & {\text{if }} \sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v, \\ 0 ;& {\text{otherwise}}, \end{cases}\displaystyle \end{aligned}$$

for each \(\omega=(i,y_{1},\ldots,y_{N_{\mathrm{obl}}})\in\Omega\). For each \(K\in[N_{\mathrm{gr}}]\), the variances of \(\xi_{K}\) with respect to \(\mathbb{P}_{0}\) is equal to \((\sigma_{K})^{2}\), and written as

$$\begin{aligned} (\sigma_{K})^{2} = \sum_{\omega\in\Omega_{\ge v}} \mathbb{P}_{0}( \omega) \bigl(\xi_{K}(\omega) \bigr)^{2} - \biggl(\sum_{\omega\in\Omega_{ \ge v}} \mathbb{P}_{0}(\omega) \xi_{K}(\omega) \biggr)^{2}, \end{aligned}$$

where \(\Omega_{\ge v}:= \{(i,y_{1},\ldots,y_{N_{\mathrm{obl}}})\in\Omega | \sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v \}\). On the other hand, since \(\mathbb{P}(\omega)=(1-\epsilon^{\prime})\mathbb{P}_{0}(\omega)\) for \(\omega\in\Omega_{\ge v}\), we have

$$\begin{aligned} (\widetilde{\sigma}_{K})^{2} &= \sum_{\omega\in\Omega_{\ge v}} \mathbb{P}(\omega) \bigl(\xi _{K}( \omega) \bigr)^{2} - \biggl(\sum _{\omega\in\Omega_{\ge v}} \mathbb{P}( \omega) \xi_{K}(\omega) \biggr)^{2} \\ &= \bigl(1-\epsilon^{\prime} \bigr)\sum_{\omega\in\Omega_{\ge v}} \mathbb{P}_{0}(\omega) \bigl(\xi_{K}(\omega) \bigr)^{2} - \bigl(1-\epsilon^{ \prime} \bigr)^{2} \biggl(\sum_{\omega\in\Omega_{\ge v}} \mathbb{P}_{0}( \omega) \xi_{K}(\omega) \biggr)^{2} \\ &= (\sigma_{K})^{2} -\epsilon^{\prime}\sum _{\omega\in\Omega_{ \ge v}} \mathbb{P}_{0}(\omega) \bigl(\xi _{K}(\omega) \bigr)^{2}+\epsilon^{ \prime} \bigl(2- \epsilon^{\prime} \bigr) \biggl(\sum_{\omega\in\Omega_{\ge v}} \mathbb{P}_{0}(\omega) \xi_{K}(\omega) \biggr)^{2} \\ &\le (\sigma_{K})^{2} +\epsilon^{\prime} \bigl(1- \epsilon^{\prime} \bigr) \sum_{\omega\in\Omega_{\ge v}} \mathbb{P}_{0}(\omega) \bigl(\xi_{K}( \omega) \bigr)^{2}. \end{aligned}$$

In (45), at the inequality, we use (25) and \(\sum_{\omega\in\Omega_{\ge v}} \mathbb{P}_{0}(\omega) (\xi_{K}( \omega))^{2} \ge (\sum_{\omega\in\Omega_{\ge v}} \mathbb{P}_{0}(\omega) \xi_{K}(\omega) )^{2}\), which follows from the fact that the variance \((\sigma_{K})^{2}\) is non-negative. Then, applying \(\xi_{K}(\omega)\le E_{\mathrm{max}}\), (24) and (25) to (45), we obtain

$$\begin{aligned} (\widetilde{\sigma}_{K})^{2} \le(\sigma _{K})^{2} + (\sigma_{\mathrm{max}})^{2}, \end{aligned}$$

which implies \((\widetilde{\sigma}_{\mathrm{max}})^{2} \le2(\sigma_{\mathrm{max}})^{2}\).

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Miyamoto, K. Quantum algorithm for calculating risk contributions in a credit portfolio. EPJ Quantum Technol. 9, 32 (2022).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: