Education / Quantum Computing

Quantum Computing · Chapter 03

Probability Amplitudes and Interference

Presentation slides 25 slides · Fullscreen presentation or print to PDF

In Chapter 2, we built reversible circuits that compute Boolean functions without losing information. In every step we have considered so far, each configuration has a single, definite next configuration. Not all transitions work this way: a step may allow several next configurations, or choose among them with probabilities.

We first compare deterministic, nondeterministic, and probabilistic transitions. We then see why probabilities cannot describe every physical transition, leading to probability amplitudes and interference.

How can two steps that each look random combine into a certain result?

Suppose a bit starts at 0 and a step replaces it with the result of a fair coin flip, giving 0 or 1 with probability 1/2 each. Repeating that randomizing step a second time still leaves 0 and 1 equally likely.

In a quantum process, however, a single step on a bit initialized to \(0\) can produce \(0\) or \(1\) with probability \(1/2\) each, yet applying that exact same step a second time returns the bit to \(0\) with certainty. To understand how two such steps can undo each other's randomness, we begin by examining how single-step transitions are described and combined.

In this chapter · 4 sections · 15 topics
  1. 3.1 States and Transitions
    Topics in this section
    1. 3.1.1 States
    2. 3.1.2 Transitions
    3. 3.1.3 Deterministic transitions
    4. 3.1.4 Nondeterministic transitions
    5. 3.1.5 Probabilistic transitions
  2. 3.2 Sum and Product Rules
    Topics in this section
    1. 3.2.1 The product rule along a path
    2. 3.2.2 The sum rule across paths
    3. 3.2.3 States and steps
  3. 3.3 Signed Weights
    Topics in this section
    1. 3.3.1 Negative weights
    2. 3.3.2 Cancellation across paths
    3. 3.3.3 The Hadamard step
  4. 3.4 Complex Amplitudes and Interference
    Topics in this section
    1. 3.4.1 Complex weights
    2. 3.4.2 Conservation of probability
    3. 3.4.3 Interference and phase
    4. 3.4.4 Path information
Reading guide · preparation, aims, and assumptions

Understand why probabilities alone do not describe interference, and learn to calculate with amplitudes.

Before you begin

Recall that a computation is a run of configurations, and that a reversible gate can be undone.

What you should be able to do

The example to follow

The same bit, updated twice, runs through the whole chapter. Its quantum version, two Hadamard steps, returns in Deutsch’s algorithm.

Scope and assumptions

The Born rule and unitary evolution are physical postulates. The examples motivate them; they do not derive quantum mechanics from classical probability. The next chapter explains the state after measurement.

3.1

States and Transitions

Before we can see where quantum transitions depart from classical ones, we need a common way to describe deterministic, nondeterministic, and probabilistic steps. We first introduce a notation for what is known about a register at a given moment—its state—and for how a step updates the register—a transition.

3.1.1 States§

configurationstateweightdefinite

Consider a register holding a single bit. Its possible distinguishable contents, \(0\) and \(1\), are its configurations (and for a \(k\)-bit register, the configurations are the \(2^k\) bit strings of length \(k\)). Whenever we inspect the register, we find it in exactly one configuration.

Before we inspect it, however, what do we know about the register at a given moment? We may have set the bit ourselves to \(0\), so that its configuration is known with certainty. We may know only that an unspecified choice occurred, leaving both \(0\) and \(1\) as live possibilities without saying how often either occurs. Or the bit may have been set by flipping a fair coin, so that \(0\) and \(1\) each carry probability \(1/2\). Whatever model we use, this complete specification of what is known about the register at a given time is its state.

All three kinds of knowledge take the exact same mathematical form: they assign a number \(v_j\)—called a weight—to each configuration \(j\). To keep each weight visibly paired with the configuration it describes, we write configuration \(j\) inside an angled bracket as \(\ket j\), read “ket \(j\),” and express the state as a weighted sum of these kets:

\[v_0\ket0+v_1\ket1.\]

At this stage, a ket sum is simply clean bookkeeping: each term \(v_j\ket j\) pairs configuration \(j\) with its weight \(v_j\). Terms for distinct configurations remain separate, while two terms for the same configuration combine by adding their weights, as in \(\tfrac14\ket0+\tfrac14\ket0=\tfrac12\ket0\).

What we know\(v_0\)\(v_1\)State
The bit is \(0\)\(1\)\(0\)\(\ket0\)
Either value is possible\(1\)\(1\)\(\ket0+\ket1\)
A fair coin set the bit\(1/2\)\(1/2\)\(\tfrac12\ket0+\tfrac12\ket1\)

Although the notation \(v_0\ket0+v_1\ket1\) looks the same in every row, the weights mean different things depending on the setting. In a possibility description, a weight of \(1\) or \(0\) simply records whether a configuration can occur; in a probability description, the weights are nonnegative numbers adding to \(1\) that record how frequently each configuration occurs. In any setting, a state that assigns weight \(1\) to one configuration and \(0\) to all others is called definite, and we write it simply as that configuration’s ket, such as \(\ket0\).

A state of one bitEach configuration carries a weight. The state is the pair of weights v₀ and v₁. A state of one bit01v₀v₁
Each configuration carries a weight. The state is the pair of weights \(v_0\) and \(v_1\).
Problems
  1. A two-bit register has configurations \(00,01,10,11\). Write the weights of its state when (a) the register is known to hold \(10\); (b) the first bit is known to be \(1\) and the second could be either; (c) both bits were set by independent fair coins.

    Show solutionHide solution

    (a) \(v_{10}=1\) and the other three weights are \(0\). (b) \(v_{10}=v_{11}=1\), and \(v_{00}=v_{01}=0\): these weights record which configurations are possible. (c) Each configuration has probability \(\tfrac12\cdot\tfrac12=\tfrac14\), so all four weights are \(1/4\).

  2. Someone describes a bit by the weights \(v_0=v_1=1\). Can these weights be probabilities? What do they say about the bit, and what do they leave unsaid? Give two different probability states that are consistent with them.

    Show solutionHide solution

    Probabilities of the two configurations must add to \(1\), and these add to \(2\), so they are not probabilities. They record that both values are possible and nothing more: they say nothing about how often each occurs. The states with \(v_0=v_1=1/2\) and with \(v_0=1/10\), \(v_1=9/10\) are both consistent with them, as is any pair of positive probabilities adding to \(1\).

  3. A register has \(k\) bits. A possibility state gives each configuration weight \(0\) or \(1\), with at least one weight \(1\). How many possibility states are there? How many probability states are there? Which probability states are consistent with the possibility state in which every configuration is possible?

    Show solutionHide solution

    There are \(2^k\) configurations, and a possibility state is fixed by the set of configurations with weight \(1\). Any nonempty set will do, so there are \(2^{2^k}-1\) possibility states. Probability states are infinitely many: any nonnegative weights adding to \(1\) give one, and they vary continuously. A probability state is consistent with “every configuration is possible” exactly when every one of its weights is positive. The possibility state keeps only which weights are nonzero.

3.1.2 Transitions§

transition rulestate diagramweightruntime-expanded diagrampath

A computation changes the contents of a register step by step. A transition rule specifies which configurations may follow each current configuration in a single step. As a simple example, take the one-bit NOT operation, which flips \(0\) to \(1\) and \(1\) to \(0\).

We can picture any transition rule as a state diagram: we draw a circle for each configuration and an arrow \(i\to j\) whenever the rule allows configuration \(j\) to follow configuration \(i\). Each arrow carries a numerical weight. For a step named \(S\), we write the weight of the arrow from initial configuration \(i\) to final configuration \(j\) as

\[\bra jS\ket i,\]

with the final configuration on the left, the step in the middle, and the initial configuration on the right. We read this symbol from right to left, in the order the action happens: start in configuration \(i\), apply the step \(S\), and arrive at configuration \(j\). An arrow that is absent from the state diagram has weight \(0\). Writing \(X\) for the NOT operation, the two bit-flipping arrows carry weight one, \(\bra1X\ket0=\bra0X\ket1=1\), while the absent self-arrows carry weight zero, \(\bra0X\ket0=\bra1X\ket1=0\).

Applying a transition rule repeatedly generates a run \(c_0,c_1,c_2,\dots\), where \(c_t\) is the configuration after \(t\) steps; starting from \(c_0=0\), two steps of NOT produce the run \(0,1,0\). To visualize multi-step runs without arrows looping back over the same circles, we draw a time-expanded diagram: we copy the column of configurations once for each time \(t=0,1,2,\dots\) and connect consecutive columns using the arrows of the rule. Because every arrow moves forward from one time column to the next, a time-expanded diagram never contains a cycle, and a run of \(t\) steps appears simply as a directed path from time \(0\) to time \(t\).

Transition rules differ in how many arrows leave each configuration and in what their numerical weights represent. Those two differences separate the deterministic, nondeterministic, and probabilistic models that follow.

Deterministic transitions: NOT applied twiceThe state diagram of NOT has one arrow from 0 to 1 and one from 1 to 0, each with weight 1. In the time-expanded diagram over two steps from 0, there is a single path, 0 to 1 to 0.State diagram0111Time-expanded diagram from 0t=0t=1t=211010101weight 1weight 0One arrow leaves each configuration, so the run has exactly one path.
NOT: state diagram (left) and time-expanded diagram from \(0\) (right). The only path is \(0\to1\to0\).
Problems
  1. A rule on the configurations \(0,1,2\) sends \(0\to1\), \(1\to2\), and \(2\to0\). Draw its state diagram and write the run from \(0\) for four steps.

    Show solutionHide solution

    The diagram has three circles and the arrows \(0\to1\), \(1\to2\), \(2\to0\), each with weight \(1\). The run from \(0\) is \(0,1,2,0,1\): the configuration returns to \(0\) every three steps.

  2. For the same rule, draw the time-expanded diagram for the times \(t=0,1,2\). How many arrows does it contain, and which path is the run from \(2\)?

    Show solutionHide solution

    Each of the two steps, from \(t=0\) to \(1\) and from \(t=1\) to \(2\), repeats the three arrows of the rule, so the diagram has \(6\) arrows. The run from \(2\) is \(2,0,1\), the path from \(2\) at time \(0\) to \(0\) at time \(1\) to \(1\) at time \(2\).

  3. A rule on \(m\) configurations has \(a\) arrows in its state diagram. How many arrows does its time-expanded diagram have for the times \(0,1,\dots,t\)? Show that the runs of \(t\) steps are exactly the paths from time \(0\) to time \(t\), and explain why the time-expanded diagram never contains a cycle, even when the state diagram does.

    Show solutionHide solution

    Each of the \(t\) steps repeats the \(a\) arrows, so there are \(ta\) arrows. A run \(c_0,\dots,c_t\) uses an allowed arrow \(c_s\to c_{s+1}\) at every step, which is exactly an arrow from \(c_s\) at time \(s\) to \(c_{s+1}\) at time \(s+1\); conversely, a path from time \(0\) to time \(t\) visits one configuration at each time, joined by allowed arrows, which is a run. Every arrow of the time-expanded diagram goes from time \(s\) to time \(s+1\), so no path can return to an earlier time: a cycle of the state diagram, such as RESET’s arrow \(0\to0\), becomes a chain of arrows moving forward in time.

3.1.3 Deterministic transitions§

deterministicreversible

To see how arrow structure captures reversibility, compare the one-bit NOT operation with RESET, which writes \(0\) regardless of what the bit currently holds:

ConfigurationNext under NOTNext under RESET
\(0\)\(1\)\(0\)
\(1\)\(0\)\(0\)

Starting from \(0\), two steps of NOT produce the run \(0,1,0\), whereas two steps of RESET produce \(0,0,0\). Under both rules, exactly one arrow leaves each configuration: for each starting configuration \(i\), a single successor \(j\) has weight \(\bra jS\ket i=1\) and all other outgoing weights are \(0\). Because there is no branching in the forward direction, the starting configuration determines the entire future run uniquely. Any rule with this property is deterministic: across any number of configurations and time steps, a definite initial configuration traces a single unbranched path to a unique final configuration, and the register remains in a definite state at every step.

Generic deterministic transitions across multiple states and stepsA four-configuration, four-step time-expanded diagram starting from configuration 1 at t=0. Because exactly one arrow leaves each configuration at each step, the run follows a single unbranched path 1 to 0 to 2 to 3 to 2.Multi-state, multi-step deterministic run: a single path from start to finisht=0t=1t=2t=3t=40123start0123012301230123weight 0weight 0weight 1weight 0Exactly one arrow leaves each state at every step, tracing a single path 1 → 0 → 2 → 3 → 2.
Across multiple configurations and steps, a deterministic transition rule admits a single path from the initial configuration to the final configuration.

