Book Image

Quantum Machine Learning and Optimisation in Finance

By : Antoine Jacquier, Oleksiy Kondratyev
Book Image

Quantum Machine Learning and Optimisation in Finance

By: Antoine Jacquier, Oleksiy Kondratyev

Overview of this book

With recent advances in quantum computing technology, we finally reached the era of Noisy Intermediate-Scale Quantum (NISQ) computing. NISQ-era quantum computers are powerful enough to test quantum computing algorithms and solve hard real-world problems faster than classical hardware. Speedup is so important in financial applications, ranging from analysing huge amounts of customer data to high frequency trading. This is where quantum computing can give you the edge. Quantum Machine Learning and Optimisation in Finance shows you how to create hybrid quantum-classical machine learning and optimisation models that can harness the power of NISQ hardware. This book will take you through the real-world productive applications of quantum computing. The book explores the main quantum computing algorithms implementable on existing NISQ devices and highlights a range of financial applications that can benefit from this new quantum computing paradigm. This book will help you be one of the first in the finance industry to use quantum machine learning models to solve classically hard real-world problems. We may have moved past the point of quantum computing supremacy, but our quest for establishing quantum computing advantage has just begun!
Table of Contents (4 chapters)

1.2 Postulates of Quantum Mechanics

Quantum mechanics states several mathematical postulates that a physical theory must satisfy. It turns out that the mathematics of quantum mechanics allows for more general computation: more general definition of the memory state in comparison with classical digital computing and a wider range of possible transformations of such memory states. A natural question arises: what is the reason for this superior mode of computation not being used until very recently? The answer is that although quantum mechanics was formulated almost a century ago (Paul Dirac’s seminal work "The Principles of Quantum Mechanics"  [86] was published in 1930), the realisation of the rules of quantum mechanics in the computational protocol performed on classical digital computers requires an enormous amount of memory. Exponential gains in computing power are offset by exponential memory requirements.

In order to perform quantum computations efficiently, we need to use actual quantum mechanical systems, with their ability to encode information in their states. To illustrate this point, the state of a quantum system consisting of n quantum bits (qubits) can be described by specifying 2n probability amplitudes – this is a huge amount of information even for very small systems (n 100) and it would be impossible to store this information in classical memory. It took decades of technological progress before quantum processing units (QPUs) – devices that control quantum mechanical systems performing computations – became feasible.

Let us now proceed with the formulation of the mathematical postulates that lie at the foundation of quantum mechanics. These postulates specify a general framework for describing the behaviour of a physical system  [80182249]:

  1. How to describe the state of a closed system.
  2. How to describe the evolution of a closed system.
  3. How to describe the interactions of a system with external systems.
  4. How to describe observables of a system.
  5. How to describe the state of a composite system in terms of its component parts.

1.2.1 First postulate – Statics

Postulate 1. Associated to any physical system is a complex inner product space known as the state space of the system. The system is completely described at any given point in time by its state vector, which is a unit vector in its state space.

What is the importance of the first postulate from the quantum computing point of view? The answer is that quantum mechanics offers us a straightforward generalisation of the classical binary digit (bit). The classical bit is a two-state system with controlled transitions between them. As an example, we can use an electrical switch that can exist in one of the two discrete, stable states ("on" and "off"). Although electrical switches may seem an odd physical realisation of bits in the age of transistors, they illustrate an important point about computation in general: it is substrate independent. Exactly the same computational results can be obtained using electrical relays and CMOS transistors.

The quantum mechanical version of a bit, called a quantum binary digit (qubit), is a quantum mechanical two-state system. The first postulate of quantum mechanics tells us that the state of such a system can be represented mathematically by a unit vector in the two-dimensional complex vector space. This also means that such a system can exist in a superposition of basis states. Indeed, any vector |v⟩ in the two-dimensional complex vector space,

 ⌊ ⌋ α |v⟩ = ⌈ ⌉ , β

can be represented as a linear combination of the standard basis vectors:

⌊ ⌋ ⌊ ⌋ ⌊ ⌋ ⌈ α⌉ ⌈1⌉ ⌈0⌉ β = α 0 + β 1 , |v⟩ = α |0⟩ + β |1⟩.

Since the state vector is a unit vector, the coefficients α and β must satisfy

|α|2 + |β|2 = 1.

