Lecture Notes on Quantum Algorithms and Protocols

Author

Your Name

Published

February 5, 2025

Introduction

This lecture covers advanced quantum algorithms and protocols, focusing on Shor’s algorithm for integer factorization, Grover’s algorithm for quantum search, and the BB84 protocol for quantum key distribution. The main objective is to understand the principles behind these algorithms and protocols, their quantum mechanical foundations, and their implications for computation and communication security.

Shor’s Algorithm for Integer Factorization

Problem Statement: Integer Factorization

The goal of integer factorization is to decompose a composite integer \(n\) into its prime factors. We assume that \(n\) is a composite number, having already ruled out the case where \(n\) is prime using efficient classical primality tests. We also assume that \(n\) is not a perfect power (\(n \neq a^b\) for integers \(a > 1, b > 1\)), as these cases are efficiently solvable classically. While the prime factorization of \(n\) can be represented as \(n = p_1^{e_1} p_2^{e_2} \cdots p_k^{e_k}\), where \(p_i\) are prime numbers, the algorithm’s explanation in this context focuses on finding non-trivial factors without explicitly requiring this full prime factorization form initially.

Order Finding and its Relevance

Shor’s algorithm leverages the order-finding problem. For given integers \(x\) and \(n\), where \(n\) is composite and \(\text{gcd}(x, n) = 1\), the order \(r\) of \(x\) modulo \(n\) is the smallest positive integer such that \(x^r \equiv 1 \pmod{n}\). This is equivalent to saying that \(x^r - 1\) is an integer multiple of \(n\): \[x^r - 1 \equiv 0 \pmod{n}\] \[x^r - 1 = k \cdot n, \quad k \in \mathbb{Z}\] A crucial requirement for Shor’s algorithm to proceed successfully is that the order \(r\) must be an even number. If \(r\) is odd, this path of the algorithm fails, and a different random \(x\) must be chosen.

Failure Cases in Shor’s Algorithm

Shor’s algorithm, in this simplified explanation, has two primary failure conditions that necessitate restarting the algorithm with a different randomly chosen value of \(x\):

  1. Odd Order r: If the computed order \(r\) of \(x\) modulo \(n\) is found to be odd, the algorithm cannot proceed with the current \(x\). In this scenario, the algorithm iteration fails, and one must return to the step of randomly selecting \(x\).

  2. Trivial GCD Result: Even when the order \(r\) is even, a further check is required. We compute the greatest common divisor of \((x^{r/2} + 1)\) and \(n\). If \(\text{gcd}(x^{r/2} + 1, n) = n\), it implies that \(x^{r/2} + 1\) is a multiple of \(n\), and thus, all prime factors of \(n\) are contained within \(x^{r/2} + 1\) in a way that does not directly yield a factorization through this method. In this case, the algorithm also fails for this choice of \(x\), and a new random \(x\) must be selected.

If neither of these failure conditions is met, it is likely that the prime factors of \(n\) are distributed between the values \(\text{gcd}(x^{r/2} - 1, n)\) and \(\text{gcd}(x^{r/2} + 1, n)\), allowing for factorization.

Factor Extraction