Can we also trace a run backward in time? Forward determinism counts outgoing arrows; backward recovery counts incoming arrows. Under NOT, each configuration has exactly one incoming arrow, so knowing the present configuration always identifies the previous configuration uniquely. Under RESET, by contrast, two arrows enter \(0\) (from both \(0\) and \(1\)) and none enters \(1\), so a run that arrives at \(0\) has lost all record of which bit it started from. A deterministic rule in which every configuration also has exactly one incoming arrow is reversible.

RESET merges two configurationsRESET sends both configurations to 0. A run that reaches 0 does not record where it started, so RESET is deterministic but not reversible. 0 → 0; 1 → 0.RESET merges two configurationsRESET0101
RESET sends both configurations to \(0\). A run that reaches \(0\) does not record where it started, so RESET is deterministic but not reversible.
Problems
  1. On two bits, the rule SWAP exchanges the bits: \(01\to10\) and \(10\to01\), while \(00\) and \(11\) stay as they are. Write the two-step run from \(01\). Is SWAP deterministic? Is it reversible?

    Show solutionHide solution

    The run is \(01,10,01\). Exactly one arrow leaves each configuration, so SWAP is deterministic. Exactly one arrow also enters each configuration: \(00\) from \(00\), \(01\) from \(10\), \(10\) from \(01\), and \(11\) from \(11\). So SWAP is reversible; in fact, applying it twice restores every configuration, so it is its own inverse.

  2. On the configurations \(0,1,2,3\), the rule INC adds \(1\) modulo \(4\), and the rule HALVE replaces \(n\) by \(\lfloor n/2\rfloor\), the integer part of \(n/2\). Draw both state diagrams, write the two-step runs from \(3\), and decide which rule is reversible.

    Show solutionHide solution

    INC has the arrows \(0\to1\to2\to3\to0\), so the run from \(3\) is \(3,0,1\). HALVE has the arrows \(0\to0\), \(1\to0\), \(2\to1\), and \(3\to1\), so the run from \(3\) is \(3,1,0\). Both are deterministic. INC is reversible: each configuration has exactly one incoming arrow, and subtracting \(1\) undoes it. HALVE is not: two arrows enter \(0\) and two enter \(1\), while none enters \(2\) or \(3\). From the end \(0\) of a run we cannot tell whether it started at \(0\), \(1\), \(2\), or \(3\).

  3. Prove that a deterministic rule on finitely many configurations is reversible exactly when every configuration has at least one incoming arrow. Then show that the statement fails for the rule \(n\mapsto\lfloor n/2\rfloor\) on all nonnegative integers.

    Show solutionHide solution

    Suppose there are \(N\) configurations. A deterministic rule has exactly one outgoing arrow at each, so \(N\) arrows in total, and these \(N\) arrows enter the \(N\) configurations. If every configuration receives at least one, none can receive two, since that would require more than \(N\) arrows. So each receives exactly one, and the rule is reversible. Conversely, a reversible rule gives every configuration exactly one incoming arrow, hence at least one. For \(n\mapsto\lfloor n/2\rfloor\) on all nonnegative integers, every \(n\) has an incoming arrow, from \(2n\); yet \(2n\) and \(2n+1\) both go to \(n\), so the rule is not reversible. The counting argument needs finitely many configurations.

3.1.4 Nondeterministic transitions§

nondeterministicreachable

A nondeterministic transition rule relaxes the requirement of a unique successor: a configuration may have several permitted outgoing arrows, so specifying the present configuration no longer singles out one inevitable future. Instead, the rule defines a set of permitted runs branching forward in time.

On a single bit, consider the rule KEEP-OR-FLIP, under which either \(0\) or \(1\) is permitted to follow either configuration. Its state diagram contains all four arrows (\(0\to0\), \(0\to1\), \(1\to0\), and \(1\to1\)). Starting from \(0\) at time \(0\), two steps admit four distinct paths in the time-expanded diagram:

\[0\to0\to0,\qquad0\to1\to0,\qquad0\to0\to1,\qquad0\to1\to1.\]

A multi-step path is possible when every transition along it is permitted by the rule, and a configuration is reachable at time \(t\) when at least one possible path from the start ends there. Under KEEP-OR-FLIP, both \(0\) and \(1\) are reachable after two steps. In a general multi-state, multi-step run, paths branch and reconverge across successive steps, and the reachable configurations at time \(t\) are simply those arrived at by at least one permitted path. In nondeterministic models of computation, acceptance is defined by the same existential test: an input is accepted if at least one permitted run reaches an accepting configuration.

Crucially, nondeterminism is a statement about logical possibility, not a physical mechanism for choosing randomly among paths. Even when an asymmetric rule admits more paths to one endpoint than to another, having more paths does not make that endpoint “more likely”—both endpoints are simply reachable. Counting possible paths and assigning outcome probabilities are distinct tasks; to predict how often each outcome occurs, we must attach quantitative probabilities to the arrows.

Nondeterministic transitions: keep or flip, applied twiceThe keep-or-flip rule allows all four arrows. In the time-expanded diagram over two steps from 0, four paths are possible: two end at 0 and two end at 1.State diagram01yesyesyesyesTime-expanded diagram from 0t=0t=1t=2yesyesyesyesyesyes010101reachablereachableEvery arrow is allowed, so both end configurations are reachable.
KEEP-OR-FLIP: state diagram (left) and time-expanded diagram from \(0\) (right). Four paths are possible; both configurations are reachable at time \(2\).
Generic nondeterministic transitions across multiple states and stepsA four-configuration, four-step time-expanded diagram starting from configuration 1 at t=0. Multiple outgoing arrows branch and reconverge across steps, making configurations 0, 2, and 3 reachable at t=4 while configuration 1 is not reachable.Multi-state, multi-step nondeterministic run: branching and reconverging pathst=0t=1t=2t=3t=40123start0123012301230123reachablenot reachablereachablereachableBranching and reconverging paths reach states 0, 2, and 3 at t=4, while no permitted path reaches 1.
Across multiple configurations and steps, nondeterministic transitions generate a web of branching and reconverging paths; any final configuration met by at least one path is reachable.
Problems
  1. A rule on \(\{0,1\}\) allows \(0\to1\), \(1\to0\), and \(1\to1\), and forbids \(0\to0\). List the possible two-step runs from \(0\), and the configurations reachable at time \(2\).

    Show solutionHide solution

    From \(0\) the only allowed arrow is \(0\to1\); from \(1\), both \(1\to0\) and \(1\to1\) are allowed. The possible runs are \(0\to1\to0\) and \(0\to1\to1\). Both \(0\) and \(1\) are reachable at time \(2\), each by one path.

  2. For the same rule, list the possible three-step runs from \(0\). Which configurations are reachable at time \(3\), and by how many paths?

    Show solutionHide solution

    Extend each two-step run by an allowed arrow. From \(0\to1\to0\), only \(0\to1\) is allowed, giving \(0\to1\to0\to1\). From \(0\to1\to1\), both arrows are allowed, giving \(0\to1\to1\to0\) and \(0\to1\to1\to1\). So \(1\) is reachable by two paths and \(0\) by one. The counts differ, but neither configuration is “more possible”: both are simply reachable.

  3. On the configurations \(0,1,\dots,k\), a rule allows \(i\to i\) and \(i\to i+1\) for \(i\lt k\), and only \(k\to k\) at \(k\). Show that \(k\) is reachable from \(0\) at time \(t\) exactly when \(t\geq k\), and that the number of paths from \(0\) to \(k\) at time \(t\) is \(\binom tk\).

    Show solutionHide solution

    Each step either stays or advances by one, so reaching \(k\) needs \(k\) advances, and \(k\) is reachable at time \(t\) exactly when \(t\geq k\). Once at \(k\), every later step must stay. A path from \(0\) to \(k\) at time \(t\) is therefore fixed by choosing which \(k\) of the \(t\) steps advance: the last advance may fall anywhere, and the forced stays afterward are consistent with the choice. Every choice of \(k\) steps out of \(t\) gives exactly one allowed path, so there are \(\binom tk\) of them. The number of paths grows quickly with \(t\), but it measures only how many ways there are to reach \(k\), not how likely \(k\) is.

3.1.5 Probabilistic transitions§

probabilisticconditional probabilityMarkov

A probabilistic transition rule supplies the quantitative information that nondeterminism leaves unspecified: the probability of transitioning to each next configuration \(j\), given that the register is currently in configuration \(i\). The weight of the arrow \(i\to j\) under step \(S\) is now the conditional probability of \(j\) given \(i\), written \(P(j\mid i)\):

\[\bra jS\ket i=P(j\mid i).\]

Because probabilities are nonnegative and some next configuration must occur at each step, the weights leaving every configuration \(i\) are nonnegative numbers that add to one: \(\sum_j\bra jS\ket i=1\).

Writing the transition probability as \(P(j\mid i)\) assumes that the current configuration \(i\) contains all the information needed to predict the next step: once \(i\) is known, earlier history does not alter the probabilities of the outgoing arrows. (If earlier history did matter in a physical system, that history would have to be included as part of the configuration.) A stochastic process with this memoryless property is called Markov.

As our standard example on one bit, consider COIN: whatever value the bit currently holds, replace it with the result of a fresh fair coin flip. Its permitted arrows are the same four arrows as KEEP-OR-FLIP, but each arrow now carries probability \(1/2\), so \(\bra j{\mathrm{COIN}}\ket i=1/2\) for every \(i,j\in\{0,1\}\).

Now trace two steps of COIN starting from configuration \(0\). Along the path \(0\to1\to0\), the first step has probability \(1/2\), and the second step has conditional probability \(1/2\) given the intermediate configuration \(1\); multiplying them gives a path probability of \((1/2)(1/2)=1/4\). The alternative path to zero, \(0\to0\to0\), also has probability \(1/4\). Because these two paths are mutually exclusive histories, their probabilities add:

\[P(c_2=0)=\tfrac14+\tfrac14=\tfrac12,\]

where \(c_2\) denotes the configuration after two steps, and by the same reasoning \(P(c_2=1)=1/2\). Unlike a deterministic rule, COIN does not fix the outcome of an individual run; unlike a nondeterministic rule, it predicts the statistical distribution of outcomes over repeated runs—and applying COIN twice in a row leaves the bit completely random. Over any multi-state, multi-step sequence of transitions, conditional probabilities multiply along each path and add wherever paths reconverge at a final configuration.

Probabilistic transitions: a fair coin step, applied twiceEvery arrow of the fair coin step has probability one half. In the time-expanded diagram over two steps from 0, each of the four paths has probability one quarter, and each end configuration has probability one half.State diagram011/21/21/21/2Time-expanded diagram from 0t=0t=1t=21/21/21/21/21/21/20101011/4+1/4=1/21/4+1/4=1/2Each path has probability 1/4; two paths reach each end.
COIN: state diagram (left) and time-expanded diagram from \(0\) (right). Each path has probability \(1/4\); two paths end at each configuration.
Generic probabilistic transitions across multiple states and stepsA four-configuration, four-step time-expanded diagram starting from configuration 1 at t=0. Every visited configuration splits its probability equally (1/2 each) along two outgoing arrows, producing final probabilities 3/16, 1/4, 5/16, and 1/4 at t=4.Multi-state, multi-step probabilistic run: path probabilities multiply and addt=0t=1t=2t=3t=41/21/21/21/21/21/21/21/21/21/21/21/20123p = 10123012301230123p = 3/16p = 1/4p = 5/16p = 1/4Each arrow carries probability 1/2; sixteen paths of probability 1/16 sum at each final state.
Across multiple configurations and steps, transition probabilities multiply along each path and add across all paths reaching the same final configuration.
Problems
  1. A step keeps the bit with probability \(2/3\) and flips it with probability \(1/3\). Starting from \(0\), compute \(P(c_2=0)\) by listing the paths that end at \(0\).

    Show solutionHide solution

    Two paths end at \(0\). The path \(0\to0\to0\) has probability \((2/3)(2/3)=4/9\), and \(0\to1\to0\) has probability \((1/3)(1/3)=1/9\). They cannot both happen, so \(P(c_2=0)=4/9+1/9=5/9\).

  2. For the same rule, compute \(P(c_3=0)\) from \(0\). Check your answer against the formula \(P(c_t=0)=\tfrac12+\tfrac12\left(\tfrac13\right)^t\).

    Show solutionHide solution

    After two steps the probabilities are \(5/9\) for \(0\) and \(4/9\) for \(1\). A third step reaches \(0\) by keeping \(0\) or by flipping \(1\): \[P(c_3=0)=\tfrac59\cdot\tfrac23+\tfrac49\cdot\tfrac13=\tfrac{10}{27}+\tfrac4{27}=\tfrac{14}{27}.\] The formula gives \(\tfrac12+\tfrac12\cdot\tfrac1{27}=14/27\). They agree.

  3. Prove the formula \(P(c_t=0)=\tfrac12+\tfrac12\left(\tfrac13\right)^t\) for the rule above, and describe what happens to the run’s memory of its starting configuration as \(t\) grows.

    Show solutionHide solution

    Write \(p_t=P(c_t=0)\). The run is at \(0\) at time \(t+1\) if it was at \(0\) and kept, or at \(1\) and flipped: \(p_{t+1}=\tfrac23p_t+\tfrac13(1-p_t)=\tfrac13p_t+\tfrac13\). Subtracting \(\tfrac12\) from both sides gives \(p_{t+1}-\tfrac12=\tfrac13\bigl(p_t-\tfrac12\bigr)\). Since \(p_0-\tfrac12=\tfrac12\), induction gives \(p_t-\tfrac12=\tfrac12\left(\tfrac13\right)^t\). As \(t\) grows, \(p_t\) approaches \(\tfrac12\), whatever the start: each step shrinks the difference between the two starting points by a factor of three, so the run gradually forgets where it began.