The coefficients α and β are probability amplitudes. Even though a qubit can exist in a superposition of basis states, once measured (see Postulate 3), its state collapses to one of the basis states: |α|2 and |β|2 give us the probability of finding the qubit, respectively, in states |0⟩ and |1⟩ after measurement.

One can draw an analogy with how the space of natural numbers, , can be extended to the space of real numbers, , and then to the space of complex numbers, . We have a much wider range of functions that can operate on and take values in and than in . Similarly, allowing the two-state system to exist in a superposition of states significantly extends the range of possible operators that can transform such states (i.e., perform computation).

For example, there is no Boolean function f that, when applied twice to a classical bit, would result in a NOT gate: f(f(0)) = 1 and f(f(1)) = 0. But there is such an operator in quantum computing. We can easily verify by direct calculations that the matrix

 ⌊ ⌋ 1 + i 1 − i M := 1-⌈ ⌉ , 2 1 − i 1 + i

applied twice to the basis vector |0⟩ would transform it to the basis vector |1⟩, and applied twice to the basis vector |1⟩ would transform it to the basis vector |0⟩. M is an example of a quantum logic gate – an operator that transforms the state of a qubit, thus implementing the computation.

Remark: The state space of a physical system can be infinite-dimensional. The quantum computing paradigm based on infinite-dimensional Hilbert spaces is called continuous-variable quantum computing, which is realised in, e.g., some photonic quantum computing systems. However, in the context of digital quantum computing, we will restrict our analysis to finite-dimensional state spaces.

The state of a qubit (the fundamental memory unit of quantum computing that generalises the concept of a classical bit) can be described mathematically as a unit vector in the two-dimensional complex vector space. Any physical system whose state space can be described by 2 can serve as an implementation of a qubit.

1.2.2 Second postulate – Dynamics

Postulate 2. The time evolution of a closed quantum system is described by the Schrödinger equation

iℏd-|ψ-(t)⟩ = ℋ |ψ(t)⟩, dt

where is Planck’s constant and is a time-independent Hermitian operator known as the Hamiltonian of the system.

The Hamiltonian of a quantum system is an operator corresponding to the total energy of that system, and its eigenvalues are the possible energy levels of the system. The knowledge of the Hamiltonian provides all the necessary information about system dynamics.

In the Schrödinger equation (1.2.2), the state |ψ(t1)⟩ of a closed quantum system at time t1 is related to the state |ψ (t2)⟩ at time t2 by a unitary operator 𝒰(t1,t2) that depends only on t1 and t2 via

|ψ(t2)⟩ = 𝒰 (t1,t2) |ψ(t1)⟩ ,

where 𝒰(t1,t2) is obtained from the Hamiltonian as

 ( ) iℋ-(t2-−-t1) 𝒰 (t1,t2) = exp − ℏ .

Unitary operators preserve the inner product (and therefore norms, lengths, and distances), which means that for two vectors |u⟩ and |v⟩, if 𝒰 is a unitary operator, then the inner product between 𝒰|u⟩ and 𝒰|v⟩ is the same as the inner product between |u⟩ and |v⟩:

 † ⟨u|𝒰 𝒰 |v⟩ = ⟨u|v⟩ .

A unitary operator is a complex generalisation of a rotation: unitary operators take an orthonormal basis to another orthonormal basis, and any operator with this property is unitary. In quantum mechanics, physical transformations such as rotations, translations and time evolution correspond to maps that take quantum states to other quantum states. These maps should be linear and preserve the inner product. This allows us to look at the unitary operators as the quantum logic gates implementing quantum computation protocols. Furthermore, unitary operators are invertible, a key property that ensures that quantum computing is reversible.

Quantum logic gates (quantum counterparts of the Boolean logic gates in classical computing) are unitary operators that transform quantum states, thus implementing the computation.

1.2.3 Third postulate – Measurement

Given a Hermitian operator 𝒜, the spectral theorem implies that the state |ψ⟩ of a system can be written as a superposition

 ∑N |ψ⟩ = αi |ψi⟩ , i=1

where the coefficients (αi)i=1,…,N are complex probability amplitudes, assumed to be normalised with i=1N|αi|2 = 1, and where (|ψi⟩)i=1,…,N are eigenfunctions of 𝒜. The measurement postulate then reads as follows:

