Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 58 1 a Solution Created 2026-10-03 Updated 2026-10-07
The PDF's small superscript is essential: . Interpret as the least positive period, the multiplicative order of modulo . If one permitted an unspecified nonminimal period, the answer would not be identifiable; for example, gives the same constant function with period one or period eight. Under the promised periodic modular-exponential interpretation, , so is a unit. ThusIn particular, different residue classes modulo have different function values, which is necessary for the usual quantum period finding coset argument.
Prepare by applying the quantum Fourier transform to the first register. Use repeated squaring to precompute , then multiply the value register by that known number controlled on bit of . These controlled modular multiplications are reversible because is a unit; their inverses use the modular inverses of the same constants. This produces with a polynomial number of the assumed arithmetic operations. Known work registers can be uncomputed.
Measure the value register. Since , its fiber is exactly one coset, and the first register becomesThe quantum Fourier transform of a periodic coset state is supported uniformly on the outcomes , . Indeed the inner geometric series is zero unless , and each allowed amplitude has modulus .
Take two independent Fourier samples and returnThis is two-sample exact period recovery. The Chinese remainder theorem makes divisibility of independent uniform residues independent across the different prime divisors of . For each such prime , both and are divisible by with probability . ThereforeThe number-theoretic facts used here are the Chinese remainder theorem, the Euler product for the Riemann zeta function at two, and . The candidate can also be certified by : it divides the least period, so this equality holds exactly when it is the full period. Each preparation, reversible evaluation, QFT, measurement and greatest common divisor calculation has the assumed or standard polynomial time cost in . Two runs suffice for the desired constant success probability. Quantum period finding recovers the least period with probability at least in polynomial time.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 58 1 b Solution Created 2026-10-03 Updated 2026-10-07
Use the quantum Fourier transform convention , where . Reindexing the shifted sum givesThus the cyclic shift operator has these eigenvectors, with eigenvalues . This is cyclic shift diagonalization by the quantum Fourier transform, and it implies with .
For , the binary encoding is , with the more significant qubit. The required diagonal phase isso . The allowed-gate circuit is thereforeIn execution order, apply the inverse QFT, then the two phase gates, then the forward QFT. There is no extra global phase. Reversing the Fourier sign convention would conjugate both phase gate parameters.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 61 1 a Solution Created 2026-10-03 Updated 2026-10-06
Use the positive-sign quantum Fourier transformOrthogonality of the finite-group characters makes a unitary operator. Here is the least positive period. The injectivity within one period implies : write , . Periodicity gives , and injectivity forces . Put .
Start with two available computational basis states . Apply to the first register and query the modular-addition quantum oracle:Measure the second register. For some , the first register becomes the normalized coset stateThe quantum Fourier transform of a periodic coset state isIndeed, the inner geometric sum vanishes unless the Fourier label is a multiple of . Measuring that label gives for a uniformly random . Compute, by the Euclidean algorithm,Thus exact period recovery from a Fourier sample succeeds whenever is coprime to , andHere is the Euler totient function. The classical number-theory input is the totient lower bound from the Mertens product: for sufficiently large , for an absolute , with the finitely many small cases handled separately. For recovery is certain; for its probability is . The useful asymptotic probability statement is a lower bound, hence notation; it can be much larger for particular periods, for example a prime period.
There is one oracle query, two Fourier transforms and two measurements. The final greatest common divisor and division use polynomial time in . This meets the specified primitive-operation model without assuming that an arbitrary- Fourier gate is free in another gate model. If a constant success probability is wanted, repeat independently times and return the least common multiple of the candidates: each candidate divides , and one successful sample makes that least common multiple exactly .
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 61 3 i Solution Created 2026-10-03 Updated 2026-10-06
Let and use an -qubit phase register. Begin with and apply to the phase register, creating . Controlled powers implementFor phase qubit , counted from the most significant bit, the controlled power is . It can be built from calls to the supplied controlled- gate. By quantum phase kickback, the phase-register state isApply the inverse quantum Fourier transform to obtain the exact quantum phase estimation mappingA computational basis measurement of the first register determines with certainty, hence and the eigenvalue . Exactness follows from the promised dyadic phase; no approximation or continued-fraction reconstruction is needed.
With only controlled- available as a query, the repeated-power construction uses oracle calls. The other Fourier-transform circuitry has polynomial size in in the ideal phase-gate model. The cost of exact phase estimation on a dyadic spectrum is therefore not polynomial in in this primitive-query model unless powered queries have additional implementations. The task does not require such a polynomial bound.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 324 1 iii Solution Created 2026-10-03 Updated 2026-10-06
Here the true multiplicative order is four, and it divides every power-of-two Fourier-register size , including the choice from part (ii). A second-register measurement produces one of the four periodic cosetsIts quantum Fourier transform has nonzero amplitudes only at , and each has squared modulus . The inverse transform only changes phases or permutes these four labels. Hence the measured ratios are equally likely.
For or , continued-fraction recovery in quantum order finding returns denominator four. Part (i) then gives factors three and five. For , the reduced denominator is two. Although two is not a period, the candidate-denominator gcd post-processing in part (ii) still gives a factor:The zero outcome produces no useful even candidate and the run fails. For the factor-extraction procedure specified above, three of the four outcomes succeed:There is an important convention behind this answer. A version that rejects a candidate unless before attempting any gcd rejects , since . Under that validated-period convention only the two odd-numerator phases succeed, givingThus the probability of recovering the true multiplicative order is , whereas the probability of finding a factor with direct gcd post-processing is . The printed question does not specify this classical post-processing detail; stating it avoids identifying these two different events.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 324 1 ii Solution Created 2026-10-03 Updated 2026-10-06
Let . In the Shor algorithm, first use classical arithmetic to deal with even and perfect powers, and to reject prime inputs. Perfect-power recognition and primality testing have polynomial-time classical algorithms. Factoring a perfect power , with , already gives a nontrivial factor . We may therefore consider an odd composite with at least two distinct prime factors.
Choose uniformly from and compute its greatest common divisor with using the Euclidean algorithm. A proper nontrivial divisor ends the computation. Otherwise is a unit, and the remaining task is quantum order finding. SetPrepare a uniform quantum superposition in a -qubit register and use quantum modular exponentiation in a second register to obtainRepeated squaring and reversible modular multiplication implement this step with polynomially many quantum gates in . Apply the inverse quantum Fourier transform to the first register and perform a quantum measurement in the computational basis, obtaining . Measuring the second register first, and Fourier-transforming the resulting periodic coset, gives the same distribution of .
Here is a quantitative quantum Fourier sampling bound for order finding. If , multiplication by cycles its orbit states. The Fourier eigenstates of that cycle have eigenvalues , and the initial state has squared overlap with each, for . ThereforeConditioned on a particular eigenphase , its nearest integer outcome obeys and has probability at least . Indeed the absolute amplitude is , where . For , the numerator is at least and the denominator at most ; the limiting value at is one.
If , the fraction is reduced, and givesUse continued-fraction recovery in quantum order finding. The relevant approximation theorem says that reduced fractions satisfying are continued fraction convergents of . For an input rational of digits, their candidates can be enumerated classically in time, and their denominators are at most the reduced input denominator. This is the supplied continued-fraction result; discard candidate denominators exceeding . A zero measurement is treated as a failed order-finding sample.
For each remaining even candidate denominator , compute by repeated squaring, and try and . Return only a divisor with ; otherwise repeat the quantum sample or choose another . This candidate-denominator gcd post-processing cannot return an incorrect factor, since its output is checked directly. When the recovered denominator is the true even multiplicative order and the square root of one is nontrivial, part (i) guarantees success. Checking before trying the gcds is also a valid, more restrictive convention; the single-run distinction matters in part (iii).
Two further standard quantitative facts explain why repetitions remain efficient. First, for a uniformly chosen unit modulo an odd integer with at least two distinct prime divisors, the probability of a useful unit in Shor factorization is at least : its true multiplicative order is even and . To see the source of this bound, the Chinese remainder theorem for unit groups makes the prime-power components independent. Each odd-prime-power unit group is cyclic. If its 2-primary order is , the probability of the largest possible value of is , and the probability of any specified smaller value is at most . Failure requires all components to have the same : either all zero, making odd, or all the same positive value, making the halfway power in every component. Conditioning on one component, the chance another component matches it is at most , so total failure is at most .
Second, the fraction of phase numerators coprime to is , where is the Euler totient function. The elementary totient-ratio lower bound suffices: if the distinct prime divisors are , then and . The totient product formula therefore givesThus for a good , the probability of sampling a coprime phase numerator with the required accuracy is at least . This is inverse-polynomial in the input length, so polynomially many repetitions achieve any fixed success probability. The quantum Fourier transform uses elementary rotations and Hadamard gates in the ideal gate description, and the other quantum and classical stages are polynomial in .
The reduction is therefore polynomial in the bit length:A small denominator need not itself be the true multiplicative order; verification of the final factor is essential, and no guarantee is claimed for every individual sample.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 324 1 a Solution Created 2026-10-03 Updated 2026-10-06
Use the positive-exponent quantum Fourier transform convention . The period of a function here is the least positive translation leaving the function unchanged on the cyclic group . The injective promise means exactly when . In particular : the subgroup of period translations is generated by , and wrapping the argument by preserves its value. This is exact quantum period finding on a finite cyclic group, rather than the truncated, nondividing-period version requiring continued fractions.
Prepare a uniform superposition state in the first quantum register using , and perform a reversible computation of the function into a second quantum register, cleaning its workspace by uncomputation:A quantum measurement in the computational basis of the second quantum register leaves a periodic coset state in the first:For the quantum Fourier transform of this periodic coset state, the finite geometric series vanishes unless the measured label is . On those labels its normalized amplitude is . Thus has the uniform distribution on a finite set on , irrespective of .
Compute the greatest common divisor by the Euclidean algorithm, and set , with . Since ,The exact period recovery from a Fourier sample is therefore certified by testing . Every candidate divides and lies between and , so the injective promise makes that equality equivalent to . This includes , where the test uses input , and , which always succeeds. The test does not assert that an arbitrary equality of function values certifies an arbitrary period; the Fourier-derived divisor restriction is essential.
The concise result isHere is the Euler totient function, with . The totient lower bound from the Mertens product gives for . Each trial uses polynomial time quantum Fourier transforms, function evaluations and Euclidean algorithm arithmetic in . Repeating independent trials gives constant success probability; the herald accepts only correct answers.
The printed asymptotic bound has the wrong direction for this argument. In Big O notation, the stated upper bound on the number of coprime integers supplies no success lower bound and is itself false uniformly: for prime , , not . Likewise the single-trial success need not be , since it tends to one for prime. The meaningful corrected guarantee is the lower bound above. If an upper-bounded success rate is literally required, one may deliberately retain an accepted result with an independent probability proportional to ; this discards useful successes and is unnecessary for efficient recovery.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 324 1 b iii Solution Created 2026-10-03 Updated 2026-10-06
Apply the same positive-exponent quantum Fourier transform to each of the two quantum registers. The amplitude at of the coset state isThe finite geometric series is when and zero otherwise. ThereforeThere are allowed pairs, with following the uniform distribution on a finite set. The factor changes the probability amplitudes by phases depending on the output label , but has no effect on their probabilities. Using an inverse rather than forward quantum Fourier transform on both quantum registers gives the same support relation.
A modular inverse of exists precisely when . In that case the discrete logarithm isIt cannot generally be determined from every allowed pair. Put . The supported linear congruence has solutions modulo , and determines only modulo ; gives no information when . For instance and are compatible with both and . One may verify a candidate by modular exponentiation, checking . Repeated discrete-logarithm Fourier sampling finds an invertible with per-trial probability , which has the same totient lower bound from the Mertens product as before. When , the group is trivial and are determined without Fourier samples.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 324 3 a Solution Created 2026-10-03 Updated 2026-10-06
Use exact quantum phase estimation with control qubits initially and one target quantum register prepared in the given eigenvector . Apply Hadamard gates to the control qubits. If control bit has significance , apply a controlled unitary gate from that qubit to the target. The target stays in , while quantum phase kickback producesSince , this is . The inverse quantum Fourier transform on the control quantum register therefore gives . The quantum measurement in the computational basis returns with certainty, soThe quantum circuit below reads left to right. The upper wires are control qubits, with least significant; the vertical ellipsis represents the intervening control wires and powers. The inverse quantum Fourier transform acts on the entire control quantum register, including any bit-order permutations.
Quantum phase estimation and spectral filtering
. A supplied controlled- can implement controlled- by repetitions with the same control. Hence this exact quantum circuit uses calls to the supplied controlled-, unless controlled powers are additionally available cheaply. The cost of exact phase estimation on a dyadic spectrum is not automatically polynomial in ; the question asks for an exact algorithm, not that stronger complexity guarantee. Exactness also uses the promised dyadic eigenphase, ideal gates, and the supplied inverse quantum Fourier transform.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 324 3 b ii Solution Created 2026-10-03 Updated 2026-10-06
Apply to the data and phase quantum registers, leaving the flag quantum ancilla untouched. This inverse needs no extra oracle assumption: the promised dyadic eigenvalues give , hence . The inverse of each controlled unitary gate used in can therefore be built from repeated uses of the supplied controlled-, and the known Hadamard gates and quantum Fourier transform gates can be reversed. Uncomputation is necessary to erase the eigenvalue label coherently. The resulting quantum state isA quantum measurement in the computational basis of the flag followed by postselection on one yieldsThis requires . For a normalized input and nonnegative eigenvalues, the success probability of positive quantum spectral filtering satisfies . In the general inequality, equality holds precisely when the input is supported on the minimum-eigenvalue eigenspace. Omitting uncomputation and discarding the phase quantum register would instead leave a mixed state with diagonal weights proportional to , rather than the desired coherent pure state.
The printed universal nonzero-success request needs a nonkernel-input hypothesis. An -qubit Hermitian operator has eigenvalues, counted with multiplicity. All are distinct, and the printed dyadic grid contains exactly possible values. They therefore occupy the entire grid, including zero: this is a multiplicity-free complete dyadic spectrum, and . Taking , , and satisfies every printed spectral promise but gives . No normalized output vector exists, so no algorithm can deliver it with nonzero probability.
For every input outside the kernel, the procedure above has , giving the requested strict bound on the meaningful domain. The corrected result is therefore exact quantum spectral filtering conditional on , with the boxed probability. This does not require knowing the input probability amplitudes or making extra copies of an unknown quantum state. Arbitrarily small nonzero support outside the kernel gives arbitrarily small success probability, and a failed flag measurement disturbs the input; fresh independent trials cannot be assumed when only one unknown physical input is supplied.
Past exam of the mathematics course of the University of Cambridge 2019 iii Paper 324 1 a ii Solution Created 2026-10-03 Updated 2026-10-05
Write the finite abelian group additively. Its group shift operator isThese unitary operators form the regular representation and commute. The representation-theoretic facts we use are that every irreducible representation of a finite abelian group is one-dimensional, there are such characters of a representation, and their character orthogonality gives an orthonormal basis of functions on . Each linear character here is a group homomorphism , with .
For , the character group of a finite abelian group, putChanging variables to givesThe vectors are therefore a common eigenbasis. Using instead of its complex conjugate in their definition reverses every eigenphase; this is merely the quantum Fourier transform sign convention.
Past exam of the mathematics course of the University of Cambridge 2019 iii Paper 324 1 b Solution Created 2026-10-03 Updated 2026-10-05
The distinct values in one period imply that is the least positive period, , and . Write , where and . Use the positive-exponent quantum Fourier transform convention already used in the concept article. The amplitude of first-register value isBy the root-of-unity filter, the inner sum vanishes unless . DefineThe distinct give an orthonormal basis of the second register, and the transformed state isReindexing modulo showsConsequently measurement in this common eigenbasis returns each with probability ; the corresponding eigenvalue of is a uniformly sampled th root of unity. A single measured phase reveals the denominator , which need not be . Repeated samples permit exact period recovery from a Fourier sample, for example by taking the least common multiple of their reduced denominators. The simultaneous eigenspaces and their probabilities depend on , not on the particular labels .
Past exam of the mathematics course of the University of Cambridge 2019 iii Paper 324 4 a ii Solution Created 2026-10-03 Updated 2026-10-05
Write the normalized input as , where and . Use a data register, an -qubit eigenvalue register, and a flag quantum ancilla. Begin with .
Apply exact quantum phase estimation to . Its controlled evolutions and inverse quantum Fourier transform produceApply the HHL controlled reciprocal rotation, with :The function of is computed by quantum arithmetic; the rotation is a quantum variable rotation. On a zero eigenvalue label with no input amplitude, define any unitary action, for example no rotation.
Run the inverse phase-estimation circuit. Because each amplitude multiplier depends only on , the eigenvalue register is reset to on both flag branches. Measuring the flag and conditioning on outcome one leavesThe successful unnormalized branch is , giving the probability in the preceding part. The operations independent of are the Hadamard gates preparing the phase register, the inverse quantum Fourier transform, the reversible reciprocal/angle arithmetic, the controlled fixed-angle rotations, and the final flag measurement. Uncomputation removes all arithmetic workspace; the -dependent controlled evolutions and the -dependent state-preparation circuit supply the input-specific operations.
