QuantumAtlas

Quantum Algorithms Database

Quantum Counterfeit Coin Detection

A quantum algorithm for identifying counterfeit (different-weight) coins among genuine ones using a weighing-based query model, faster than the best classical strategies.

Year

2010 (conference); 2012 (journal)

Inventor(s)

Kazuo Iwama, Harumichi Nishimura, Rudy Raymond, and Junichi Teruyama

Speedup Type

Polynomial Speedup

Difficulty

★★★☆☆

Overview

The counterfeit coin problem is a classic puzzle: you have N coins, k of them are fake and lighter than the rest, and you have a balance scale that tells you only whether two groups of coins weigh the same or not. How many weighings do you need to find all the fake coins? Classically, any strategy needs on the order of k times the logarithm of N over k weighings, because each weighing returns about one bit and there are that many bits of information to learn.

Iwama, Nishimura, Raymond, and Teruyama showed that if the scale can be used in quantum superposition, the number of weighings drops to about the fourth root of k, which does not depend on N at all. That is a quartic speedup in k, one of the cleanest examples of a quantum advantage in a puzzle that anyone can understand.

The problem it solves

Given a set of coins where some unknown subset are counterfeit (heavier or lighter), identify the counterfeit coins using the fewest possible weighings.

History and background

The classical problem belongs to a family called combinatorial group testing, which has been studied since the 1940s for tasks such as screening blood samples, finding defective products, and compressed sensing. The classical query complexity of Theta of k log(N/k) follows from a simple information-theoretic argument and a binary-search style algorithm.

The quantum version was introduced by Iwama and coauthors at the International Symposium on Algorithms and Computation in 2010, and a full paper appeared in Theoretical Computer Science in 2012. Their key observation was that a balance query can be turned into a parity-type oracle, so that the Bernstein-Vazirani algorithm and amplitude amplification apply. Later, Ambainis and Montanaro, and then others, studied related problems such as quantum algorithms for learning juntas and for exact-half functions, and found the same fourth-root scaling there. Nobody has yet proved a matching lower bound for the general case, though evidence suggests the bound is tight.

How it works

Uses a quantum query model analogous to Grover-style amplitude amplification, encoding weighing outcomes into a quantum state to narrow down counterfeit coins faster than classical weighing strategies.

Consider the simplest case, a single fake coin. In the quantum balance model, a query takes two disjoint sets of coins of equal size, S and T, and returns 0 if they contain the same number of fake coins and 1 otherwise. If you put a random half of the coins on one pan and the rest on the other, the answer depends on the parity of the number of fakes that landed on each side. That is exactly the kind of information that the Bernstein-Vazirani algorithm extracts all at once.

Imagine representing a weighing as an n-bit string saying which coins are placed on which pan. The quantum algorithm queries the balance in superposition over all such strings. Interference then singles out the string that marks the fake coins in a few steps, in the same way Bernstein-Vazirani finds a hidden string with one query instead of n.

For several fake coins, the parity trick works only when the number of fake coins on a pan is odd, which happens with a constant probability. The algorithm uses amplitude amplification to boost that success probability, and each amplification round costs about the fourth root of k queries. That is where the k to the one quarter comes from.

Step by step

  1. Model the balance as a quantum oracle: for two disjoint, equal-sized subsets S and T of coins, it returns 0 if both contain the same number of fake coins and 1 otherwise.
  2. Reduce the problem to a parity-detection problem, so that a single well-chosen query in superposition reveals information about which coins are fake, in the style of the Bernstein-Vazirani algorithm.
  3. Run a quantum subroutine that finds the fake coins with a small, constant success probability by preparing a superposition over weighings and measuring after the interference step.
  4. Use amplitude amplification to raise the success probability close to 1, which multiplies the cost by about the fourth root of k.
  5. Verify the candidate set with a Check procedure that confirms the candidate fake coins exactly, again using balance queries.
  6. Return the list of the k fake coins, or repeat the procedure if verification fails.