Postulate 3. If we measure the Hermitian operator 𝒜 in the state |ψ⟩ given in (1.2.3), the possible outcomes for the measurement are the eigenvalues (λi)i=1,…,N of 𝒜, and the probability pi to measure λi is given by pi = |αi|2. After the outcome λi, the state of the system becomes

|ψ⟩ = |ψi⟩.

An immediate measurement in the same computational basis will deliver the same result without any uncertainty.

The quantum measurements are described by measurement operators (𝒫i)i=1,…,N, acting on the state space of the system with N possible outcomes. If the state of the system is |ψ⟩ before the measurement, then the probability of outcome i is

ℙ(i) = ⟨ψ |𝒫 †i𝒫i |ψ ⟩.

The measurement operators should also satisfy the completeness condition

∑N 𝒫 †i𝒫i = ℐ, i=1

where is the identity operator. This ensures that the sum of the probabilities of all outcomes adds up to 1.

These measurement operators are linear but not unitary. From the quantum computing perspective, we are interested in measurement operators that are projections (Definition 2) onto the computational basis, such as the standard orthonormal basis given by (1.1.9).

For example, the measurement operators for a single qubit can be defined as

 ⌊ ⌋ ⌊ ⌋ 1 0 0 0 𝒫0 := |0⟩⟨0| = ⌈ ⌉ and 𝒫1 := |1⟩⟨1| = ⌈ ⌉ . 0 0 0 1

We can easily verify that 𝒫02 = 𝒫0 and 𝒫12 = 𝒫1, as should be the case for projection operators, and that the completeness condition (1.2.3) is satisfied. If the qubit is in state |ψ⟩ = α|0⟩ + β|1⟩, then the measurement operator 𝒫0 will give us |0⟩ with probability |α|2, and the measurement operator 𝒫1 will give us |1⟩ with probability |β|2. Indeed,

𝒫0|ψ ⟩ = |0⟩0|(α|0⟩ + β|1⟩) = α|0⟩0||0⟩ + β|0⟩0||1⟩ = α|0⟩,
𝒫1|ψ ⟩ = |1⟩1|(α|0⟩ + β|1⟩) = α|1⟩1||0⟩ + β|1⟩1||1⟩ = β|1⟩.

The measurement postulate of quantum mechanics states that an immediate measurement in the same computational basis will deliver the same result without any uncertainty. The key words here are "the same computational basis". What would happen if the subsequent measurement is performed in another basis (the basis specified by another set of linearly independent unit vectors from the state space)? For example, assume that the qubit is in state

 1 1 |ψ⟩ = √---|0⟩ + √---|1⟩. 2 2

Measuring |ψ⟩ in {|0⟩,|1⟩} computational basis will result in observing states |0⟩ and |1⟩ with equal probability 12. Let us assume that we measured |0⟩. The qubit state is now

 ′⟩ |ψ = 1 ⋅ |0⟩+ 0 ⋅ |1⟩.

If we repeat the measurement in the same {|0⟩,|1⟩} computational basis, we obtain state |0⟩ with probability 1 in accordance with the measurement postulate. However, had we measured state |ψ′⟩ in the Hadamard basis {|+ ⟩,|− ⟩}, given by

|+ ⟩ := √1-(|0⟩+ |1⟩) and |− ⟩ := 1√--(|0⟩ − |1⟩), 2 2

we would have equal probabilities of |+⟩ and |− ⟩ outcomes. Let us assume that we measured |− ⟩ and the state of the qubit is now

 ′′⟩ |ψ = 0 ⋅ |+ ⟩+ 1 ⋅ |− ⟩ .

If we repeat the measurement of state |ψ ′′⟩ in the Hadamard basis {|+⟩,|− ⟩}, we obtain state |− ⟩ with probability 1. But the state of the qubit is an equal superposition of states |0 ⟩ and |1⟩ from the {|0⟩,|1⟩} computational basis perspective and we have an equal chance of measuring either |0⟩ or |1⟩ in this basis.

Remark: The basis vectors |0⟩ and |1⟩ that form the standard computational basis can be transformed into the basis vectors |+⟩ and |− ⟩ that form the Hadamard basis by applying the following unitary operator (rotation), called the Hadamard gate:

 ⌊ ⌋ -1-⌈1 1 ⌉ H = √2-- 1 − 1 .

