Education / Quantum Computing

Quantum Computing · Appendices

Appendices

These short extensions supply supporting models, identities, and formal arguments. Each can be read when its linked chapter raises the corresponding question.

In this chapter · 5 sections
  1. A Automata and Memory
  2. B Grammars and Lambda Calculus
  3. C Linear Algebra Reference
  4. D Mixed States and General Measurements
  5. E Polynomial Lower Bounds

A. Automata and Memory

finite automatonpushdown automatonlinear-bounded automaton

How much memory does a computation need? Start with the least: a finite automaton, which reads its input once while keeping one of finitely many control states. Two states suffice to track parity, whether the number of ones read so far is even or odd: reading a one swaps the states, and reading a zero leaves them unchanged.

Can a finite automaton check that a string consists of some number of \(a\)’s followed by the same number of \(b\)’s, the language \(\{a^nb^n:n\geq0\}\)? No. A fixed automaton has finitely many states, so two different long prefixes \(a^i\) and \(a^j\) must reach the same state. Appending \(b^i\) then forces the same decision on \(a^ib^i\), which is in the language, and on \(a^jb^i\), which is not. This state-collision argument proves the limitation.

What extra memory is enough? A stack, which can hold arbitrarily many pending symbols: push once for each \(a\), then pop once for each \(b\). Reject an \(a\) after the first \(b\), or a \(b\) with nothing left to pop. Accept when the input and stack run out together. A pushdown automaton formalizes this memory. A linear-bounded automaton has a writable tape no longer than a constant multiple of the input, and a Turing machine removes even that bound.

Do these models form a sequence of ever better machines? Not in that sense. More memory changes which configurations are available, not what a single step means. The models describe different classes of languages; they are not successive generations of hardware.

A stack remembers the unmatched prefixReading aabb pushes for each a and pops for each b. The empty stack at the end certifies matching counts in this example; checking order is also required. Columns: Read so far, Action, Stack height. a, Push, 1; aa, Push, 2; aab, Pop, 1; aabb, Pop, 0A stack remembers the unmatched prefixRead so farActionStack heightaPush1aaPush2aabPop1aabbPop0
Reading \(aabb\) pushes for each \(a\) and pops for each \(b\). The empty stack at the end certifies matching counts in this example; checking order is also required.
Problems
  1. Design a two-state finite automaton that accepts the binary strings with an even number of \(1\)s, and trace it on \(1011\).

    Show solutionHide solution

    States \(E\) (start, accepting) and \(O\). A \(1\) swaps the states; a \(0\) leaves them. On \(1011\): \(E\to O\to O\to E\to O\). It ends in \(O\) and rejects: the string has three \(1\)s.

  2. Run the stack procedure on \(aaabbb\) and on \(aabbb\), giving the stack height after each symbol.

    Show solutionHide solution

    \(aaabbb\): \(1,2,3,2,1,0\); the input and the stack end together, so it is accepted. \(aabbb\): \(1,2,1,0\), and then the last \(b\) finds the stack empty, so it is rejected.

  3. Show that no finite automaton recognizes the strings over \(\{a,b\}\) with equal numbers of \(a\)’s and \(b\)’s, in any order.

    Show solutionHide solution

    An automaton with finitely many states sends two prefixes \(a^i\) and \(a^j\), \(i\neq j\), to the same state. Append \(b^i\): \(a^ib^i\) has equal counts and must be accepted, while \(a^jb^i\) does not and must be rejected. But both end in the same state after reading the same suffix, so the automaton gives them the same answer. The language needs unbounded memory, such as a counter.

B. Grammars and Lambda Calculus

grammarlambda calculusChurch numeral

Instead of recognizing strings, can we describe a set of strings by how its members are produced? A grammar does this. It specifies a start symbol, terminal symbols, nonterminal symbols, and replacement rules. The rules \(S\to aSb\) and \(S\to\epsilon\), where \(\epsilon\) is the empty string, generate exactly the strings of matching \(a\)’s and \(b\)’s: applying the first rule twice and then the second gives \(aabb\).