A worked example

Suppose there are N = 1,000,000 coins and k = 16 are fake. A classical strategy needs on the order of k times log of N over k weighings, which is roughly 16 times 16, or 250 weighings, since each weighing gives at most one bit of information and about 250 bits are needed to name the 16 fake coins.

The quantum algorithm needs on the order of 16 to the power one quarter, which is 2, multiplied by constants. Even with a larger constant, the number of queries stays small, and it would not grow at all if N were increased to a billion coins. In practice, the constants matter, and the algorithm uses quantum superpositions of weighings, which a physical balance cannot do, so it is a statement about query complexity rather than about real scales.

Complexity and resources

ItemDetail
Quantum queriesO(k to the one quarter), independent of N, for k less than N over 2
Classical queriesOmega of k log(N over k)
Lower boundOmega of k to the one quarter for algorithms with certain structural properties; a general matching bound is open
SpeedupQuartic in k
Oracle modelBalance oracle that returns whether two equal-sized subsets contain the same number of fake coins

What hardware it needs

  • A quantum oracle that implements the balance in superposition, which is not available for physical weighing.
  • Enough qubits to represent a superposition over weighings, about N qubits for the coin assignment register.
  • Coherent execution of Bernstein-Vazirani-style circuits and amplitude amplification.

Applications

  • A theoretical illustration of quantum speedups in combinatorial group testing.
  • Inspiration for quantum algorithms for learning sparse functions, such as juntas, and for testing properties of Boolean functions.
  • Teaching quantum query complexity with an intuitive puzzle.

Limitations and caveats

  • The speedup is for the number of oracle queries, and the oracle must be quantum, which a physical scale is not.
  • The model assumes the number k of counterfeit coins is known in advance.
  • There is no proven matching lower bound for the general case.

Common misconceptions

  • It does not mean that a quantum computer can weigh coins faster in a real shop. It is a statement about an abstract oracle.
  • It is not a quadratic speedup in the Grover sense. The improvement is a fourth root in k and removes the dependence on N.

How it compares

  • Bernstein-Vazirani solves the single hidden string case with one query, and the counterfeit coin algorithm extends the idea to many fake coins.
  • Grover's algorithm searches for marked items with a square-root speedup in N, while this algorithm removes N from the dependence entirely.
  • Classical group testing needs k log(N/k) tests, so it scales with the logarithm of N.

Real-world impact

Primarily of theoretical interest in quantum query complexity research, illustrating how classic combinatorial puzzles can sometimes be reformulated to benefit from quantum speedups.

Why it matters

This problem shows that quantum speedups are not limited to algebraic problems like factoring. A familiar puzzle can have a provable quantum advantage, and the technique of reducing a combinatorial question to a parity question is a recurring pattern.

It is also a good example of the difference between query complexity and real speed. The advantage is real in the oracle model, but whether it can be realized depends on whether the oracle can be built, which is a lesson for all query-based speedups.

Frequently asked questions

What is the quantum counterfeit coin problem?

Finding k fake coins among N using a balance scale that can be queried in quantum superposition, with the goal of minimizing the number of queries.

How much faster is the quantum algorithm?

Quartically in k: it needs about the fourth root of k queries, versus about k log(N over k) classically, and the quantum count does not depend on N.

Which quantum techniques does it use?

A reduction to the Bernstein-Vazirani parity problem, combined with amplitude amplification.

Is the result proven optimal?

Not in full generality. The authors show a matching lower bound only for algorithms with certain properties, so the tightness is supported by evidence rather than proof.

Can this be done with real coins?

No. The algorithm requires a balance oracle that works on superpositions of weighings, which is a theoretical construct.

Keep learning

This page is written for educational purposes. Complexity statements describe the best known results at the time of review (September 30, 2026), and research in this area moves quickly, so check recent papers before relying on a specific bound.

← Back to Algorithms Database