Chapters 6, 10 and 11 provide examples of applications of the Hadamard gate.

The measurement plays a crucial role in quantum computing. This is the process of collapsing a quantum state and reading out the classical information: measuring qubits encoding a quantum state will produce a classical bit string. The measurement process generates probabilistic outcomes. Therefore, we need to perform measurements on the same quantum state multiple times to generate a sufficiently large number of classical bit strings to produce reliable statistics.

The process of measurement describes the collapse of the quantum state due to contact with the environment. After measurement, the states of the qubits are known without any uncertainty. It is possible to extract at most 1 bit of information from a qubit. In order to extract more information about the probability distribution encoded in a given quantum state, it is necessary to perform measurement of the same state multiple times.

1.2.4 Fourth postulate – Observable

Postulate 4. For every measurable property of a physical system, there exists a corresponding Hermitian operator. The values of the physical observables correspond to the expectation values of Hermitian operators. The expectation value ⟨𝒜 ⟩ of the Hermitian operator 𝒜 in the normalised state |ψ ⟩ is given by

⟨𝒜 ⟩ := ⟨ψ|𝒜 |ψ⟩.

Let us consider the general case where the expectation value of a Hermitian operator 𝒜 is calculated in state |ψ ⟩, which is not an eigenfunction of 𝒜. By the Spectral Theorem 3 (see also (1.2.3)), the state |ψ ⟩ of a system can be represented as the superposition

 N ∑ |ψ⟩ = αi |ψi⟩ , i=1

where (|ψi⟩)i=1,…,N are the eigenfunctions of 𝒜 and (αi)i=1,…,N the corresponding probability amplitudes.

Therefore, the expectation value of 𝒜 in state |ψ⟩, given in (1.2.4), is calculated as

 ∑N ∑N N∑ ∑N ⟨𝒜⟩ = α∗iαj ⟨ψi|𝒜 |ψj⟩ = α ∗iαjλj ⟨ψi|ψj⟩, i=1j=1 i=1 j=1

where (λi)i=1,…,N are the eigenvalues of 𝒜. The only terms that survive in the expression for ⟨𝒜 ⟩ are those with i = j due to the orthogonality of the eigenfunctions, so that

 N N ∑ ∗ ∑ 2 ⟨𝒜 ⟩ = α iαiλi = |αi| λi. i=1 i=1

Therefore, the value of the observable is a weighted average of the eigenvalues of the corresponding Hermitian operator. The weights are the coefficients (|αi|2)i=1,…,N, which are the probabilities of measuring the corresponding eigenstate of 𝒜.

Hermitian operators play an exceptionally important role in quantum mechanics since their expectation values correspond to physical observables.

1.2.5 Fifth postulate – Composite System

Postulate 5. The state space of a composite physical system is the tensor product of the state spaces of the individual component physical systems.

If the first component physical system is in state |ψA ⟩ and the second component physical system is in state |ψB⟩, then the state of the combined system, |ψ⟩, is given by the tensor product

|ψ⟩ = |ψA⟩ ⊗ |ψB⟩ .

Not all states of a combined system can be separated into the tensor product of states of individual components. If the state of a system cannot be separated into component parts, we say that the component parts are entangled.

The entanglement of quantum systems is one of the major sources of computational power of quantum computing. It allows us to store exponentially more information in the correlations between the states of individual subsystems (in the limit – individual qubits) than directly in the states of individual subsystems.

To illustrate this point, we can look at the number of probability amplitudes needed to describe the state of an n-qubit system. An individual qubit can be found in one of the two possible states after measurement – one of the two basis states, |0⟩ or |1⟩. This means that we need to specify two probability amplitudes to fully describe the state of the qubit before measurement. If all our qubits are independent and the state of the system can be represented as a tensor product of individual qubit states,

|ψ⟩ = |ψ1 ⟩⊗ |ψ2⟩⊗ ...⊗ |ψn ⟩,

then we need to specify 2n probability amplitudes (two for each individual quantum states) to describe the state |ψ ⟩ of the system. If, however, all individual qubits are entangled and the tensor product representation of the system state |ψ ⟩ does not exist, we need to specify 2n probability amplitudes – this is an effective measure of useful information that can be stored in the system.

The power of quantum computing is derived from the principles of superposition and entanglement. Entanglement allows us to store most of the information in correlations between the qubit states.