3.2

Sum and Product Rules

Once states and transitions carry numerical weights, what is the mathematical result of running a computation for several steps? It is the final state: a weight assigned to each configuration at the end of the run. That final weight answers the central question of each regime: for a deterministic rule, it is \(1\) at the unique configuration reached and \(0\) elsewhere; for a nondeterministic rule, it counts how many permitted runs end at each configuration (where any nonzero count establishes reachability); and for a probabilistic rule, it gives the probability of ending in each configuration.

Although the three models interpret weights differently, every multi-step run in a time-expanded diagram has the same structure: a collection of directed paths from the starting time to the final time. This shared geometry lets us split any multi-step calculation into two universal rules: the product rule determines the weight of a single path by multiplying arrow weights along it, and the sum rule combines all paths that arrive at the same endpoint by adding their contributions.

3.2.1 The product rule along a path§

product rule

A path in a time-expanded diagram specifies the exact configuration visited at every intermediate time step, so following that path requires taking every transition along it in sequence. Suppose a step \(S\) is followed by a step \(T\). The two-step path \(i\to j\to k\) uses the arrow from \(i\) to \(j\) under \(S\) and then the arrow from \(j\) to \(k\) under \(T\). According to the product rule, the weight of the path is the product of its individual arrow weights:

\[\bra kT\ket j\,\bra jS\ket i.\]

Read from right to left, the factors appear in the chronological order in which the steps act: the first step \(S\) stands immediately next to the initial configuration \(i\), and the second step \(T\) acts on the intermediate configuration \(j\). When the same rule acts at both steps, we simply set \(T=S\).

Notice how multiplication automatically enforces the logic of each model. For deterministic and nondeterministic rules, where every permitted arrow has weight \(1\) and every forbidden arrow has weight \(0\), the product equals \(1\) precisely when every transition along the path is permitted; a single forbidden transition anywhere along the route contributes a factor of \(0\) and eliminates the path.

For a probabilistic rule, where arrow weights are conditional probabilities, multiplying along the path gives the probability of that specific multi-step history. Crucially, the factors \(\bra jS\ket i\) and \(\bra kT\ket j\) are conditional probabilities for successive steps rather than probabilities of independent events: the Markov property guarantees that once the intermediate configuration \(j\) is given, the probability of the next transition \(j\to k\) depends only on \(j\) and not on earlier history.

For our fair-coin operation COIN, every arrow has weight \(1/2\), so each two-step path carries weight \((1/2)(1/2)=1/4\), and a path of \(t\) steps carries weight \(2^{-t}\). The product rule fixes the contribution of a single history; whenever several histories reach the same final configuration, we need a second rule to combine them.

The product rule along one pathThe weight of the path i→ j→ k, with step S and then step T, is the product of its two arrow weights. : i → j → k; weights ⟨j|S|i⟩, ⟨k|T|j⟩; ⟨k|T|j⟩ ⟨j|S|i⟩The product rule along one pathTime 0Time 1Time 2ijk⟨j|S|i⟩⟨k|T|j⟩⟨k|T|j⟩ ⟨j|S|i⟩
The weight of the path \(i\to j\to k\), with step \(S\) and then step \(T\), is the product of its two arrow weights.
Problems
  1. Under the rule that keeps the bit with probability \(2/3\) and flips it with probability \(1/3\), what is the weight of the path \(0\to0\to1\to1\)?

    Show solutionHide solution

    By the product rule, it is \(\bra1S\ket1\,\bra1S\ket0\,\bra0S\ket0=(2/3)(1/3)(2/3)=4/27\).

  2. A nondeterministic rule on \(\{0,1\}\) allows \(0\to0\), \(0\to1\), and \(1\to1\), and forbids \(1\to0\). Using the product rule with weights \(1\) and \(0\), decide which of the eight three-step paths from \(0\) are possible.

    Show solutionHide solution

    A path has weight \(1\) exactly when none of its arrows is \(1\to0\), that is, once the path reaches \(1\) it stays there. From \(0\), the possible paths are \(0\to0\to0\to0\), \(0\to0\to0\to1\), \(0\to0\to1\to1\), and \(0\to1\to1\to1\). The other four contain the arrow \(1\to0\) and have weight \(0\).

  3. The product rule for probabilities assumes the Markov property. Find a two-step random process on \(\{0,1\}\) in which the probability of the path \(0\to1\to0\), given the start \(0\), differs from \(P(c_1=1\mid c_0=0)\,P(c_2=0\mid c_1=1)\).

    Show solutionHide solution

    Let \(c_0\) be a fair coin, let \(c_1\) be an independent fair coin, and let \(c_2=c_0\), so the second step copies the starting value. Given \(c_0=0\), the path \(0\to1\to0\) has probability \(1/2\): \(c_1=1\) with probability \(1/2\), and then \(c_2=0\) for certain. But \(P(c_2=0\mid c_1=1)=1/2\), because \(c_1\) says nothing about \(c_0\). The product is \((1/2)(1/2)=1/4\neq1/2\). The second step depends on \(c_0\), not only on the current configuration \(c_1\), so the process is not Markov and the product rule fails.

3.2.2 The sum rule across paths§

sum rule

Asking whether a run ends at configuration \(k\) specifies where the trajectory finishes without specifying which intermediate configurations it visited along the way. According to the sum rule, the total weight of transitioning from start \(i\) to endpoint \(k\) is the sum of the contributions of all paths that connect \(i\) to \(k\). Over two steps—first \(S\) and then \(T\)—the paths from \(i\) to \(k\) differ only in the intermediate configuration \(j\) visited at time \(1\), so their combined weight is

\[\bra kTS\ket i=\sum_j\bra kT\ket j\,\bra jS\ket i.\]

Each term in the sum accounts for one route \(i\to j\to k\) via the product rule, and summing over all \(j\) accounts for every possible route to \(k\). The left-hand side \(\bra kTS\ket i\) views the two-step sequence as a single composite step \(TS\) (with \(S\) applied first, on the right), whose effective arrow weight from \(i\) to \(k\) is this sum of path weights.

Under a deterministic rule, only one path from \(i\) is permitted, so the sum equals \(1\) at its unique endpoint and \(0\) everywhere else. Under a nondeterministic rule with \(0/1\) arrow weights, the sum counts how many permitted paths lead from \(i\) to \(k\); a positive count means that \(k\) is reachable, though the count itself is not a probability.

Under a probabilistic rule, paths that pass through different intermediate configurations \(j\) are mutually exclusive histories, so their probabilities add to give the two-step transition probability \(P_2(k\mid i)=\bra kSS\ket i\):

\[P_2(k\mid i)=\sum_jP(k\mid j)P(j\mid i).\]

For two steps of COIN from \(0\), this sum is \(1/4+1/4=1/2\) at both \(k=0\) and \(k=1\). Notice a decisive feature shared by all three classical models: every arrow weight—and therefore every path weight—is nonnegative. Opening an additional permitted path to an endpoint \(k\) can increase that endpoint’s total weight or leave it unchanged, but can never reduce it. This nonnegativity barrier is precisely what quantum transitions will overturn.

Sum the paths to a common endpointEach route passes through an intermediate configuration j. Multiply along each route, then sum over all intermediate configurations; the dots stand for any additional routes. i → j1: ⟨j₁|S|i⟩; i → jm: ⟨j_m|S|i⟩; j1 → k: ⟨k|T|j₁⟩; jm → k: ⟨k|T|j_m⟩Sum the paths to a common endpoint⟨j₁|S|i⟩⟨j_m|S|i⟩⟨k|T|j₁⟩⟨k|T|j_m⟩ij₁j_mk⋮⟨k|TS|i⟩=Σⱼ⟨k|T|j⟩ ⟨j|S|i⟩
Each route passes through an intermediate configuration \(j\). Multiply along each route, then sum over all intermediate configurations; the dots stand for any additional routes.
Problems
  1. Under KEEP-OR-FLIP, how many possible paths lead from \(0\) to \(1\) in three steps, and what does the count tell us?

    Show solutionHide solution

    The first two steps are free and the third must end at \(1\), so there are \(2\cdot2=4\) paths. The positive count shows that \(1\) is reachable at time \(3\); it says nothing about how likely \(1\) is.

  2. A rule has \(P(0\mid0)=2/3\), \(P(1\mid0)=1/3\), \(P(0\mid1)=1/4\), and \(P(1\mid1)=3/4\). Use the sum rule to compute the four two-step weights \(\bra kSS\ket i\), and check that the weights from each start add to \(1\).

    Show solutionHide solution

    From \(0\): \(\bra 0SS\ket 0=\tfrac23\cdot\tfrac23+\tfrac13\cdot\tfrac14=\tfrac{19}{36}\) and \(\bra 1SS\ket 0=\tfrac23\cdot\tfrac13+\tfrac13\cdot\tfrac34=\tfrac{17}{36}\). From \(1\): \(\bra 0SS\ket 1=\tfrac14\cdot\tfrac23+\tfrac34\cdot\tfrac14=\tfrac{17}{48}\) and \(\bra 1SS\ket 1=\tfrac14\cdot\tfrac13+\tfrac34\cdot\tfrac34=\tfrac{31}{48}\). Indeed \(\tfrac{19}{36}+\tfrac{17}{36}=1\) and \(\tfrac{17}{48}+\tfrac{31}{48}=1\).

  3. Prove that, for any probabilistic rule, the two-step weights \(\bra kSS\ket i\) given by the sum and product rules add to \(1\) over \(k\). What does this show about composing two probabilistic steps?

    Show solutionHide solution

    By the sum and product rules, \[\sum_k\bra kSS\ket i=\sum_k\sum_jP(k\mid j)P(j\mid i)=\sum_jP(j\mid i)\sum_kP(k\mid j).\] The inner sum is \(1\), because the probabilities leaving \(j\) add to \(1\), and the remaining sum \(\sum_jP(j\mid i)\) is \(1\) for the same reason. The two-step weights are nonnegative and add to \(1\) from every start, so two probabilistic steps together form another probabilistic rule.

3.2.3 States and steps§

So far, each multi-step calculation has started from a single definite configuration. The exact same sum and product rules govern how a step \(S\) updates any general state \(\sum_iv_i\ket i\) that starts with weight \(v_i\) on each configuration \(i\).

In a single step under \(S\), starting at configuration \(i\) with weight \(v_i\) and following the arrow \(i\to j\) with weight \(\bra jS\ket i\) contributes the product \(\bra jS\ket i\,v_i\) to configuration \(j\). Summing these contributions over all starting configurations \(i\) gives the updated weight \(v^\prime_j\) at configuration \(j\):

\[v^\prime_j=\sum_i\bra jS\ket i\,v_i.\]

Ket notation turns this update into a straightforward algebraic substitution. First, a step \(S\) sends each definite configuration \(\ket i\) to the weighted sum of its successor configurations:

\[S\ket i=\sum_j\bra jS\ket i\,\ket j,\]

so that, for instance, \(\mathrm{COIN}\ket0=\tfrac12\ket0+\tfrac12\ket1\). Next, a general state \(\sum_iv_i\ket i\) updates to \(\sum_iv_i\,S\ket i\): each configuration’s successor sum is weighted by \(v_i\), and terms that land on the same configuration \(\ket j\) combine by adding their weights. Collecting the total weight on \(\ket j\) reproduces \(v^\prime_j\) automatically.

Updating the state step by step summarizes everything about the past that is needed to predict future steps, without keeping a separate list of all earlier paths. For COIN, any initial probability distribution \((v_0,v_1)\) with \(v_0+v_1=1\) updates in one step to \(v^\prime_0=v^\prime_1=(v_0+v_1)/2=1/2\): a single fair coin toss erases all trace of the initial state.

