Skip to content
Current section
The Quantum Computing Enthusiast’s Hub
Saved
All sections

All sections

Saved
Skip Learn navigation
Encyclopedia
Topic

Quantum discrete logarithm algorithm

A quantum method for recovering an exponent in a finite group by finding a hidden algebraic relation.

Edition released Coverage: Overview · Technical
On this page

Definition, purpose and input assumptions

Given a generator g and an element h=g^x in a suitable finite cyclic group, the discrete-logarithm problem asks for x. Quantum algorithms expose a relation between two exponents through coherent group arithmetic and Fourier sampling. This is a different computational task from factoring, although both appear in Shor's foundational work.

Mathematical mechanism

For a group of order r, define f(a,b)=g^a h^b=g^(a+xb), with a,b taken modulo r. The hidden kernel satisfies a+xb=0 modulo r. Fourier samples of the associated coset states yield linear relations involving x. If a sampled coefficient is not invertible modulo r, additional samples or modular reasoning are needed.

Fully solved reference example

Work modulo 7 with generator g=3, whose order is 6, and h=2. Since3^2=2 modulo 7, the answer is x=2. The function is f(a,b)=3^(a+2b) modulo 7. The kernel contains (4,1), because4+2=0 modulo 6, and its multiples.

A compatible Fourier label (u,v) obeys4u+v=0 modulo 6, equivalently v=2u modulo 6. If u=1,v=2 is sampled, the relation gives x=2 directly. If u=2,v=4 is sampled, division by 2 modulo 6 is not unique; x=2 and 5 both satisfy2x=4, so another relation is necessary.

Limitations and classical comparison

The arithmetic interface and group representation determine circuit cost. Small modular examples are classically easy. Security implications differ among integer-factorization, finite-field and elliptic-curve systems, and realistic resource estimates must identify the exact group and key parameters.

Scientific relationships

Discrete-logarithm algorithms are instances of hidden subgroup reasoning and use quantum Fourier sampling. They are distinct from the order-to-gcd reduction in Shor factoring.

A discrete logarithm recovered without an invertible sample

Work in the multiplicative group modulo eleven. The element g=2 has order ten, with powers 1,2,4,8,5,10,9,7,3,6 for exponents zero through nine. Let h=7. The logarithm is x=7 modulo ten, but the algorithm treats that exponent as unknown. Define f(a,b)=2^a7^b modulo eleven on Z10×Z10. Since h=2^x, equal function values are determined by a+xb modulo ten.

For x=7, the hidden kernel is generated by (3,1), because 3+7=0 modulo ten. A Fourier label (u,v) compatible with this kernel satisfies 3u+v≡0 modulo ten, or v≡7u modulo ten. Suppose the first observed relation is (u,v)=(2,4). It gives 2x≡4 modulo ten, whose solutions are x=2 and x=7. Division by two modulo ten is not defined, but dividing the whole congruence by its common divisor gives x≡2 modulo five.

Suppose a second sample is (5,5). Its equation 5x≡5 modulo ten requires x to be odd. Intersecting that condition with {2,7} leaves x=7 uniquely. Neither sampled coefficient is invertible modulo ten, yet their information is sufficient together. Verifying 2^7=128≡7 modulo eleven confirms the reconstructed candidate against h.

General modular processing of a relation

For ux≡v modulo r, let d=gcd(u,r). A solution exists only if d divides v. When it does, divide by d to obtain (u/d)x≡v/d modulo r/d. The coefficient u/d is invertible modulo r/d, so the equation determines one residue class modulo r/d. It leaves d possible classes modulo r. Multiple samples can be combined by intersecting these congruence classes, with consistency checked on common divisors.

The trivial sample u=v=0 supplies no information. An inconsistent equation can indicate a finite-precision Fourier-sampling issue, noise, or a violated input assumption, depending on the actual implementation. It should not be forced into a solution by an invalid modular division. The exact finite-group example here assumes ideal Fourier transforms and an exact group representation, so every displayed relation is consistent.

Candidate verification is useful even when the reconstruction procedure is probabilistic. It evaluates g^x and checks equality with h using classical group arithmetic. A valid equality proves that the reported x is a logarithm in the stated subgroup; it does not reveal how much quantum or classical work was needed to obtain it. If the order is not known or the generator promise differs, verification must be interpreted with those conditions in mind.

Coherent arithmetic behind the function oracle

For four-bit representations of a and b, repeated squaring gives controlled multipliers for g with constants 2,4,5,3, corresponding to exponents 1,2,4,8. For h the constants are 7,5,3,9. Applying the appropriate multipliers to a group register initialized to the identity evaluates the two powers and their product. This description contains eight controlled modular-multiplication opportunities, even though an abstract query model may call the entire function evaluation one oracle use.

The arithmetic must have a reversible extension on every binary basis state, including labels not representing valid group elements or exponent values. Preserving a valid subspace is a useful promise, but it does not permit a nonunitary map on the remaining basis states. Workspace for multiplication and modular reduction must be cleaned if the group register is later uncomputed or used within a controlled inverse operation.

The exact domain has one hundred exponent pairs. Two four-qubit exponent registers contain 256 binary labels, so uniform preparation over the valid ten-by-ten domain and the transforms F10⊗F10 need explicit implementations. Power-of-two Fourier registers can be used in broader formulations, but then approximate frequency recovery and its success analysis replace the exact congruence picture. The mathematical distinction should remain visible in resource estimates.

Subgroup promises and a concrete classical baseline

If g were four instead of two, its order would be five. For h=5, the relation 4^2=5 holds, and exponents two and seven are indistinguishable modulo ten because the logarithm is defined only modulo five. Claiming a unique answer modulo ten would use the wrong group order. If h=2 with generator four, no logarithm exists in that subgroup; indeed 2^5=10 modulo eleven rather than one, so h fails the order-five membership condition.

For the original ten-element group, a classical baby-step giant-step calculation is already tiny. Store g^j for j=0,1,2,3, obtaining 1,2,4,8. Since g^{-4}=9 modulo eleven, multiply h successively by nine. The first product is 7·9=8 modulo eleven, matching j=3 at giant-step index one. Therefore x=4·1+3=7. This gives a concrete classical reconstruction and emphasizes that the small example demonstrates the quantum relation method rather than a measured advantage.

Sources