How do grammars relate to machines? Generation asks what can be produced; recognition asks whether a given string belongs to the generated set. Regular grammars correspond to finite automata, context-free grammars to pushdown automata, context-sensitive grammars to linear-bounded automata, and unrestricted grammars to the languages a Turing machine recognizes, with the usual conventions about the empty string.

Can computation be described without any machine at all? Lambda calculus uses only functions, application, and substitution. The reduction \((\lambda x.t)u\to t[x:=u]\) replaces the free occurrences of \(x\) in \(t\) by \(u\), renaming bound variables where necessary to avoid capture; for example, \((\lambda x.x)u\to u\).

How can functions alone represent numbers? A Church numeral \(n\) is the function that applies a given function \(n\) times to a given starting value, so three is \(\lambda f.\lambda x.f(f(f(x)))\). Functions alone can encode data and iteration. The functions computable in lambda calculus are exactly the Turing-computable ones. That equivalence between formal models supports the broader Church–Turing thesis; it does not prove it.

A derivation generates a stringApply S→ aSb twice, then S→ empty string. This demonstrates generation of aabb; it does not yet give a procedure for rejecting arbitrary strings. Parse tree. The start symbol S expands by S → aSb into a, S, b; the inner S expands the same way; the innermost S becomes the empty string. Reading the leaves from left to right gives aabb.A derivation generates a stringSaSbaSbεaabbrule appliedstring so farS→ aSbaSbS→ aSbaaSbbS→εaabbLeaves, left to right: aabb
Apply \(S\to aSb\) twice, then \(S\to\) empty string. This demonstrates generation of \(aabb\); it does not yet give a procedure for rejecting arbitrary strings.
Problems
  1. Derive \(aaabbb\) from \(S\) with the rules \(S\to aSb\) and \(S\to\epsilon\), writing each step.

    Show solutionHide solution

    \(S\to aSb\to aaSbb\to aaaSbbb\to aaabbb\).

  2. Reduce \((\lambda x.\lambda y.x)\,a\,b\) step by step.

    Show solutionHide solution

    Application groups to the left: first \((\lambda x.\lambda y.x)a\to\lambda y.a\), then \((\lambda y.a)b\to a\). The term selects its first argument.

  3. With Church numerals, show that \(\mathrm{SUCC}=\lambda n.\lambda f.\lambda x.f(n\,f\,x)\) applied to \(2=\lambda f.\lambda x.f(f\,x)\) gives \(3\).

    Show solutionHide solution

    \(\mathrm{SUCC}\,2\to\lambda f.\lambda x.f(2\,f\,x)\). Inside, \(2\,f\,x\to f(f\,x)\), so the result is \(\lambda f.\lambda x.f(f(f\,x))\), the numeral \(3\).

C. Linear Algebra Reference

operator norm

This appendix collects, for reference, the linear algebra used in the book. Where an identity is not derived in the main text, it is derived here.

How are complex vectors compared? Through the inner product \(\braket uv=u^\dagger v\), where \(u^\dagger=(u^*)^T\) is the conjugate transpose. The norm is \(\sqrt{u^\dagger u}\). An orthonormal basis matrix \(B\) satisfies \(B^\dagger B=I\), and \(B^\dagger\) converts old coordinates to new ones.

In which order do matrices act? From right to left on column vectors, and the adjoint reverses the order of a product: \((AB)^\dagger=B^\dagger A^\dagger\). Three properties of a matrix are easily confused. A unitary preserves overlaps; a Hermitian matrix equals its adjoint; an orthogonal projector satisfies \(P^2=P=P^\dagger\).

How do tensor products behave? \((A\otimes B)(u\otimes v)=Au\otimes Bv\) and \(\braket{u\otimes v}{x\otimes y}=\braket ux\braket vy\). In the binary ordering used in this book, the leftmost qubit is the most significant label.