Whether a step can be undone depends on what this state update preserves. A reversible deterministic rule permutes the configurations one-to-one, so reversing its arrows restores every initial state. On two bits, where each configuration gets its own ket, CNOT acts by permuting \(\ket{10}\) and \(\ket{11}\): \(\mathrm{CNOT}\ket{00}=\ket{00}\), \(\mathrm{CNOT}\ket{01}=\ket{01}\), \(\mathrm{CNOT}\ket{10}=\ket{11}\), and \(\mathrm{CNOT}\ket{11}=\ket{10}\).

By contrast, both RESET and COIN map distinct initial states to the exact same final state, so no operation acting on that final state alone can recover which initial state prepared it. In fact, a probabilistic rule on finitely many configurations can be inverted by another probabilistic rule only if it is already deterministic and reversible—once a step spreads a definite state into a genuine probability distribution, nonnegative weights cannot re-concentrate it into a definite state without merging configurations.

Update one component of the stateEach initial weight vᵢ contributes ⟨j|S|i⟩ vᵢ to the new weight at j. The new state contains one such sum for every output configuration. i1 → j: ⟨j|S|i₁⟩; im → j: ⟨j|S|i_m⟩Update one component of the state⟨j|S|i₁⟩⟨j|S|i_m⟩i₁i_mjv_(i₁)⋮v_(i_m)v′ⱼv′ⱼ=Σᵢ⟨j|S|i⟩ vᵢ
Each initial weight \(v_i\) contributes \(\bra jS\ket i\,v_i\) to the new weight at \(j\). The new state contains one such sum for every output configuration.
Problems
  1. Apply one step of COIN, and separately one step of NOT, to the state with weights \(0.9\) on \(0\) and \(0.1\) on \(1\).

    Show solutionHide solution

    COIN sends every distribution to weights \(1/2\) and \(1/2\): \(v^\prime_0=\tfrac12(0.9)+\tfrac12(0.1)=0.5\), and likewise \(v^\prime_1=0.5\). NOT moves each weight along its single arrow, giving \(0.1\) on \(0\) and \(0.9\) on \(1\).

  2. For the rule with \(P(0\mid0)=2/3\), \(P(1\mid0)=1/3\), \(P(0\mid1)=1/4\), and \(P(1\mid1)=3/4\), find the distribution that one step leaves unchanged.

    Show solutionHide solution

    We need \(v_0=\tfrac23v_0+\tfrac14v_1\) with \(v_0+v_1=1\). The first equation gives \(\tfrac13v_0=\tfrac14v_1\), so \(v_1=\tfrac43v_0\), and then \(v_0+\tfrac43v_0=1\) gives \(v_0=3/7\) and \(v_1=4/7\). Check: \(v^\prime_0=\tfrac23\cdot\tfrac37+\tfrac14\cdot\tfrac47=\tfrac27+\tfrac17=\tfrac37\).

  3. Prove that a probabilistic rule on finitely many configurations can be undone by another probabilistic rule only if it is deterministic and reversible.

    Show solutionHide solution

    Let \(T\) be undone by \(S\). From the definite configuration \(i\), \(T\) produces a distribution \(p_i\), and \(S\) must return it to \(e_i\): \(\sum_jp_i(j)\,S(e_j)=e_i\). Each \(S(e_j)\) is a distribution, and a weighted average of distributions with positive weights equals the definite configuration \(i\) only if every distribution in it is \(e_i\). So \(S(e_j)=e_i\) for every \(j\) with \(p_i(j)\gt 0\). A configuration \(j\) therefore cannot be reached from two different starts \(i\) and \(i^\prime\), since \(S(e_j)\) cannot equal both \(e_i\) and \(e_{i^\prime}\). The \(N\) starts thus reach disjoint, nonempty sets of configurations among only \(N\) configurations, so each set has exactly one element. Each start goes to a single configuration, so \(T\) is deterministic, and different starts go to different configurations, so \(T\) is reversible.

3.3

Signed Weights

In Section 3.2, we saw why no classical probabilistic step can spread a bit randomly and then undo itself when repeated: as long as every arrow weight is nonnegative, adding paths to an endpoint can never reduce its weight back to zero. What changes if we keep the same product rule along paths and sum rule across paths, but allow weights to be negative as well as positive? The decisive new feature is cancellation: nonzero path contributions of opposite sign can sum to zero. We first trace how signs behave under multiplication and addition, and then use cancellation to construct the Hadamard step, which spreads a definite bit across both configurations yet restores the starting state on the second step.

3.3.1 Negative weights§

signed contributionproduct rule

Up to now, our weights have either counted permitted paths or represented probabilities, so they were always nonnegative. Let us keep the exact same state diagrams, time-expanded paths, and sum-and-product rules, but allow a configuration in a state or an arrow in a transition rule to carry a negative real weight. For the moment, treat this as a mathematical extension of our path bookkeeping; we will connect these weights to observable probabilities in Section 3.3.3.

Under the product rule, the weight of a path is still the product of its individual arrow weights. For a two-step path \(i\to j\to k\) under a step \(S\) applied twice, the path weight is

\[\bra kS\ket j\,\bra jS\ket i.\]

Because the factors are signed real numbers, their signs multiply along the path. A path with an odd number of negative arrow weights has a negative weight, whereas a path with an even number of negative arrow weights has a positive weight: for example, \((1/2)(-1/2)=-1/4\), while \((-1/2)(-1/2)=+1/4\). Traversing a second negative arrow therefore reverses the sign of a contribution that was already negative.

Similarly, when the starting configuration \(i\) itself carries an initial state weight \(v_i\), the contribution reaching \(k\) along the path \(i\to j\to k\) is \(\bra kS\ket j\,\bra jS\ket i\,v_i\), which incorporates the sign of \(v_i\) alongside the signs of the arrows.

A negative path weight is neither a negative probability nor a negative number of paths; it is a signed contribution to the sum at the path’s endpoint. The path itself remains present in the diagram, but its sign governs whether it reinforces or opposes other paths that meet at the same destination.

Signs multiply along a pathEach row is a path through configurations i, j, and k, with transition weights on the arrows. One negative arrow gives path weight −1/4; two negative arrows give path weight +1/4. The rows are separate examples. i1 → j1: 1/2; j1 → k1: −1/2; i2 → j2: −1/2; j2 → k2: −1/2Signs multiply along a path1/2−1/2−1/2−1/2ijkijkW(i→ j→ k)=(1/2)(−1/2)=−1/4W(i→ j→ k)=(−1/2)(−1/2)=+1/4
Each row is a path through configurations \(i\), \(j\), and \(k\), with transition weights on the arrows. One negative arrow gives path weight \(-1/4\); two negative arrows give path weight \(+1/4\). The rows are separate examples.
Problems
  1. A path has arrow weights \(-1/2\), \(1/3\), and \(-3/4\). What is its weight?

    Show solutionHide solution

    The product is \((-1/2)(1/3)(-3/4)=1/8\). Two negative factors give a positive contribution.

  2. A starting configuration has weight \(-2\). A path from it has arrow weights \(1/2\) and \(-1/3\). What contribution reaches the endpoint?

    Show solutionHide solution

    Include the initial weight: \((-2)(1/2)(-1/3)=1/3\). The arrow product alone is \(-1/6\).

  3. If the sign of one nonzero arrow weight on a path is reversed, how does the path weight change? What if two arrow occurrences change sign?

    Show solutionHide solution

    One sign reversal multiplies the product by \(-1\); two multiply it by \((-1)^2=1\), leaving it unchanged. Count occurrences along the path, including repeated uses of an arrow.

3.3.2 Cancellation across paths§

sum rulecancellation

The sum rule still computes the total weight between a starting configuration \(i\) and an endpoint \(k\) by adding the contributions of all paths from \(i\) to \(k\). When a two-step run passes through two possible intermediate configurations \(j_1\) and \(j_2\), the combined weight is

\[\bra kSS\ket i=\bra kS\ket{j_1}\,\bra{j_1}S\ket i+\bra kS\ket{j_2}\,\bra{j_2}S\ket i.\]

Denote the arrow weights along the first route \(i\to j_1\to k\) by \(a,c\) and those along the second route \(i\to j_2\to k\) by \(b,d\). The two path contributions are \(ca\) and \(db\), giving a total weight of \(ca+db\) at \(k\). If \(a=b=c=1/2\) and \(d=-1/2\), then

\[\bra kSS\ket i=\frac14-\frac14=0.\]

Although both paths are permitted and each carries a nonzero weight of magnitude \(1/4\), their combined contribution at \(k\) vanishes completely. This offsetting of nonzero path contributions with opposite signs is cancellation. With nonnegative weights, a sum of path weights can vanish only when every individual path has weight zero; with signed weights, active paths can cancel one another out.

Cancellation can also be partial, as in \(1/4-1/8=1/8\), while contributions that share the same sign reinforce one another, as in \(1/4+1/4=1/2\) or \(-1/4-1/4=-1/2\). Because a path can bring a negative contribution, opening an extra path to an endpoint can now reduce its total weight, and blocking a negative path can increase it.

Interactive figure. This two-path amplitude diagram sums the transition weights \(ca+db\) from initial state \(i\) to final state \(k\). Vary the second-path weight \(d\) across negative and positive values to see when adding a path lowers the total transition weight.

Two paths that can cancel

Cancellation at a common endpointTwo paths to the same configuration k contribute ca and db. With a=b=c=1/2 and d=−1/2, the contributions cancel although both paths are present. i → j1: a=1/2; i → j2: b=1/2; j1 → k: c=1/2; j2 → k: d=−1/2Cancellation at a common endpointa=1/2b=1/2c=1/2d=−1/2ij₁j₂kW(i→ k)=ca+db=1/4−1/4=0
Path 1 runs through \(j_1\) with weights \(a\) and \(c\); path 2 runs through \(j_2\) with weights \(b\) and \(d\). Here \(a=b=c=1/2\). Line thickness shows the size of each path’s contribution, and dashed orange marks a negative one. On the number line the second contribution starts where the first ends, so the marker shows the total \(W(i\to k)\).
What to observe

With \(a=b=c=1/2\), setting \(d=-1/2\), \(-1/4\), and \(1/2\) yields total weights \(0\), \(1/8\), and \(1/2\). Whenever \(d<0\), the two paths interfere destructively and the two-path sum falls below the single-path weight \(ca=1/4\).

Crucially, only contributions arriving at the same final configuration are added together. A weight of \(+1/4\) at configuration \(0\) and a weight of \(-1/4\) at configuration \(1\) belong to distinct endpoints and remain separate components of the state. In ket notation, \(\tfrac14\ket0-\tfrac14\ket0=0\ket0\), whereas \(\tfrac14\ket0-\tfrac14\ket1\) retains both terms.

Consequently, the single-step update for state weights keeps the exact algebraic form established in Section 3.2.3:

\[v'_j=\sum_i\bra jS\ket i\,v_i.\]

Multiplication carries each signed contribution forward along its arrow, and addition combines the contributions that meet at each endpoint \(j\). Over a general multi-state, multi-step sequence of transitions, paths of the same sign reinforce one another while paths of opposite sign partially or completely cancel at the configurations where they reconverge. What remains is to see how a single operation can use cancellation to invert itself, and how signed weights relate to observable probabilities.

Generic signed transitions across multiple states and stepsA four-configuration, four-step time-expanded diagram starting from configuration 1 at t=0 with positive (+1/2, solid blue) and negative (-1/2, dashed rust) transition weights. At t=4, paths to configuration 1 cancel to 0, paths to 2 reinforce to +5/16, and paths to 3 partially cancel to +1/8.Multi-state, multi-step signed run: reinforcement and cancellation across pathst=0t=1t=2t=3t=4+1/2+1/2+1/2+1/2−1/2+1/2+1/2−1/2−1/20123v = 10123012301230123+1/160 (cancels)+5/16 (reinforces)+1/8 (partial)Solid arrows carry +1/2 and dashed arrows carry −1/2; opposite-sign paths to state 1 cancel completely.
Across multiple configurations and steps, signed path contributions can cancel completely, cancel partially, or reinforce where paths reconverge.
Problems
  1. Three paths to the same endpoint contribute \(1/3\), \(-1/2\), and \(1/6\). What is the total? Does it imply that no path reaches the endpoint?

    Show solutionHide solution

    The total is \(1/3-1/2+1/6=0\). All three contributions are nonzero; their sum vanishes by cancellation.

  2. In the two-path diagram, set \(a=b=c=1/2\). Find the total at \(k\) for \(d=1/2\), \(d=-1/4\), and \(d=-1/2\).

    Show solutionHide solution

    The total is \(ca+db=1/4+d/2\). The three cases give \(1/2\), \(1/8\), and \(0\): reinforcement, partial cancellation, and complete cancellation.

  3. Two paths to \(0\) contribute \(1/4\) each, and two paths to \(1\) contribute \(-1/4\) each. What are the final state weights? Can any contributions cancel?

    Show solutionHide solution

    The final weights are \((1/2,-1/2)\). Contributions reinforce at each endpoint. The entries sum to zero, but they belong to different configurations and do not cancel one another.

3.3.3 The Hadamard step§

Hadamard operation

We can now use path cancellation to build a step \(H\) on one bit that spreads a definite input across both configurations, yet undoes itself when applied twice. Give three arrows of \(H\) the positive weight \(c\) and give the remaining arrow \(1\to1\) the opposite weight \(-c\):

\[\bra0H\ket0=\bra1H\ket0=\bra0H\ket1=c,\qquad \bra1H\ket1=-c.\]

Start at configuration \(0\) with weight \(1\). After one step, the state is \(H\ket0=c\ket0+c\ket1\). Over two steps from \(0\), the two paths returning to \(0\)—namely \(0\to0\to0\) and \(0\to1\to0\)—each contribute \(c\cdot c=c^2\), reinforcing to give \(2c^2\) at \(0\). Meanwhile, the two paths leading to \(1\)—namely \(0\to0\to1\) and \(0\to1\to1\)—contribute \(c^2\) and \((-c)c=-c^2\), which cancel to give \(0\) at \(1\).

Signed Hadamard transition with weight cThree arrows carry weight c and the arrow from 1 to 1 carries minus c. Over two steps from 0, two paths to 0 contribute c squared each, giving 2c squared; the paths to 1 contribute c squared and minus c squared, giving zero. Returning the original weight one therefore requires 2c squared equals one.State diagram01ccc−cTime-expanded diagram from 0t=0t=1t=2ccccc−c010101c²+c²=2c²c²−c²=0Returning to weight one requires 2c²=1.
The signed step with weights \(c\) and \(-c\): the two paths to \(0\) add to \(2c^2\), while the paths to \(1\) cancel. To restore the starting weight one, require \(2c^2=1\).

To recover the original weight \(1\) at configuration \(0\) after two steps, we must set \(2c^2=1\), or \(c=1/\sqrt2\). This choice defines the Hadamard operation:

\[\bra0H\ket0=\bra1H\ket0=\bra0H\ket1=\tfrac1{\sqrt2},\qquad \bra1H\ket1=-\tfrac1{\sqrt2}.\]

In ket notation, applying \(H\) to each definite configuration gives

\[H\ket0=\frac{\ket0+\ket1}{\sqrt2},\qquad H\ket1=\frac{\ket0-\ket1}{\sqrt2}.\]

Hadamard transitions and their ket notation Two rows show each possible input separately. From input zero, arrows to zero and one both have amplitude one over square root two, giving H ket zero equals ket zero plus ket one, divided by square root two. From input one, the arrow to zero has positive amplitude and the dashed arrow to one has negative amplitude, giving H ket one equals ket zero minus ket one, divided by square root two. InputAfter one H stepThe same transition in ket notation1/√201/√210H|0⟩=1/√2|0⟩+1/√2|1⟩Both outgoing amplitudes are positive.1/√20−1/√211H|1⟩=1/√2|0⟩−1/√2|1⟩The minus sign belongs to the arrow ending at 1.
Each arrow leaving an input becomes one term of its equation; the dashed arrow carries the negative amplitude.

Each term on the right-hand side records one outgoing arrow from the input, weighted by \(\bra jH\ket i\). Notice that \(H\ket0\) and \(H\ket1\) differ only in the minus sign before \(\ket1\) in \(H\ket1\)—the direct signature of the negative self-loop \(\bra1H\ket1=-1/\sqrt2\).

Notice that the factor \(1/\sqrt2\) was fixed purely by composition: two applications must restore the starting weight. Starting from configuration \(1\) confirms the other half of the check: the two paths to \(0\) contribute \((1/\sqrt2)(1/\sqrt2)=1/2\) and \((1/\sqrt2)(-1/\sqrt2)=-1/2\), which cancel to \(0\), while the two paths to \(1\) contribute \(1/2\) and \((-1/\sqrt2)(-1/\sqrt2)=+1/2\), which reinforce to \(1\). Thus \(\bra kHH\ket i\) equals \(1\) when \(k=i\) and \(0\) otherwise: \(HH=I\), where \(I\) is the identity step whose only arrows are self-loops of weight \(1\) (\(\bra jI\ket i=1\) for \(j=i\) and \(0\) otherwise).

Now examine the weights after a single step of \(H\). Because the weights can be negative and need not add to \(1\), they cannot themselves be probabilities. Yet from either definite input, the squares of the outgoing weights are nonnegative and add to one:

\[c^2+c^2=c^2+(-c)^2=\tfrac12+\tfrac12=1.\]

Here each squared weight equals \(1/2\). This observation suggests associating the probability of observing each configuration with the square of its weight, while keeping the signed weights themselves to govern step-by-step composition and cancellation. This serves as a motivation for the quantum probability rule rather than a derivation of it; we will state the general rule for complex weights in the next section.

For a general input state \(v_0\ket0+v_1\ket1\), the single-step update under \(H\) is

\[H(v_0\ket0+v_1\ket1)=\frac{v_0+v_1}{\sqrt2}\ket0+\frac{v_0-v_1}{\sqrt2}\ket1,\]

and applying \(H\) a second time returns \(v_0\ket0+v_1\ket1\). Unlike COIN, the intermediate state after one Hadamard step preserves the full distinction between \(\ket0\) and \(\ket1\) in the relative sign of \(\ket1\), and that sign determines which endpoint cancels and which reinforces on the second step. If we replaced the negative arrow of \(H\) by \(+1/\sqrt2\), both \(\ket0\) and \(\ket1\) would map to the same state \((\ket0+\ket1)/\sqrt2\), destroying cancellation and making the step irreversible.

Negative real weights gave us a two-way choice of sign—plus or minus along the number line—and made self-inverse cancellation possible. What if we replace that two-way sign with a continuously varying direction in a plane?

Quantum transitions: the Hadamard step, applied twiceThe Hadamard step has amplitude one over root two on every arrow except the arrow from 1 to 1, which has minus one over root two. In the time-expanded diagram over two steps from 0, the two paths to 0 contribute one half each and add to 1; the two paths to 1 contribute one half and minus one half and cancel.State diagram011/√21/√21/√2−1/√2Time-expanded diagram from 0t=0t=1t=21/√21/√21/√21/√21/√2−1/√20101011/2+1/2=11/2−1/2=0The amplitudes of the two paths to 1 cancel.
\(H\): state diagram (left) and time-expanded diagram from \(0\) (right). The paths to \(0\) add to weight \(1\); the paths to \(1\) cancel.
Problems
  1. Apply \(H\) to the state weights \((1,-1)/\sqrt2\).

    Show solutionHide solution

    The new weights are \(((1-1)/2,(1+1)/2)=(0,1)\). Contributions cancel at \(0\) and reinforce at \(1\).

  2. Draw the two-step paths from \(1\) under \(H\). Compute the contribution of each path and the final weights.

    Show solutionHide solution

    To \(0\), the paths through \(0\) and \(1\) contribute \(1/2\) and \(-1/2\). To \(1\), they contribute \(1/2\) and \((-1/\sqrt2)(-1/\sqrt2)=1/2\). The final weights are \((0,1)\).

  3. Replace the negative arrow of \(H\) by \(+1/\sqrt2\). Starting at \(0\), find the weights after two steps. Explain why this modified step cannot be reversible.

    Show solutionHide solution

    Each endpoint receives \(1/2+1/2=1\), so the final weights are \((1,1)\). Both definite inputs give the same weights \((1,1)/\sqrt2\) after one step; the input cannot be recovered. The missing negative sign removes the cancellation.

3.4

Complex Amplitudes and Interference

In Section 3.3, we saw that the signs of real weights preserve a distinction that probabilities discard, enabling two paths to cancel. Quantum mechanics extends that discrete choice of sign to a continuously varying direction in the complex plane—a phase. In this section, we see why complex amplitudes are needed by constructing a square root of NOT, formulate the probability rule and the conditions that preserve total probability across steps, examine how relative phase steers constructive and destructive interference, and finally see why leaving intermediate information imprinted on outside bits prevents the expected interference from occurring unless that imprint is erased by uncomputation.

3.4.1 Complex weights§

amplitudeconjugatesquared magnitudephase

The Hadamard operation satisfies \(H^2=I\), undoing itself in two steps. Can we instead construct a square root of NOT—an operation \(\sqrt X\) whose two-step composition flips the bit, \(\sqrt X\sqrt X=X\)? On a single bit, neither deterministic reversible operation has this property, since both the identity \(I\) and NOT (\(X\)) square to \(I\).

Let us look for a symmetric step \(\sqrt X\) with stay-weight \(a=\bra0\sqrt X\ket0=\bra1\sqrt X\ket1\) and switch-weight \(b=\bra1\sqrt X\ket0=\bra0\sqrt X\ket1\). Over two steps from either starting configuration, staying twice or switching twice returns to the initial configuration with combined weight \(a^2+b^2\), whereas staying then switching or switching then staying reaches the opposite configuration with combined weight \(ab+ba=2ab\). For the two-step operation to equal NOT, these path sums must satisfy

\[a^2+b^2=0,\qquad2ab=1.\]

Square root of NOT with weights a and bEach self-loop carries stay-weight a and each arrow between configurations carries switch-weight b. Over two steps from 0, staying twice contributes a squared and switching twice contributes b squared at 0. Staying then switching contributes ab and switching then staying contributes ba at 1. For the combined step to be NOT, a squared plus b squared must be zero and 2ab must be one.State diagram01bbaaTime-expanded diagram from 0t=0t=1t=2ababba010101a²+b²ab+ba=2abNOT requires a²+b²=0 and 2ab=1.
The step \(S\) has stay-weight \(a\) and switch-weight \(b\). In two steps from \(0\), the paths returning to \(0\) contribute \(a^2+b^2\); the paths reaching \(1\) contribute \(ab+ba=2ab\). To obtain NOT, these totals must be zero and one, respectively.

If \(a\) and \(b\) are real numbers—even negative ones—their squares \(a^2\) and \(b^2\) are both nonnegative, so \(a^2+b^2=0\) forces \(a=b=0\), contradicting \(2ab=1\). Can a nonzero number have a negative square? Not on the real number line, but in the complex plane. Picture a complex number \(u+iv\) as the point (or arrow from the origin) \((u,v)\), and add two complex numbers by adding their arrows head to tail. Multiplying an arrow by the imaginary unit \(i\) rotates it counterclockwise by a quarter turn, since \(i(u+iv)=-v+iu\); two quarter turns make a half turn, which reverses every arrow and gives \(i^2=-1\). Because squares of complex numbers can point in opposite directions, they can cancel one another. Specifically, choose

\[a=\frac{1+i}{2},\qquad b=\frac{1-i}{2}.\]

Then \(a^2=i/2\), \(b^2=-i/2\) (so \(a^2+b^2=0\)), and \(2ab=1\). Applied twice, this step implements NOT exactly. Weights that may be complex numbers are called amplitudes, and they obey the exact same sum and product rules as real weights.

Having found complex amplitudes that compose to NOT, how do we connect them to outcome probabilities? For real weights, squaring produced a nonnegative number, but here the ordinary squares \(a^2=i/2\) and \(b^2=-i/2\) are imaginary. Multiplying a complex weight by its complex conjugate provides the natural generalization: for \(z=u+iv\), its conjugate is \(z^*=u-iv\), and their product is

\[zz^*=(u+iv)(u-iv)=u^2+v^2=|z|^2.\]

This nonnegative real quantity \(|z|^2\) is the squared magnitude of \(z\) (the squared length of its arrow in the plane), and it reduces to the ordinary square when \(z\) is real. We therefore propose the Born rule: a configuration with amplitude \(v_j\) is observed with probability

\[p(j)=v_jv_j^*=|v_j|^2.\]

To describe the direction of a complex amplitude geometrically, we write any nonzero amplitude \(z\) as an arrow of length \(r=|z|\) at an angle \(\phi\) counterclockwise from the positive real axis. Using Euler’s formula \(e^{i\phi}=\cos\phi+i\sin\phi\) for the unit arrow at angle \(\phi\), we have \(z=re^{i\phi}\), where \(r=|z|\) is the magnitude and \(\phi\) is the phase. By the trigonometric angle-addition formulas, multiplying two unit arrows adds their phases, \(e^{i\alpha}e^{i\beta}=\cos(\alpha+\beta)+i\sin(\alpha+\beta)=e^{i(\alpha+\beta)}\), whereas taking the probability \(|z|^2=r^2\) keeps the magnitude and discards the phase. Positive and negative real weights correspond to phases \(0\) and \(\pi\); complex amplitudes supply all the angles in between, allowing two states with identical outcome probabilities to evolve into different outcome probabilities on a subsequent step.

Interactive figure. This transition diagram composes two identical single-bit steps to build a square root \(S\) of NOT. Step through the two stages to see how complex or signed path weights cancel on the diagonal and reinforce on the off-diagonal.

Square roots of any step

With scripting enabled, this figure finds the square roots of a chosen one-bit step \(B\) and checks \(A^2=B\) path by path.

The question \(\sqrt X\sqrt X=X\) generalized: \(A\) has weights \(a,b\) from \(0\) and \(c,d\) from \(1\), and two steps of \(A\) must give a chosen step \(B\). Each two-step weight is a sum over the intermediate configuration, for example \(a^2+bc\) from \(0\) back to \(0\). The sliders vary \(B\) over valid steps, and \(a,b,c,d\) follow continuously. At the start, \(B\) is NOT and \(a=d=(1+i)/2\), \(b=c=(1-i)/2\), the solution found above. The weights come from \(A=(B+sI)/t\), where \(I\) does nothing, \(s^2=B(0\to0)B(1\to1)-B(0\to1)B(1\to0)\), and \(t^2=B(0\to0)+B(1\to1)+2s\). Each sign choice for \(s\) and \(t\) can give a different root.
What to observe

Both \(S\) and \(-S\) square to NOT because each two-step path multiplies two weights whose signs cancel. The identity operation likewise admits multiple square roots—including NOT, \(H\), and \(Z\)—via destructive interference on off-diagonal paths.

Problems
  1. A symmetric step has stay-weight \(a\) and switch-weight \(b\). Write the two-step weights for returning and switching. Why can real \(a,b\) not make two steps equal NOT?

    Show solutionHide solution

    The return weight is \(a^2+b^2\), and the switch weight is \(ab+ba=2ab\). NOT requires these to be \(0\) and \(1\). For real weights, \(a^2+b^2=0\) forces both weights to vanish, making \(2ab=1\) impossible.

  2. For the square root of NOT, \(\sqrt X\), with \(\bra0\sqrt X\ket0=\bra1\sqrt X\ket1=(1+i)/2\) and \(\bra1\sqrt X\ket0=\bra0\sqrt X\ket1=(1-i)/2\), compute the two-step weights from \(1\) to \(0\) and to \(1\).

    Show solutionHide solution

    To \(0\): \[\bra0\sqrt X\ket1\,\bra0\sqrt X\ket0+\bra1\sqrt X\ket1\,\bra0\sqrt X\ket1=\tfrac14\bigl((1-i)(1+i)+(1+i)(1-i)\bigr)=1.\] To \(1\): \[\bra0\sqrt X\ket1\,\bra1\sqrt X\ket0+\bigl(\bra1\sqrt X\ket1\bigr)^2=\tfrac14\bigl((1-i)^2+(1+i)^2\bigr)=0.\] Two steps of \(\sqrt X\) send \(1\) to \(0\), as NOT does.

  3. Find every operation with \(S(0\to0)=S(1\to1)=a\) and \(S(0\to1)=S(1\to0)=b\) whose two steps give NOT. Show in particular that \(a\) and \(b\) cannot both be real.

    Show solutionHide solution

    Two steps from \(0\) give weight \(a^2+b^2\) at \(0\) and \(2ab\) at \(1\), and from \(1\) the same by symmetry. We need \(a^2+b^2=0\) and \(2ab=1\). If \(a\) and \(b\) were real, the first equation would force \(a=b=0\), contradicting the second. Over the complex numbers, \(a^2=-b^2\) gives \(a=\pm ib\). With \(a=ib\), \(2ib^2=1\), so \(b^2=-i/2\) and \(b=\pm(1-i)/2\), \(a=\pm(1+i)/2\). With \(a=-ib\), \(b^2=i/2\), so \(b=\pm(1+i)/2\) and \(a=\pm(1-i)/2\). There are four solutions: \(S\), \(-S\), and the two operations obtained from them by conjugating every weight. Each is unitary.

3.4.2 Conservation of probability§

normalizationcross-sum condition

Under the probability rule \(p(j)=|v_j|^2\), the requirement that outcome probabilities across all configurations sum to one becomes a condition on the state’s amplitudes:

\[\sum_jp(j)=1\quad\Longleftrightarrow\quad\sum_j|v_j|^2=1.\]

This condition is called normalization. For the outgoing weights of \(\sqrt X\), we have \(|a|^2=(1/2)^2+(1/2)^2=1/2\) and \(|b|^2=(1/2)^2+(-1/2)^2=1/2\), which sum to \(1\), just as the Hadamard weights \(\pm1/\sqrt2\) give probabilities \(1/2\) and \(1/2\).

Along a single path, squared magnitudes multiply cleanly because \(|z_1z_2|^2=(z_1z_2)(z_1z_2)^*=|z_1|^2|z_2|^2\). When several paths meet at a common configuration, however, we add their complex amplitudes before taking the squared magnitude. For two path contributions \(A\) and \(B\), expanding \((A+B)(A^*+B^*)\) gives

\[|A+B|^2=|A|^2+|B|^2+AB^*+A^*B.\]

The cross terms \(AB^*+A^*B\) record how the two contributions reinforce or cancel. In two steps of \(\sqrt X\), the two return routes contribute \(A=i/2\) and \(B=-i/2\); their amplitude sum is \(A+B=0\), giving return probability \(|0|^2=0\), whereas adding their separate path probabilities \(|A|^2+|B|^2=1/4+1/4=1/2\) would miss the cancellation altogether.

Because interference raises the probability of some configurations and lowers the probability of others, what condition on a step \(S\) guarantees that total probability is conserved—remaining equal to \(1\)—for every normalized input state? For a step \(S\) on any number of configurations, updating \(v'_j=\sum_i\bra jS\ket i\,v_i\) and summing \(|v'_j|^2={v'_j}^*v'_j\) over all outputs \(j\) groups the terms into same-input terms (\(i=k\)) and distinct-input cross terms (\(i\ne k\)):

\[\sum_j|v'_j|^2=\sum_i|v_i|^2\sum_j|\bra jS\ket i|^2+\sum_{i\ne k}v_i^*v_k\sum_j\bigl(\bra jS\ket i\bigr)^*\bra jS\ket k.\]

Conserving total probability across all superpositions therefore requires two conditions on \(S\): the outgoing normalization condition,

\[\sum_j|\bra jS\ket i|^2=1,\]

and the cross-sum condition,

\[\sum_j\bigl(\bra jS\ket i\bigr)^*\bra jS\ket k=0\qquad(i\ne k).\]

Notice what the product \(\bigl(\bra jS\ket i\bigr)^*\bra jS\ket k\) inside these sums represents as a path. The factor \(\bra jS\ket k\) is the weight of the forward arrow \(k\to j\) in \(S\). In \(S\), the weight \(\bra jS\ket i\) belongs to the arrow \(i\to j\); if we form a second step by reversing every arrow of \(S\) (turning \(i\to j\) into \(j\to i\)) and taking the complex conjugate of its weight \(\bigl(\bra jS\ket i\bigr)^*\), then \(\bigl(\bra jS\ket i\bigr)^*\bra jS\ket k\) is the path product of the two-step route \(k\to j\to i\) that steps forward under \(S\) and steps back along the reversed, conjugated arrows.

Path visualization of the cross-sum conditionLeft: in one step S from a superposition of 0 and 1, arrows of weight a and c meet at output 0 while arrows of weight b and d meet at output 1. Right: expanding the total probability pairs each forward arrow from 0 to j with a conjugated reversed arrow from j to 1; the two cross paths 0 to 0 to 1 (weight c star a) and 0 to 1 to 1 (weight d star b) must cancel to zero, while the return paths to 0 add to 1.1. Two inputs interfere at each output jInput i, kOutput jabcd0v₀1v₁0v'₀ = av₀ + cv₁cross term: a*c + c*a1v'₁ = bv₀ + dv₁cross term: b*d + d*bGain at j=0 must balance loss at j=1.2. Cross paths 0 → j → 1 must cancelStart 0Via jEnd iforward Sconjugated reversea*b*abc*d*010101|a|² + |b|² = 1(return paths add)c*a + d*b = 0(cross paths cancel)Paths 0 → 0 → 1 (weight c*a) and 0 → 1 → 1 (weight d*b) cancel to 0.
Conservation of probability leads to reversibility. Left: arrows from inputs \(0\) and \(1\) interfere at outputs \(j=0\) and \(j=1\), where any probability gain at \(j=0\) must balance a loss at \(j=1\). Right: interpreting \(\bigl(\bra jS\ket i\bigr)^*\bra jS\ket k\) as a forward step \(S\) followed by reversed, conjugated arrows turns the two probability-conservation conditions into path rules: return paths \(0\to j\to0\) add to \(|a|^2+|b|^2=1\), while cross paths \(0\to0\to1\) (weight \(c^*a\)) and \(0\to1\to1\) (weight \(d^*b\)) cancel to \(c^*a+d^*b=0\).

On a single bit with outgoing weights \(a=\bra0S\ket0\), \(b=\bra1S\ket0\) from \(0\) and \(c=\bra0S\ket1\), \(d=\bra1S\ket1\) from \(1\), the figure shows both kinds of two-step paths:

First, for \(i=k\), the return paths start and end at the same configuration (\(0\to j\to0\) or \(1\to j\to1\)). By the outgoing normalization condition, the two return routes from \(0\) (\(0\xrightarrow{a}0\xrightarrow{a^*}0\) and \(0\xrightarrow{b}1\xrightarrow{b^*}0\)) sum to \(|a|^2+|b|^2=1\), and those from \(1\) sum to \(|c|^2+|d|^2=1\).

Second, for \(i\ne k\), the cross paths connect different configurations (\(0\to j\to1\) or \(1\to j\to0\)). Starting at \(0\) and ending at \(1\), one cross path passes through \(j=0\) with weight \(c^*a\) (\(0\xrightarrow{a}0\xrightarrow{c^*}1\)) and the other passes through \(j=1\) with weight \(d^*b\) (\(0\xrightarrow{b}1\xrightarrow{d^*}1\)). By the cross-sum condition, any constructive interference at \(j=0\) is balanced by destructive interference at \(j=1\), so the two cross paths between \(0\) and \(1\) cancel completely:

\[c^*a+d^*b=0\qquad\bigl(\text{and by conjugation }a^*c+b^*d=0\bigr).\]

Because the return paths \(i\to j\to i\) sum to \(1\) and the cross paths \(k\to j\to i\) (\(i\ne k\)) cancel to \(0\), conservation of probability automatically makes the step \(S\) reversible: following \(S\) with the step obtained by reversing every arrow and conjugating its weight undoes \(S\) completely, returning each configuration to itself with amplitude \(1\) and sending \(0\) to every other configuration.

Our step \(\sqrt X\) satisfies both conditions: its return paths sum to \(|a|^2+|b|^2=1/2+1/2=1\), and its cross paths between \(0\) and \(1\) cancel to

\[a^*b+b^*a=-\frac i2+\frac i2=0.\]

Problems
  1. Check the outgoing normalization condition and the cross-sum condition for the Hadamard step \(H\) using its four arrow weights.

    Show solutionHide solution

    From either \(0\) or \(1\), the outgoing squared magnitudes are \((1/\sqrt2)^2+(\pm1/\sqrt2)^2=1/2+1/2=1\). The two cross paths \(0\to0\to1\) and \(0\to1\to1\) contribute \((1/\sqrt2)(1/\sqrt2)=+1/2\) and \((-1/\sqrt2)(1/\sqrt2)=-1/2\), which sum to \(0\).

  2. A proposed one-bit step \(S\) has all four arrow weights equal to \(1/\sqrt2\). Show that its return paths from \(0\) and from \(1\) each sum to \(1\), but its cross paths \(0\to j\to 1\) fail to cancel.

    Show solutionHide solution

    The return paths from \(0\) give \(1/2+1/2=1\) and from \(1\) give \(1/2+1/2=1\), satisfying outgoing normalization. However, the two cross paths \(0\to0\to1\) and \(0\to1\to1\) each contribute \(+1/2\), summing to \(1\ne0\); on the normalized input \((1/\sqrt2,1/\sqrt2)\), the output weights are \((1,1)\) whose squared magnitudes sum to \(2\).

  3. Show using the two-step round-trip paths \(k\to j\to i\) why any step \(S\) that satisfies outgoing normalization and the cross-sum condition is reversed by reversing its arrows and conjugating their weights.

    Show solutionHide solution

    When the second step uses the reversed arrows \(j\to i\) with conjugated weights \((\bra jS\ket i)^*\), the two-step weight from \(k\) to \(i\) is \(\sum_j (\bra jS\ket i)^*\bra jS\ket k\). Outgoing normalization sets this sum to \(1\) for \(i=k\) (every return path reinforces to \(1\)), and the cross-sum condition sets it to \(0\) for \(i\ne k\) (cross paths between distinct configurations cancel), yielding the identity step.

3.4.3 Interference and phase§

interferencecoherentglobal phaserelative phase

Whenever multiple paths terminate at the same configuration \(k\), we add their path amplitudes first and then take the squared magnitude:

\[p(k)=\Bigl|\sum_{\text{paths to }k}\text{path amplitude}\Bigr|^2.\]

Because amplitudes carry signs and phases, the paths meeting at \(k\) can reinforce or cancel. Across two Hadamard steps starting from \(0\), the two paths to \(0\) each contribute \(+1/2\), summing to \(1\) and yielding probability \(|1|^2=1\); the two paths to \(1\) contribute \(+1/2\) and \(-1/2\), canceling to \(0\) and yielding probability \(|0|^2=0\).

If we instead took the squared magnitude of each path separately and added those probabilities, both endpoints would receive \(1/4+1/4=1/2\). Adding the amplitudes before squaring raises the probability at one endpoint and lowers it at the other—an effect called interference. Interference is constructive when the resulting probability exceeds the sum of the separate squared magnitudes, and destructive when it is smaller. Paths whose amplitudes combine in this phase-sensitive way are called coherent.

For complex amplitudes, the phases of the contributing terms govern how they interfere. Suppose we multiply every amplitude in a state by the same phase factor \(e^{i\theta}\), rotating every arrow in the complex plane through the same angle \(\theta\). Every subsequent path product and endpoint sum simply acquires that same overall factor \(e^{i\theta}\), and because \(|e^{i\theta}|=1\), no outcome probability changes now or after any later transitions. Such a common phase factor across all configurations is called a global phase, and it has no observable effect.

By contrast, the phase difference between two amplitudes in a state (or between two competing paths) is their relative phase, and changing it directly alters how their amplitudes add. Consider the one-bit state

\[\frac{\ket0+e^{i\phi}\ket1}{\sqrt2}.\]

At this stage, \(0\) and \(1\) each have outcome probability \(|1/\sqrt2|^2=|e^{i\phi}/\sqrt2|^2=1/2\), regardless of \(\phi\). After a Hadamard step \(H\), however, the two contributions arriving at configuration \(0\) are \(1/2\) and \(e^{i\phi}/2\), whose sum depends on the relative phase \(\phi\):

\[p(0)=\left|\frac{1+e^{i\phi}}2\right|^2=\frac{1+\cos\phi}{2}.\]

At \(\phi=0\), the two contributions point in the same direction and interfere constructively to give \(p(0)=1\); at \(\phi=\pi\), they point in opposite directions and cancel completely to give \(p(0)=0\); at \(\phi=\pi/2\), they are perpendicular in the complex plane and give \(p(0)=1/2\). Even though all three initial states have identical outcome probabilities before \(H\), their relative phase determines the outcome probabilities after \(H\).

Interactive figure. This phasor diagram shows how a Hadamard gate recombines the amplitudes of \(\ket{0}+e^{i\phi}\ket{1}\). Sweep the relative phase \(\phi\) from \(0\) to \(\pi\) to track \(p(0)\), then vary the global phase \(\theta\) to compare the arrows and readout probabilities.

Relative and global phase

Relative phase changes how paths combinePrepare equal-magnitude amplitudes with relative phase φ, then apply H. Only the routes to final configuration zero are shown. The phase changes their sum, even though it leaves the initial probabilities unchanged. start → zero: 1/√2; start → one: e^(iφ)/√2; zero → end: 1/√2; one → end: 1/√2Relative phase changes how paths combine1/√2e^(iφ)/√21/√21/√20010PreparationHp(0)=|(1+e^(iφ))/2|²=(1+cosφ)/2
Each plane shows the complex amplitudes arriving at one final configuration after \(H\), starting from \((v_0,v_1)=e^{i\theta}\bigl(1/\sqrt2,\,e^{i\phi}/\sqrt2\bigr)\). Teal: the contribution from \(v_0\). Orange: the contribution from \(v_1\), drawn from the end of the teal arrow. Blue: their sum. The dashed circle has radius one; the bar shows the squared length of the sum.
What to observe

The outcome probability \(p(0)=(1+\cos\phi)/2\) shifts from \(1\) at \(\phi=0\) to \(1/2\) at \(\phi=\pi/2\) and \(0\) at \(\phi=\pi\). Changing the global phase \(\theta\) rotates both amplitude arrows together without altering the resultant length or probabilities.

A simple gate that shifts relative phase is the phase-flip operation \(Z\), which leaves the amplitude at \(0\) unchanged (\(\bra0Z\ket0=1\)) and multiplies the amplitude at \(1\) by \(-1\) (\(\bra1Z\ket1=-1\)), with no arrows between \(0\) and \(1\). Applying \(Z\) adds \(\pi\) to the relative phase \(\phi\). Whereas two Hadamard steps from \(0\) return to \(0\) with certainty, inserting \(Z\) between them reverses the interference and produces \(1\) with certainty instead. Quantum algorithms deliberately introduce such phase shifts so that paths leading to wrong answers cancel while paths leading to desired answers reinforce.

Problems
  1. Two paths reach an outcome with amplitudes \(1/2\) and \(i/2\). What is its probability? Is the interference constructive, destructive, or neither?

    Show solutionHide solution

    Adding first, \(|1/2+i/2|^2=\tfrac14+\tfrac14=\tfrac12\). Squaring each path separately also gives \(\tfrac14+\tfrac14=\tfrac12\). The two contributions point in perpendicular directions in the complex plane, so they neither reinforce nor cancel.

  2. Two paths contribute \(0.6\) and \(-0.2\) to an outcome. Compare the probability obtained by adding first with the result of squaring first.

    Show solutionHide solution

    Adding first gives \((0.4)^2=0.16\). Squaring first gives \(0.36+0.04=0.40\). Partial destructive interference lowers the probability.

  3. Start with amplitudes \((1/\sqrt2,e^{i\phi}/\sqrt2)\) and apply \(H\). The probability of \(0\) is \((1+\cos\phi)/2\). Which values of \(\phi\) give the same probabilities, and what extra operation could distinguish them?

    Show solutionHide solution

    \(\phi\) and \(-\phi\) have the same cosine, so they give the same probabilities. Before \(H\), multiply the amplitude at configuration \(1\) by \(e^{-i\pi/2}\). This changes the probability to \((1+\sin\phi)/2\), which differs for \(\phi\) and \(-\phi\) unless \(\sin\phi=0\).

3.4.4 Path information§

recorduncomputation

Up to now, we have tracked a single working bit in isolation, where two Hadamard steps starting from \(0\) always return the bit to \(0\) because the two paths to \(1\) contribute \(+1/2\) and \(-1/2\) at the same configuration and cancel. In a multi-bit computation, however, intermediate steps often interact with other bits, such as temporary workspace. If information about which intermediate configuration (\(0\) or \(1\)) the working bit passed through is left imprinted on any outside bit, the expected interference on the working bit will not occur. Because a configuration of the machine specifies the values of all bits that participate in the run, leaving different values imprinted on an outside bit sends the paths to different complete configurations, preventing their amplitudes from combining and canceling.

To see this failure explicitly, adjoin a second bit initialized to \(0\) to serve as an outside record. A complete configuration of the two-bit system now carries a two-bit label \(ij\), where \(i\) is the value of the working bit and \(j\) is the value of the outside record bit. Crucially, \(10\) and \(11\) are distinct complete configurations even though the working bit is \(1\) in both. We apply our standard path rules—multiplying weights along each path, summing amplitudes that arrive at the same complete configuration, and taking squared magnitudes—to these two-bit configurations.

Starting from \(\ket{00}\), apply \(H\) to the working bit while leaving the outside bit unchanged, producing the state \((\ket{00}+\ket{10})/\sqrt2\). Next, suppose an intermediate operation imprints the working bit’s configuration onto the outside bit via a controlled-NOT (CNOT) gate with the working bit as control and the outside bit as target:

\[\mathrm{CNOT}\ket{00}=\ket{00},\quad\mathrm{CNOT}\ket{01}=\ket{01},\quad\mathrm{CNOT}\ket{10}=\ket{11},\quad\mathrm{CNOT}\ket{11}=\ket{10},\]

each with transition weight \(1\). Because the outside bit flips to \(1\) only along the branch where the working bit is \(1\), the state becomes \((\ket{00}+\ket{11})/\sqrt2\). Now apply the second \(H\) step to the working bit alone: from \(00\) it reaches \(00\) and \(10\) with weight \(+1/\sqrt2\) each, whereas from \(11\) it reaches \(01\) with weight \(+1/\sqrt2\) and \(11\) with weight \(-1/\sqrt2\).

A retained record keeps the endpoints distinctEach left node has amplitude one over square root of two. Recording sends 00 to 00 and 10 to 11. The final H reaches 00, 10, 01, and 11 with amplitudes one half, one half, one half, and minus one half. A retained record keeps the endpoints distinct After first H Record written After final H Amplitude Each amplitude: 1/√2 1 1 CNOT 1/√2 1/√2 1/√2 −1/√2 00 +1/2 10 +1/2 01 +1/2 11 −1/2 00 00 10 11 Nodes name complete configurations; edge labels are transition weights.
Every node names the complete configuration: first system, then record. Each incoming amplitude in the left column is \(1/\sqrt2\). Edge labels are transition weights; the values at the right are the resulting amplitudes.

Multiplying along the four branches gives the final state

\[\tfrac12\ket{00}+\tfrac12\ket{01}+\tfrac12\ket{10}-\tfrac12\ket{11}.\]

Instead of returning the working bit to \(0\) with certainty as expected, the second Hadamard step now leaves the working bit completely random. Look closely at the two branches where the working bit finishes in \(1\): their amplitudes are still \(+1/2\) and \(-1/2\), but because the outside bit retains different values on the two branches, those amplitudes land at two different complete configurations, \(10\) and \(11\). Because the sum rule only combines amplitudes at the exact same complete configuration, these two terms cannot cancel. Each of the four complete configurations has probability \(|\pm1/2|^2=1/4\), so the probability of finding the working bit in \(1\) is

\[p(\text{first label}=1)=p(10)+p(11)=\frac14+\frac14=\frac12.\]

Merely ignoring the outside bit at the end of the run does not merge \(10\) and \(11\) into one configuration. Whenever information distinguishing the intermediate paths is left imprinted on any outside bit, the paths terminate at different complete endpoints and the expected interference fails to occur—whether or not anyone ever inspects that outside bit.

To restore the expected behavior on the working bit, the computation must erase the imprint on the outside bit before the final \(H\) step acts. Because CNOT is its own inverse, applying a second CNOT immediately after the first sends \(00\) back to \(00\) and \(11\) back to \(10\), resetting the outside bit to \(0\) on both branches while keeping their amplitudes at \(1/\sqrt2\). With the outside bit back in the same state \(0\) along both routes, the final \(H\) again sends both branches to the same complete endpoints \(00\) and \(10\): the contributions \(+1/2\) and \(-1/2\) at \(10\) cancel to \(0\), while the two contributions at \(00\) reinforce to \(1\), restoring a certain return to \(00\).

Undo the record before the final HEach left node has amplitude one over square root of two. A second controlled NOT sends 00 to 00 and 11 to 10. The final H contributes plus one half twice to 00, and opposite one halves to 10. Undo the record before the final H After recording Record undone After final H Amplitude Each amplitude: 1/√2 1 1 CNOT 1/√2 −1/√2 1/√2 1/√2 00 1/2 + 1/2 = 1 10 1/2 − 1/2 = 0 00 00 11 10 Nodes name complete configurations; edge labels are transition weights.
Undo the recording before recombining the paths. The record has the same value on both alternatives, so contributions can meet at the same complete configuration. The crossed edges do not introduce an extra node.

This is why uncomputation—introduced in Section 2.4.3 to reset temporary workspace—is essential in quantum computation. In a classical reversible circuit, leftover values on workspace bits merely occupy memory; in a quantum circuit, any intermediate information left imprinted on outside workspace bits splits the endpoints of interfering paths and prevents the expected output from occurring. Uncomputation actively reverses the gates that created those outside imprints before interference takes place. In Chapter 4, we express these weighted sums of kets as complex vectors and state the general postulates for quantum states, evolution, measurement, and composite systems.

Problems
  1. After retaining the record, what is the probability of each final configuration? What is the probability that the record is one?

    Show solutionHide solution

    Each final amplitude has magnitude \(1/2\), so each complete configuration has probability \(1/4\). The record is one in \(01\) and \(11\), giving total probability \(1/2\).

  2. Follow the routes from the two configurations after recording, \(00\) and \(11\), through the final \(H\). Calculate the four final amplitudes and explain why the contributions to first-label value one do not cancel.

    Show solutionHide solution

    The input amplitude \(1/\sqrt2\) at \(00\) gives \(+1/2\) at both \(00\) and \(10\). The input amplitude \(1/\sqrt2\) at \(11\) gives \(+1/2\) at \(01\) and \(-1/2\) at \(11\). The contributions to first-label value one have different complete endpoints, \(10\) and \(11\), so their probabilities add rather than their amplitudes.

  3. Suppose the recording is undone only after the final \(H\). Track the four amplitudes through this extra controlled-NOT. Does the first label now return to zero with certainty? Explain why the timing matters.

    Show solutionHide solution

    After the final H, the amplitudes in order \(00,01,10,11\) are \((1/2,1/2,1/2,-1/2)\). Controlled-NOT exchanges \(10\) and \(11\), giving \((1/2,1/2,-1/2,1/2)\). The probability that the first label is one remains \(1/2\). Only before recombination does this controlled-NOT undo the original recording: after H, the first label has changed, so the same operation no longer clears the record on both contributing alternatives.

Summary

Questions and worked problems

Attempt each question before opening a hint. Explain your reasoning, then compare it with the solution.

1. Quick check §

Two paths reach an outcome with amplitudes \(1/2\) and \(e^{i\pi/3}/2\). What is its probability?

Hint 1

Add the amplitudes before squaring.

Hint 2

\(|1+e^{i\phi}|^2=2+2\cos\phi\).

Worked solution

\(|1+e^{i\pi/3}|^2/4=(2+2\cos60^\circ)/4=3/4\). Squaring each path first would give \(1/4+1/4=1/2\): the phases partly reinforce.

Revisit the relevant explanation

2. Quick check §

Which of these amplitude lists \((v_0,v_1)\) are normalized? (a) \((\tfrac12,\tfrac12)\); (b) \((\tfrac{1}{\sqrt2},-\tfrac{1}{\sqrt2})\); (c) \((0.6,\,0.8i)\); (d) \((\tfrac{1+i}{2},\tfrac{1-i}{2})\). For each normalized list, give the two probabilities.

Hint 1

Add the squared magnitudes \(|v_0|^2+|v_1|^2\).

Hint 2

\(|u+iv|^2=u^2+v^2\).

Worked solution

(a) \(\frac14+\frac14=\frac12\): not normalized, so these amplitudes cannot describe a state as they stand. (b) \(\frac12+\frac12=1\): normalized, probabilities \(\frac12,\frac12\). (c) \(0.36+0.64=1\): normalized, probabilities \(0.36\) and \(0.64\). (d) \(|1+i|^2/4=2/4=\frac12\) for each: normalized, probabilities \(\frac12,\frac12\). Signs and complex phases do not affect normalization; only magnitudes do.

Revisit the relevant explanation

3. Quick check §

Three states have amplitudes \(A=(\tfrac{1}{\sqrt2},\tfrac{1}{\sqrt2})\), \(B=(-\tfrac{1}{\sqrt2},-\tfrac{1}{\sqrt2})\), and \(C=(\tfrac{1}{\sqrt2},-\tfrac{1}{\sqrt2})\). All give probabilities \(\frac12,\frac12\). Apply one Hadamard step to each. Which pairs remain indistinguishable, and why?

Hint 1

\(H\) sends \((v_0,v_1)\) to \(\big((v_0+v_1)/\sqrt2,(v_0-v_1)/\sqrt2\big)\).

Hint 2

\(B\) is \(A\) multiplied by \(-1\).

Worked solution

\(A\) becomes \((1,0)\), so the result is \(0\) with certainty. \(B\) becomes \((-1,0)\), also \(0\) with certainty. \(C\) becomes \((0,1)\), so the result is \(1\) with certainty. \(A\) and \(B\) differ by a global phase \(-1\), which multiplies every later amplitude by the same factor and never changes a probability. \(A\) and \(C\) differ in relative phase, which the Hadamard step converts into a difference in outcome. Equal probabilities do not mean equal states.

Revisit the relevant explanation

4. Worked problem §

An operation \(G\) on a qubit has the real weights \(\bra0G\ket0=\bra1G\ket1=\cos\alpha\), \(\bra1G\ket0=\sin\alpha\), and \(\bra0G\ket1=-\sin\alpha\). Check the two conditions on an operation, compute the two-step weights by path sums, and find the \(\alpha\) for which two steps send \(0\) to \(1\).

Hint 1

The cross sum is \(\bra0G\ket0\bra0G\ket1+\bra1G\ket0\bra1G\ket1\).

Hint 2

Two steps from \(0\) give \(\cos2\alpha\) at \(0\) and \(\sin2\alpha\) at \(1\).

Worked solution

The squares leaving each configuration add to \(\cos^2\alpha+\sin^2\alpha=1\), and the cross sum is \(-\cos\alpha\sin\alpha+\sin\alpha\cos\alpha=0\). From \(0\): weight \(\cos^2\alpha-\sin^2\alpha=\cos2\alpha\) at \(0\) and \(2\sin\alpha\cos\alpha=\sin2\alpha\) at \(1\). From \(1\): \(-\sin2\alpha\) at \(0\) and \(\cos2\alpha\) at \(1\). At \(\alpha=\pi/4\), two steps send \(0\) to \(1\) and \(1\) to \(-0\): NOT, except for a relative sign. Real weights reach NOT only up to this sign; exactly NOT needs complex weights.

Revisit the relevant explanation

5. Worked problem §

A proposed step \(S\) has all four weights \(\bra jS\ket i\) equal to \(1/\sqrt2\). (a) Check the outgoing-normalization condition for each definite input. (b) Check the cross-sum condition \(\sum_j(\bra jS\ket0)^*\bra jS\ket1=0\). (c) Apply the step to the normalized input \((\tfrac{1}{\sqrt2},\tfrac{1}{\sqrt2})\) and find the total of the squared magnitudes. What goes wrong?

Hint 1

From either input the outgoing squared magnitudes are \(\frac12+\frac12\).

Hint 2

Each new amplitude is \(\frac{1}{\sqrt2}(v_0+v_1)\).

Worked solution

(a) From \(0\) or from \(1\) the outgoing squared magnitudes are \(\frac12+\frac12=1\), so definite inputs stay normalized. (b) The cross sum is \(\frac12+\frac12=1\neq0\), so the condition fails. (c) Each new amplitude is \(\frac{1}{\sqrt2}\big(\frac{1}{\sqrt2}+\frac{1}{\sqrt2}\big)=1\), so the output is \((1,1)\), with total \(2\). The “probabilities” would add to \(2\). Because contributions from the two inputs always reinforce, the cross terms add instead of cancelling. The Hadamard step avoids this with its single negative weight, which makes the cross sum \(\frac12-\frac12=0\). Checking definite inputs alone is not enough.

Revisit the relevant explanation

6. Worked problem §

Let \(\sqrt X\) be the square root of NOT, with stay-weight \(a=(1+i)/2\) and switch-weight \(b=(1-i)/2\). Starting at \(\ket0\), find the amplitudes after three steps of \(\sqrt X\), and after four. Use \(\sqrt X\sqrt X=X\) to shorten the calculation, and give the probabilities.

Hint 1

Three steps are two steps (\(X\)) followed by one more, or one followed by two.

Hint 2

One step from \(0\) gives \((a,b)\); NOT exchanges the two amplitudes.

Worked solution

One step from \(0\) gives amplitudes \((a,b)=\big(\frac{1+i}{2},\frac{1-i}{2}\big)\). Two steps give NOT, so three steps are one step followed by NOT, which exchanges the amplitudes: \(\big(\frac{1-i}{2},\frac{1+i}{2}\big)\). Each has squared magnitude \(\frac12\), so the probabilities are \(\frac12,\frac12\). Four steps are NOT twice, which does nothing: the amplitudes are \((1,0)\), and the run returns to \(0\) with certainty. After one or three steps the outcome looks like a fair coin, yet the next steps can still produce a certain result. The amplitudes retain information that the probabilities do not show.

Revisit the relevant explanation

7. Worked problem §

Repeat the path-information experiment of Section 3.4.4 with a different “record”: between the two Hadamard steps on the first label, apply NOT to the record bit whatever the first label is. Track the four amplitudes from \(00\) and find the final probabilities. Does the first label still return to \(0\) with certainty? Explain using complete configurations.

Hint 1

After the first \(H\), the occupied configurations are \(00\) and \(10\); NOT on the record turns them into \(01\) and \(11\).

Hint 2

Both paths now carry the same record value.

Worked solution

After the first \(H\): \(00\) and \(10\), each with amplitude \(\frac{1}{\sqrt2}\). NOT on the record gives \(01\) and \(11\). The final \(H\) on the first label sends \(01\) to \(01\) and \(11\) with weights \(\frac{1}{\sqrt2}\), and \(11\) to \(01\) with \(\frac{1}{\sqrt2}\) and to \(11\) with \(-\frac{1}{\sqrt2}\). The totals are \(\frac12+\frac12=1\) at \(01\) and \(\frac12-\frac12=0\) at \(11\). So the outcome is \(01\) with certainty: the first label returns to \(0\), and the record reads \(1\). The record changed, but identically on both paths, so the two paths still meet at the same complete configurations and interfere. Only a record that distinguishes the paths prevents interference.

Revisit the relevant explanation

8. Misconception §

A student says: “After one Hadamard step from \(0\), the bit is \(0\) or \(1\) with probability \(\frac12\) each. That is the same as a fair coin, so a second Hadamard step should act like a second coin flip, giving \(\frac12,\frac12\) again.” Compute what actually happens, and identify the step in the student’s reasoning that fails.

Hint 1

Add the amplitudes of the two paths to each endpoint before squaring.

Hint 2

Would a fair coin have the same amplitudes, or only the same probabilities?

Worked solution

Two Hadamard steps from \(0\) give amplitude \(\frac12+\frac12=1\) at \(0\) and \(\frac12-\frac12=0\) at \(1\): the result is \(0\) with certainty. The student treated the intermediate state as a probability distribution and combined the two paths by adding probabilities, \(\frac14+\frac14\). But the intermediate state is the amplitude list \((\frac{1}{\sqrt2},\frac{1}{\sqrt2})\), and the paths to each endpoint must be combined by adding amplitudes, which can cancel. Equal probabilities after one step do not determine what happens after the next. The amplitudes carry the signs that make cancellation possible, and a coin’s probabilities do not.

Revisit the relevant explanation

9. Extension §

Apply \(H\), then the phase step \(R\) with \(\bra0R\ket0=1\) and \(\bra1R\ket1=e^{i\phi}\), then \(H\), to \(0\). Using path sums, find the probability of outcome \(0\) as a function of \(\phi\), and the values of \(\phi\) that make each outcome certain.

Hint 1

There are two paths to each final configuration.

Hint 2

The path through \(1\) picks up the factor \(e^{i\phi}\).

Worked solution

To \(0\): \(\tfrac12+\tfrac12e^{i\phi}\). To \(1\): \(\tfrac12-\tfrac12e^{i\phi}\). The probability of \(0\) is \(|1+e^{i\phi}|^2/4=(1+\cos\phi)/2\). Outcome \(0\) is certain at \(\phi=0\) and outcome \(1\) at \(\phi=\pi\). A phase that no direct measurement sees controls the result completely.

Revisit the relevant explanation

10. Extension §

Find a one-bit step \(A\) that changes only phases (\(\bra1A\ket0=\bra0A\ket1=0\)) and satisfies \(A^2=Z\). How many such steps are there? Then compute the probability of \(0\) after \(H\), \(A\), \(H\) starting at \(0\), and compare it with \(H\), \(Z\), \(H\). What does “half of \(Z\)” do to the interference?

Hint 1

Write \(\bra0A\ket0=p\), \(\bra1A\ket1=q\), and require \(p^2=1\), \(q^2=-1\).

Hint 2

Use \(p(0)=(1+\cos\phi)/2\) for a relative phase \(\phi\).

Worked solution

Two steps of a diagonal step multiply each weight by itself, so \(p^2=1\) and \(q^2=-1\): \(p=\pm1\) and \(q=\pm i\). That gives four steps, and each satisfies normalization because \(|p|=|q|=1\). Take \(A\) with \(p=1\), \(q=i\). After \(H\) the amplitudes are \((\frac{1}{\sqrt2},\frac{1}{\sqrt2})\); \(A\) changes them to \((\frac{1}{\sqrt2},\frac{i}{\sqrt2})\), a relative phase \(\pi/2\). The final \(H\) gives \(p(0)=(1+\cos\frac\pi2)/2=\frac12\). With \(Z\), the relative phase is \(\pi\) and \(p(0)=0\); with no step it is \(0\) and \(p(0)=1\). Half the phase gives a probability halfway between, not a step halfway between “keep” and “flip.” The step with \(q=i\) reappears in later chapters as the phase gate \(S\).

Revisit the relevant explanation

Where this leads. Chapter 4 gives the amplitude rules a compact vector-and-matrix notation and adds measurement updates.

Search this book

Search all chapters and appendices.