When Shor’s algorithm avoids the failure conditions, we can proceed to extract factors of \(n\). We compute: \[m = \text{gcd}(x^{r/2} - 1, n)\] \[m' = \text{gcd}(x^{r/2} + 1, n)\] The values \(m\) and \(m'\) are likely to be non-trivial factors of \(n\). If these factors are non-trivial (i.e., \(1 < m < n\) and \(1 < m' < n\)), we have successfully reduced the problem of factoring \(n\) to factoring potentially smaller numbers \(m\) and \(m'\). If \(m\) or \(m'\) is still composite, the factorization process can be applied recursively.

A critical quantum subroutine within Shor’s algorithm, not detailed here, is the efficient quantum computation of the order \(r\) using the Quantum Fourier Transform (QFT). The QFT enables the order-finding to be performed exponentially faster than known classical algorithms. This quantum speedup in order finding is the core reason why Shor’s algorithm provides an exponential advantage for factorization over the best-known classical algorithms. The transcript notes that the technical details of QFT and its application to order-finding are skipped in this lecture, but it is essential to recognize its central role and the fact that it is not efficiently computable classically.

It is important to note that Shor’s algorithm is a probabilistic algorithm with a bounded probability of error. While there are failure cases as described, the probability of encountering these failures can be controlled and reduced to an arbitrarily small value by repeating the algorithm with different random choices of \(x\). For Shor’s algorithm to be considered a bounded-error quantum polynomial time (BQP) algorithm, the probability of failure must be strictly less than one-half, which is achievable through repetition and probabilistic analysis of the algorithm’s success rate.

Quantum Key Distribution: BB84 Protocol

Introduction to Quantum Key Distribution

Quantum Key Distribution (QKD) protocols, such as BB84, provide a method for two parties, Alice and Bob, to establish a shared secret key using quantum mechanics. This key can then be used with classical encryption algorithms for secure communication over a classical channel. A primary advantage of QKD is its ability to detect the presence of any eavesdropper, such as Eve, attempting to intercept the key exchange.

BB84 Protocol and Non-Orthogonal States

The BB84 protocol’s security is rooted in the fundamental principles of quantum mechanics, specifically the properties of non-orthogonal quantum states and the disturbance caused by quantum measurement. The protocol utilizes two pairs of conjugate bases:

  • Rectilinear Basis (Z-basis): \(\{\left|{0}\right\rangle, \left|{1}\right\rangle\}\)

  • Diagonal Basis (X-basis): \(\{\left|{+}\right\rangle = \frac{1}{\sqrt{2}}(\left|{0}\right\rangle + \left|{1}\right\rangle), \left|{-}\right\rangle = \frac{1}{\sqrt{2}}(\left|{0}\right\rangle - \left|{1}\right\rangle)\}\)

States within the same basis are orthogonal and can be perfectly distinguished when measured in that basis. However, states from different bases are non-orthogonal. For example, \(\left|{+}\right\rangle\) is not orthogonal to either \(\left|{0}\right\rangle\) or \(\left|{1}\right\rangle\). Measuring a state prepared in one basis using the other basis leads to probabilistic outcomes, fundamentally limiting the ability to gain information without causing disturbance. Specifically, measuring \(\left|{+}\right\rangle\) in the Z-basis yields \(\left|{0}\right\rangle\) or \(\left|{1}\right\rangle\) with equal probability (50

BB84 Protocol Steps

The BB84 protocol proceeds through the following steps to establish a secret key:

  1. Alice’s Qubit Transmission: For each bit she wants to send, Alice performs these actions:

  2. Bob’s Measurement: For each qubit received from Alice, Bob independently:

    1. Basis Choice: Bob randomly chooses a measurement basis \(b'_i \in \{0, 1\}\) (Z-basis or X-basis).

    2. Measurement: Bob measures the received qubit in the chosen basis \(b'_i\), obtaining a measurement outcome \(a'_i \in \{0, 1\}\).

  3. Basis Reconciliation (Sifting): Alice and Bob communicate over a public classical channel to perform basis sifting:

    1. Basis Announcement: Bob publicly announces the sequence of bases \(b'_i\) he used for each measurement.

    2. Basis Revelation: Alice publicly reveals the sequence of bases \(b_i\) she used for encoding.

    3. Key Sifting: Alice and Bob keep only the bits for which they used the same basis (\(b_i = b'_i\)). They discard the bits where their bases differed (\(b_i \neq b'_i\)). The retained bits form the raw key.

    If no eavesdropping occurred, for the bits where they used the same basis, Bob’s measurement outcome \(a'_i\) should ideally be equal to Alice’s original bit \(a_i\).

Eavesdropping Detection and Security

The security of BB84 lies in the possibility of detecting eavesdropping. If Eve attempts to intercept the qubits transmitted by Alice, she must perform a measurement to gain information. However, Eve does not know which basis Alice used to encode each qubit.

If Eve guesses the basis correctly, she can measure the qubit in the correct basis and resend a copy to Bob without introducing errors. However, if Eve guesses incorrectly, she will inevitably disturb the quantum state due to the measurement postulate. When Bob subsequently measures in the correct basis (matching Alice’s original basis), this disturbance can introduce errors in Bob’s measurement outcomes compared to Alice’s original bits.

Probability of Eavesdropping Detection

Consider the scenario where Alice and Bob use the same basis for a particular bit (which occurs with probability 1/2). If Eve intercepts this qubit and chooses to measure in the wrong basis (which happens with probability 1/2 for Eve’s random guess), her measurement will introduce a disturbance. When Bob measures in the correct basis, there is a 50

Therefore, even with a simple intercept-resend strategy, Eve has a significant probability of introducing detectable errors. By publicly comparing a subset of the sifted key bits, Alice and Bob can estimate the Quantum Bit Error Rate (QBER). If the QBER is below a certain threshold, they can assume the channel is reasonably secure and proceed with error correction and privacy amplification to distill a secure secret key. A higher QBER would indicate likely eavesdropping, and they would discard the key and restart the protocol.

In a simplified analysis, if Eve randomly guesses the basis for each intercepted qubit, and Alice and Bob happen to use the same basis, the probability that Eve’s incorrect basis choice introduces a detectable error is 1/4 (probability of same basis * probability of Eve’s wrong guess * probability of error given wrong guess measurement = 1/2 * 1/2 * 1/2, but simplified to 1/4 in transcript discussion, likely considering error introduction when bases mismatch). This error rate allows Alice and Bob to detect Eve’s presence with a quantifiable probability.

Any attempt by Eve to eavesdrop and gain information about the transmitted qubits will introduce detectable errors in the key exchange due to the principles of quantum measurement and the properties of non-orthogonal states. This allows Alice and Bob to detect eavesdropping and ensure the security of their key.

Conclusion

This lecture has provided an introduction to three pivotal topics in quantum computing: Shor’s algorithm for integer factorization, Grover’s algorithm for unstructured search, and the BB84 protocol for quantum key distribution. These examples illustrate the potential of quantum mechanics to revolutionize computation and communication security.

Key Takeaways:

  • Shor’s Algorithm: Achieves exponential speedup over classical algorithms for integer factorization by employing the Quantum Fourier Transform to solve the order-finding problem. The algorithm is probabilistic and has specific failure conditions related to the order of chosen elements and GCD results.

  • Grover’s Algorithm: Offers a quadratic speedup for unstructured search problems through amplitude amplification. This technique uses iterative applications of oracle and inversion-about-average reflections. Optimal performance is achieved with approximately \(\sqrt{N}\) iterations, and over-iteration can reduce the probability of success.

  • BB84 Protocol: Demonstrates a practical application of quantum mechanics for secure communication by enabling the distribution of cryptographic keys with security guaranteed by the principles of quantum mechanics, particularly the measurement disturbance of non-orthogonal states. Eavesdropping attempts introduce detectable errors, ensuring a mechanism for security verification.

Further Exploration:

The subsequent lectures will delve deeper into related quantum cryptographic protocols and explore advanced topics in quantum algorithm design and their potential applications in various computational domains.