How large can a matrix make a vector? The operator norm \(\|A\|=\max_{\|v\|=1}\|Av\|\) answers this. It gives uniform error bounds, because \(\|(U-V)v\|\leq\|U-V\|\) for every unit vector \(v\).

Use conjugation when normalizingFor the complex vector (3,4i), the squared norm is 9+16=25. Dividing by five gives a unit vector; the imaginary coordinate contributes positively to its norm. Two ways to square the length of v = (3, 4i). Transpose only: 3·3 + (4i)(4i) = 9 − 16 = −7, which cannot be a squared length. Conjugate transpose: 9 + 16 = 25, so the norm is 5 and v/5 = (3/5, 4i/5) is a unit vector.Use conjugation when normalizingv/|v|=(3/5, 4i/5)ᵀ, length 10Transpose onlyvᵀv=9+(4i)²+9−16−7not a squared lengthConjugate transposev† v=9+overline(4i)(4i)+9+1625=|v|²
For the complex vector \((3,4i)\), the squared norm is \(9+16=25\). Dividing by five gives a unit vector; the imaginary coordinate contributes positively to its norm.
Problems
  1. What is the operator norm of \(\operatorname{diag}(3,1)\), and of a unitary \(U\)?

    Show solutionHide solution

    \(\operatorname{diag}(3,1)\) stretches \(\ket0\) by \(3\) and nothing by more, so its norm is \(3\). A unitary preserves every length, so \(\|U\|=1\).

  2. Verify \((AB)^\dagger=B^\dagger A^\dagger\) for \(A=\begin{pmatrix}1&i\\0&1\end{pmatrix}\) and \(B=\begin{pmatrix}0&1\\1&0\end{pmatrix}\).

    Show solutionHide solution

    \(AB=\begin{pmatrix}i&1\\1&0\end{pmatrix}\), so \((AB)^\dagger=\begin{pmatrix}-i&1\\1&0\end{pmatrix}\). Also \(A^\dagger=\begin{pmatrix}1&0\\-i&1\end{pmatrix}\) and \(B^\dagger=B\), and \(B^\dagger A^\dagger=\begin{pmatrix}-i&1\\1&0\end{pmatrix}\). They agree.

  3. Show that a projector \(P\), with \(P^2=P=P^\dagger\), has only the eigenvalues \(0\) and \(1\), and that \(I-P\) is also a projector.

    Show solutionHide solution

    If \(P\ket v=\lambda\ket v\), then \(\lambda\ket v=P\ket v=P^2\ket v=\lambda^2\ket v\), so \(\lambda^2=\lambda\), and \(\lambda\) is \(0\) or \(1\). Also \((I-P)^2=I-2P+P^2=I-P\), and \((I-P)^\dagger=I-P\).

D. Mixed States and General Measurements

density matrixreduced stateeffects

What if we know only that a system was prepared in one of several states, \(\ket{\psi_r}\) with probability \(q_r\)? In general, no single state vector describes that preparation. The density matrix

\[\rho=\sum_rq_r\ket{\psi_r}\bra{\psi_r}\]

does. Its trace—the sum of its diagonal entries—is one. It is positive semidefinite, meaning \(\bra v\rho\ket v\geq0\) for every vector \(\ket v\); this ensures nonnegative measurement probabilities. A pure state has \(\rho=\ket\psi\bra\psi\). Different ensembles can give the same density matrix, and then they give the same predictions for every measurement. The measurement rule becomes \(p(j)=\operatorname{tr}(P_j\rho)\), and unitary evolution sends \(\rho\) to \(U\rho U^\dagger\).

What is the state of one part of an entangled pair? Its reduced state \(\rho_A=\operatorname{tr}_B\rho_{AB}\), computed by summing over the unobserved basis label: \((\rho_A)_{a,a^\prime}=\sum_b(\rho_{AB})_{ab,a^\prime b}\). The same \(b\) appears in the row and column because we ignore which outcome occurred in \(B\). For either half of a Bell state, it is \(I/2\).

