A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Deutsch-Jozsa Algorithm

Graduate Depth 158 in the knowledge graph I know this Set as goal
3topics build on this
957prerequisites beneath it
See this on the map →
Quantum CircuitsQuantum Measurement and the Born RuleBernstein-Vazirani Algorithm
Deutsch-Jozsa oracle quantum-speedup quantum-parallelism

Core Idea

The Deutsch-Jozsa algorithm determines whether a Boolean function f:{0,1}^n -> {0,1} is constant (same output for all inputs) or balanced (outputs 0 for exactly half the inputs and 1 for the other half), promised that one of these holds. A classical deterministic algorithm requires 2n-1 + 1 queries in the worst case, but the quantum algorithm uses exactly one query to the function oracle. It was the first algorithm to demonstrate a provable exponential separation between quantum and classical deterministic query complexity, establishing that quantum computers can solve certain problems fundamentally faster.

Explainer

The Deutsch-Jozsa algorithm is historically important as the first quantum algorithm to demonstrate an exponential separation from classical computation, even though the problem it solves is artificial. You are given a black-box function f:{0,1}^n -> {0,1} with the promise that f is either constant (all outputs are the same) or balanced (exactly half the outputs are 0 and half are 1). Classically, in the worst case, you must evaluate f on 2n-1 + 1 inputs to be certain — you might get unlucky and see the same output for the first 2n-1 queries. The quantum algorithm uses one query.

The circuit works as follows. Prepare n input qubits in |0> and one ancilla qubit in |1>. Apply Hadamard to all n+1 qubits. The input register is now in a uniform superposition over all 2n basis states, and the ancilla is in |-> = (|0> - |1>)/sqrt(2). Apply the oracle Uf, which maps |x>|y> to |x>|y xor f(x)>. Because the ancilla is in |-> , the effect of the oracle is phase kickback: the ancilla stays in |-> and each input state |x> acquires a phase (-1)^f(x). The state is now (1/sqrt(2n)) * sum_x (-1)^f(x) |x> tensor |-> .

Now apply Hadamard to each input qubit. The Hadamard transform maps the state to a sum over all output basis states, where the amplitude of each output state |y> is a sum involving (-1)^f(x) * (-1)x dot y over all x. The amplitude of |0...0> specifically is (1/2n) * sum_x (-1)^f(x). If f is constant, this sum is +/- 1, so the probability of measuring |0...0> is 1. If f is balanced, exactly 2n-1 terms are +1 and 2n-1 are -1, so the sum is zero and the probability of measuring |0...0> is 0. A single measurement therefore determines the answer with certainty.

The key mechanism is interference. The oracle embeds the function's behavior into phases, and the final Hadamard transform recombines these phases. For a constant function, all paths interfere constructively at |0...0>. For a balanced function, they interfere destructively and the amplitude at |0...0> vanishes completely. This pattern — oracle encodes information into phases, followed by interference that concentrates the answer — recurs throughout quantum algorithms. The Deutsch-Jozsa algorithm is the simplest instance of this paradigm. It is worth noting that a probabilistic classical algorithm can solve this problem with O(1) random queries and high confidence, so the exponential advantage is specifically over deterministic classical algorithms. The deeper significance is conceptual: it proves that quantum query complexity can be strictly less than classical.

Practice Questions 3 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersDividing IntegersUnit RatesProportionsPercent ConceptConverting Between Fractions, Decimals, and PercentsOperations with Rational NumbersTwo-Step EquationsSolving Multi-Step EquationsEquations with Variables on Both SidesAngle Pairs: Complementary, Supplementary, and VerticalParallel Lines and TransversalsCorresponding AnglesAlternate Interior AnglesTriangle Angle Sum TheoremExterior Angle TheoremTriangle Inequality TheoremSimilar Triangles: AA SimilaritySimilar Triangles: SSS and SAS SimilarityProportions in Similar TrianglesRight Triangle Trigonometry IntroductionSine, Cosine, and Tangent RatiosTrigonometric Ratios ReviewRadian MeasureConverting Between Degrees and RadiansThe Unit CircleGraphing Sine and CosineGraphing Tangent and Reciprocal Trigonometric FunctionsDerivatives of Trigonometric FunctionsAntiderivativesIndefinite IntegralsBasic Integration RulesRiemann SumsDefinite Integral DefinitionDouble Integrals: Definition and SetupIterated Integrals and Fubini's TheoremDouble Integrals over Rectangular RegionsDouble Integrals over General RegionsApplications of Double Integrals: Area, Mass, and MomentsTriple Integrals in Cartesian CoordinatesTriple Integrals in Cylindrical and Spherical CoordinatesChange of Variables and the Jacobian DeterminantApplications of Triple Integrals: Volume and MassVector Fields and Their RepresentationsLine Integrals of Vector FieldsWork and CirculationLine Integrals of Scalar and Vector FunctionsFundamental Theorem for Line IntegralsConservative Vector FieldsConservative Vector Fields and Potential FunctionsCurl and Divergence of Vector FieldsCurl and DivergenceDivergence TheoremElectric Flux and Divergence TheoremGauss's Law: Integral Form and MeaningSolving Problems with Gauss's LawConductors in Electrostatic EquilibriumCapacitance and CapacitorsDielectricsDielectric Constant and Relative PermittivityElectric Field Inside Dielectric MaterialsDielectric Materials and PolarizationDielectric Susceptibility and PermittivityEnergy Density in Electric FieldsElectric Current and Current DensityElectrical Resistance and ResistivityOhm's Law and Circuit ElementsElectromotive Force (EMF) and BatteriesKirchhoff's Circuit Laws: Voltage and CurrentDC Circuit Network Analysis MethodsTransient Response in RC CircuitsRC CircuitsLC and RLC CircuitsAC Circuits: FundamentalsImpedance and ReactanceAC Power and ResonanceElectromagnetic WavesPostulates of Special RelativityTime DilationLength ContractionLorentz TransformationRelativistic Velocity AdditionRelativistic Momentum and EnergyMass-Energy Equivalence and E=mc²Photons as Particles with Energy and MomentumPlanck-Einstein Relation: Energy and FrequencyPhotoelectric EffectThe Photon: Light as QuantaCompton ScatteringWave-Particle Dualityde Broglie WavelengthThe Schrödinger EquationState Vectors and WavefunctionsQuantum SuperpositionQuantum EntanglementBell Theorem and Bell InequalitiesPostulates of Quantum MechanicsObservables and Quantum OperatorsCommutators and Commutation RelationsQuantum Angular MomentumQuantum Mechanical Treatment of HydrogenSolving the Schrödinger Equation for Hydrogen AtomQuantum NumbersSpin-1/2 SystemsPauli MatricesQuantum GatesQuantum CircuitsDeutsch-Jozsa Algorithm

Longest path: 159 steps · 957 total prerequisite topics

Prerequisites (2)

Leads To (1)