Can an operation on \(B\) change \(\rho_A\)? Not when its outcome is ignored. A trace-preserving operation on \(B\), with operators \(M_r\) satisfying \(\sum_rM_r^\dagger M_r=I\), leaves \(\rho_A\) unchanged; inserting the sum into the partial trace shows this. Conditioning on the outcome \(r\) changes the description only for someone who knows \(r\).

Are projective measurements the only ones? No. A general measurement has positive operators \(E_j\), called effects, that sum to the identity, with probabilities \(p(j)=\operatorname{tr}(E_j\rho)\). The effects fix the probabilities but not the state after the measurement; measurement operators supply that further information.

Can we sometimes identify either of two nonorthogonal states with certainty, provided we allow an inconclusive result? A measurement with three outcomes makes this possible. Suppose the state is either \(\ket0\) or \(\ket+\). With \(c=1/(1+1/\sqrt2)\), take

\[E_0=c\ket-\bra-,\qquad E_+=c\ket1\bra1,\qquad E_?=I-E_0-E_+.\]

The outcome \(0\) is impossible for \(\ket+\), the outcome \(+\) is impossible for \(\ket0\), and the outcome \(?\) is inconclusive. \(E_?\) is positive because the largest eigenvalue of \(\ket-\bra-+\ket1\bra1\) is \(1+1/\sqrt2\). Whenever this measurement gives an answer, the answer is certain; the price is that it sometimes declines to answer.

Different ensembles can yield the same density matrixAn equal mixture of |0⟩ and |1⟩ and an equal mixture of |+⟩ and |−⟩ both yield I/2. No measurement on the qubit alone identifies which ensemble was used. Columns: Preparation ensemble, Density matrix, Computational outcomes. Half |0⟩, half |1⟩, I/2, 0 and 1 equally likely; Half |+⟩, half |−⟩, I/2, 0 and 1 equally likelyDifferent ensembles can yield the same density matrixPreparation ensembleDensity matrixComputational outcomesHalf |0⟩, half |1⟩I/20 and 1 equally likelyHalf |+⟩, half |−⟩I/20 and 1 equally likely
An equal mixture of \(\ket0\) and \(\ket1\) and an equal mixture of \(\ket+\) and \(\ket-\) both yield \(I/2\). No measurement on the qubit alone identifies which ensemble was used.
Problems
  1. Write the density matrix of the ensemble that prepares \(\ket0\) with probability \(3/4\) and \(\ket1\) with probability \(1/4\). What is the probability of outcome \(0\)?

    Show solutionHide solution

    \(\rho=\tfrac34\ket0\bra0+\tfrac14\ket1\bra1=\operatorname{diag}(3/4,1/4)\), and \(p(0)=\operatorname{tr}(\ket0\bra0\rho)=3/4\).

  2. Show that the ensembles \(\{\ket0,\ket1\}\) and \(\{\ket+,\ket-\}\), each with equal probabilities, have the same density matrix.

    Show solutionHide solution

    \(\tfrac12(\ket0\bra0+\ket1\bra1)=I/2\). And \(\ket\pm\bra\pm=\tfrac12\begin{pmatrix}1&\pm1\\\pm1&1\end{pmatrix}\), whose average is \(I/2\) too. No measurement can tell the two preparations apart.

  3. For the measurement with effects \(E_0=c\ket-\bra-\), \(E_+=c\ket1\bra1\), and \(E_?=I-E_0-E_+\), where \(c=1/(1+1/\sqrt2)\), compute the probability of the inconclusive outcome for \(\ket0\) and for \(\ket+\).

    Show solutionHide solution

    For \(\ket0\): \(\braket0{E_+0}=0\) and \(\braket0{E_00}=c|\braket-0|^2=c/2\), so \(p(?)=1-c/2\). Since \(c/2=1/(2+\sqrt2)=(2-\sqrt2)/2\), \(p(?)=\sqrt2/2=1/\sqrt2\). By symmetry, \(\ket+\) gives the same value. The measurement fails with probability equal to the overlap \(\braket0+=1/\sqrt2\).

E. Polynomial Lower Bounds

approximate degree

Why must a search algorithm make many queries? In the Boolean query model, the hidden input is a string \(z\in\{0,1\}^N\), and a query transforms \(\ket{i,b}\) into \(\ket{i,b\oplus z_i}\). How does each query change the amplitudes? Every new amplitude is a combination of previous amplitudes multiplied by \(z_i\) or by \(1-z_i\).

The amplitudes therefore start as constants and gain degree at most one per query. Operations that do not depend on the input only form linear combinations, which do not raise the degree. By induction, after \(T\) queries every amplitude is a polynomial of degree at most \(T\) in the input bits.

What about the probability of accepting? It is a sum of squared magnitudes of amplitudes, so its degree is at most \(2T\). On Boolean inputs, any power \(z_i^k\) with \(k\geq1\) equals \(z_i\), so the polynomial can be taken to be multilinear.

The approximate degree of a Boolean function is the least degree of a real polynomial that approximates it, within a fixed error below one half, on every Boolean input. An algorithm with bounded error yields such a polynomial of degree at most \(2T\), so its number of queries is at least half the approximate degree.

Proving that OR has approximate degree of order \(\sqrt N\) needs an argument from approximation theory, beyond this short derivation. Together with the polynomial representation, that theorem gives the lower bound for detecting a marked item. Neither follows from the observation that known algorithms are slow.

Queries can increase polynomial degreeStarting from amplitudes independent of hidden input bits, each Boolean query raises their degree by at most one. Squaring magnitudes gives the factor of two for acceptance probabilities. A query algorithm alternates input-independent unitaries U0, U1, …, UT with T queries O_x, then measures. Below each stage is the largest possible degree of the amplitudes as polynomials in the input bits: 0 at the start, rising by at most one at each query and unchanged by each U. The acceptance probability, a sum of squared magnitudes, has degree at most 2T.Queries can increase polynomial degreeU₀O_xU₁O_xO_xU_Tmeasure⋯0≤1≤1≤2≤ T≤ T|0⟩degreequery: amplitude times (−1)^(xᵢ)=1−2xᵢ, degree +1 at mostUₖ: fixed linear mix, degree unchangedacceptance probability Σ|α_z|²: each square doubles the degree, so ≤2T
Starting from amplitudes independent of hidden input bits, each Boolean query raises their degree by at most one. Squaring magnitudes gives the factor of two for acceptance probabilities.
Problems
  1. With two hidden bits and the query \(\ket{i,b}\mapsto\ket{i,b\oplus z_i}\), start from \(\ket{1,0}\). Write the amplitudes after one query as polynomials in \(z_1,z_2\).

    Show solutionHide solution

    The query gives \(\ket{1,z_1}\): the amplitude of \(\ket{1,0}\) is \(1-z_1\), and that of \(\ket{1,1}\) is \(z_1\). Both have degree \(1\).

  2. Use \(z_i^2=z_i\) on Boolean inputs to reduce \(z_1^2z_2+z_1z_2^2\) to a multilinear polynomial.

    Show solutionHide solution

    Each term becomes \(z_1z_2\), giving \(2z_1z_2\).

  3. Write the parity of two bits, \(z_1\oplus z_2\), as a real polynomial, and show that its degree is \(2\). What lower bound on queries does this give for an exact algorithm, and is it achieved?

    Show solutionHide solution

    \(z_1\oplus z_2=z_1+z_2-2z_1z_2\), which takes the values \(0,1,1,0\) on the four inputs and has degree \(2\). An exact algorithm’s acceptance probability has degree at most \(2T\), so \(2T\geq2\) and \(T\geq1\). Deutsch’s algorithm computes \(f(0)\oplus f(1)\) with one query, so the bound is achieved.

Search this book

Search all chapters and appendices.