Quantum Computation & Cryptography · Lecture 5

Lecture 5
Multiple Qubits: Tensor Products and Entanglement

Week 3  |  two qubits live in C4, and most of C4 is entangled  |  reading: Watrous §2.1–2.2

Cartoon: two halves of a torn ticketTwo stick figures stand far apart. Each holds up one half of a ticket torn in two with a jagged edge. A speech bubble over the left figure says: my half tells you nothing on its own. A caption under the ticket halves says: the whole is not the sum of its halves. my half tells you nothingon its own. the whole is not the sum of its halves
an entangled pair has a definite joint state, but neither qubit has a state of its own
In this lecture
  1. Two qubits
  2. The tensor product
  3. Which qubit is which: the ordering convention
  4. Product states and entangled states
  5. The singular value decomposition
  6. The Schmidt decomposition: how entangled?
  7. n qubits and the memory wall
  8. Try it in code
  9. Summary and exercises

So far we have studied one qubit at a time. Every interesting quantum computation uses many, and the way qubits combine is where quantum information parts company with classical information for good. By the end of this lecture you should be able to build multi-qubit states and gates with the tensor product, read Qiskit's qubit labels without getting them backwards, decide whether a two-qubit state is entangled, measure how entangled it is, and explain why a laptop cannot simulate 50 qubits.

1 — Two qubits

Two classical bits have four possible values, \(00,01,10,11\). A probabilistic pair of bits is a probability vector with four entries, one per value. The quantum version replaces probabilities by amplitudes, exactly as in Lecture 3.

definition 5.1 — two-qubit state

The state of two qubits is a unit vector in \(\mathbb C^4\),

$$|\psi\rangle=c_{00}|00\rangle+c_{01}|01\rangle+c_{10}|10\rangle+c_{11}|11\rangle,\qquad \sum_{i,j}|c_{ij}|^2=1 ,$$

where the computational basis \(|00\rangle,|01\rangle,|10\rangle,|11\rangle\) is the standard basis \(e_0,e_1,e_2,e_3\) of \(\mathbb C^4\), in that order. Measuring both qubits gives the two-bit outcome \(ij\) with probability \(|c_{ij}|^2\) (the Born rule), and leaves the state \(|ij\rangle\).

Nothing new is needed yet: this is Lecture 3's definition with four outcomes instead of two. For example, measuring \(|\psi\rangle=\tfrac12|00\rangle+\tfrac{i}{2}|01\rangle-\tfrac{1}{\sqrt2}|11\rangle\) gives \(00\) and \(01\) with probability \(\tfrac14\) each, \(10\) never, and \(11\) with probability \(\tfrac12\). The new questions are structural. How do the two single-qubit descriptions fit together into one vector? And can every vector in \(\mathbb C^4\) be split back into two single-qubit states? The first question is answered by the tensor product; the answer to the second is no, and the states that cannot be split are the entangled ones.

Both qubits of \(|\psi\rangle=\tfrac13\big(2|00\rangle+|01\rangle-2i|11\rangle\big)\) are measured. What is the probability that the two bits agree?

The bits agree for the outcomes \(00\) and \(11\). Add their probabilities \(|c_{00}|^2+|c_{11}|^2\), and remember that \(|-2i|^2=4\).
\(P(00)+P(11)=\tfrac49+\tfrac49=\tfrac89\); the remaining \(\tfrac19\) is the outcome \(01\).

2 — The tensor product

If the first qubit is in \(|a\rangle=a_0|0\rangle+a_1|1\rangle\) and the second, independently, is in \(|b\rangle=b_0|0\rangle+b_1|1\rangle\), the amplitude of the joint outcome \(ij\) should be the product \(a_ib_j\), just as independent probabilities multiply. That is the whole definition.

definition 5.2 — tensor product of vectors

For \(a\in\mathbb C^2\) and \(b\in\mathbb C^2\), the tensor product (or Kronecker product) is the vector in \(\mathbb C^4\)

$$|a\rangle\otimes|b\rangle=\begin{pmatrix}a_0\\[2pt] a_1\end{pmatrix}\otimes\begin{pmatrix}b_0\\[2pt] b_1\end{pmatrix}=\begin{pmatrix}a_0\,b\\[2pt] a_1\,b\end{pmatrix}=\begin{pmatrix}a_0b_0\\[2pt] a_0b_1\\[2pt] a_1b_0\\[2pt] a_1b_1\end{pmatrix}.$$

We abbreviate \(|a\rangle\otimes|b\rangle\) as \(|a\rangle|b\rangle\) or \(|ab\rangle\). In particular \(|i\rangle\otimes|j\rangle=|ij\rangle\): the basis vectors of \(\mathbb C^4\) are tensor products of basis vectors of \(\mathbb C^2\). The same rule, "each entry of the left factor times the whole right factor", defines \(a\otimes b\) for vectors of any lengths \(m\) and \(n\), giving a vector of length \(mn\).

Let \(|a\rangle=0.6|0\rangle+0.8|1\rangle\). Find the amplitudes \(c_{01}\) and \(c_{10}\) of \(|a\rangle\otimes|-\rangle\).

\(c_{ij}=a_i\,b_j\), where the first digit belongs to the left factor. Here \(b=\tfrac1{\sqrt2}(1,\,-1)\).
\(c_{01}=a_0b_1=-\tfrac{0.6}{\sqrt2}\approx-0.424\) and \(c_{10}=a_1b_0=\tfrac{0.8}{\sqrt2}\approx0.566\). Mixing up the factors would swap which amplitude carries the minus sign.
example 5.1 — order matters

Compute \(|+\rangle\otimes|0\rangle\) and \(|0\rangle\otimes|+\rangle\).

$$|+\rangle\otimes|0\rangle=\frac{1}{\sqrt2}\begin{pmatrix}1\\[2pt] 0\\[2pt] 1\\[2pt] 0\end{pmatrix}=\frac{|00\rangle+|10\rangle}{\sqrt2},$$ $$|0\rangle\otimes|+\rangle=\frac{1}{\sqrt2}\begin{pmatrix}1\\[2pt] 1\\[2pt] 0\\[2pt] 0\end{pmatrix}=\frac{|00\rangle+|01\rangle}{\sqrt2}.$$

The two answers are different vectors: the tensor product is not commutative. In the first, the left qubit is in superposition and the right one is definitely 0; in the second it is the other way round. Keeping track of which factor is which qubit is the subject of Section 3.

Gates on two qubits are \(4\times4\) unitaries. When a gate \(A\) acts on the left qubit and \(B\) on the right one, the combined matrix is their tensor product, defined by the same "entry times whole block" rule.

definition 5.3 — tensor product of matrices

For \(2\times2\) matrices \(A=(a_{ij})\) and \(B\),

$$A\otimes B=\begin{pmatrix}a_{00}B & a_{01}B\\[2pt] a_{10}B & a_{11}B\end{pmatrix},$$

a \(4\times4\) matrix made of four \(2\times2\) blocks. Its entry in row \(ik\), column \(jl\) is \(a_{ij}b_{kl}\).

The Kronecker product H tensor I built block by blockLeft: the 2 by 2 matrix H with entries 1, 1, 1, -1 times 1/sqrt(2). Middle: the 2 by 2 identity I. Right: the 4 by 4 matrix H tensor I, made of four 2 by 2 blocks, each block equal to one entry of H times I. The top-left, top-right and bottom-left blocks are I/sqrt(2); the bottom-right block is -I/sqrt(2). Row and column labels read |00>, |01>, |10>, |11>.H (times 1/sqrt2)111-1(x)I1001=H (x) I (times 1/sqrt2)|00>|00>1010|01>|01>0101|10>|10>10-10|11>|11>010-1each entry h_ij of H becomes the block h_ij I
The Kronecker product \(H\otimes I\), block by block. Each entry of \(H\) (coloured) becomes a whole \(2\times2\) block, equal to that entry times \(I\). The thick lines separate the blocks; rows and columns are labelled by the basis states \(|00\rangle,\dots,|11\rangle\).

Reading off the figure,

$$H\otimes I=\frac{1}{\sqrt2}\begin{pmatrix}1&0&1&0\\[2pt] 0&1&0&1\\[2pt] 1&0&-1&0\\[2pt] 0&1&0&-1\end{pmatrix},\qquad (H\otimes I)|00\rangle=\frac{1}{\sqrt2}\begin{pmatrix}1\\[2pt] 0\\[2pt] 1\\[2pt] 0\end{pmatrix}=|+\rangle|0\rangle .$$

The first column of the matrix is the image of \(|00\rangle\), and it says what we expected: \(H\) turned the left qubit into \(|+\rangle\) and \(I\) left the right one alone. Proposition 5.1 makes this "each factor acts on its own qubit" rule official.

proposition 5.1 — rules for tensor products

For vectors \(a,b,c,d\), matrices \(A,B,C,D\) of matching sizes and scalars \(\lambda\):

  1. Bilinearity. \((a+c)\otimes b=a\otimes b+c\otimes b\), \(a\otimes(b+d)=a\otimes b+a\otimes d\), and \((\lambda a)\otimes b=a\otimes(\lambda b)=\lambda(a\otimes b)\).
  2. Acting factor by factor. \((A\otimes B)(a\otimes b)=Aa\otimes Bb\), and more generally \((A\otimes B)(C\otimes D)=AC\otimes BD\).
  3. Inner products multiply. \(\langle a\otimes b\,|\,c\otimes d\rangle=\langle a|c\rangle\,\langle b|d\rangle\).
  4. Adjoints. \((A\otimes B)^\dagger=A^\dagger\otimes B^\dagger\). Consequently, if \(U\) and \(V\) are unitary then so is \(U\otimes V\).

Every rule is a one-line index computation, so we do one of them in full. The entry of \(a\otimes b\) in position \(ik\) is \(a_ib_k\), so

$$\langle a\otimes b\,|\,c\otimes d\rangle=\sum_{i,k}\overline{a_ib_k}\;c_id_k=\Big(\sum_i\overline{a_i}\,c_i\Big)\Big(\sum_k\overline{b_k}\,d_k\Big)=\langle a|c\rangle\,\langle b|d\rangle .$$

In particular \(\|a\otimes b\|=\|a\|\,\|b\|\): a tensor product of two unit vectors is again a unit vector, so \(|a\rangle|b\rangle\) is a legitimate two-qubit state. Rule 2 is the same kind of computation with one more index (it is also HW3 practice), and the last claim of rule 4 follows from rules 2 and 4 together: \((U\otimes V)^\dagger(U\otimes V)=U^\dagger U\otimes V^\dagger V=I\otimes I=I\).

idea — a gate on one qubit is a tensor product with the identity

To apply \(U\) to one qubit of a pair and do nothing to the other, use \(U\otimes I\) or \(I\otimes U\), depending on which factor is that qubit. By rule 2, \((U\otimes I)(|a\rangle|b\rangle)=U|a\rangle\,|b\rangle\), and by linearity this extends to every two-qubit state, entangled or not. Two gates on different qubits commute, because \((U\otimes I)(I\otimes V)=U\otimes V=(I\otimes V)(U\otimes I)\). That is why a circuit diagram can draw them in either order.

\((X\otimes H)\big(|0\rangle\otimes|1\rangle\big)\) equals .

Proposition 5.1(2): \((A\otimes B)(a\otimes b)=Aa\otimes Bb\). Apply \(X\) to \(|0\rangle\) and \(H\) to \(|1\rangle\).
\(X|0\rangle=|1\rangle\) and \(H|1\rangle=|-\rangle\), so the result is \(|1\rangle\otimes|-\rangle\). Each factor acts on its own qubit.

3 — Which qubit is which: the ordering convention

Definition 5.2 attaches the left tensor factor to the leftmost symbol in a ket, so in \(|ij\rangle\) the digit \(i\) belongs to the left factor. What remains is a naming decision: which physical qubit is the left factor? Textbooks, including Nielsen–Chuang, usually make the first-listed qubit the leftmost digit. Qiskit makes the opposite choice, and since we check everything in Qiskit, this course uses Qiskit's convention throughout.

definition 5.4 — ordering convention (Qiskit, little-endian)

For qubits numbered \(0,1,\dots,n-1\), basis states are written with qubit 0 on the right:

$$|q_{n-1}\cdots q_1\,q_0\rangle=|q_{n-1}\rangle\otimes\cdots\otimes|q_1\rangle\otimes|q_0\rangle .$$

The basis state \(|q_{n-1}\cdots q_0\rangle\) is standard basis vector number \(\sum_k q_k2^k\), the usual binary value of the bit string. In particular, a gate \(U\) on qubit 0 of a pair is \(I\otimes U\), and a gate on qubit 1 is \(U\otimes I\).

Qubit ordering: the top wire is qubit 0 but its bit is written on the rightA three-qubit circuit with wires labelled q0 at the top, q1 in the middle and q2 at the bottom. An X gate acts on q0 only. The output ket is written |q2 q1 q0> = |001>: qubit 0 is the rightmost bit, and the basis state's index is 4 q2 + 2 q1 + q0 = 1.q0|0>q1|0>q2|0>Xoutput ket, written |q2 q1 q0>:|0q20q11q0>q0 is the rightmost bitindex = 4 q2 + 2 q1 + q0 = 1
In a Qiskit circuit diagram, qubit 0 is the top wire, but its bit is written at the right-hand end of the ket. Flipping qubit 0 of \(|000\rangle\) gives \(|001\rangle\), which is basis vector number 1.

The name "little-endian" is borrowed from computer memory: the least significant bit comes first in the numbering (qubit 0 is the ones place), and is printed last. Once you accept that qubit \(k\) is the \(2^k\) place of a binary number, everything is consistent. The widget below lets you practise until it is automatic.

Three qubits start in \(|000\rangle\) and a Qiskit circuit applies x(2). The resulting ket is , which is standard basis vector number .

Definition 5.4: qubit \(k\) is the \(2^k\) place, written \(k\) positions from the right.
Qubit 2 is the leftmost digit and the \(2^2\) place, so the state is \(|100\rangle\), vector number 4.

Ordering decoder

Toggle an \(X\) gate on each of three qubits that start in \(|0\rangle\). The circuit is drawn Qiskit-style (qubit 0 on top). The panel shows the output ket in \(|q_2q_1q_0\rangle\) order, its index in the state vector, the label Qiskit prints, and the eight amplitudes.

example 5.2 — the same gate on different qubits

On two qubits starting in \(|00\rangle\), compare \(X\) on qubit 0 with \(X\) on qubit 1. Then read the state \(\tfrac{1}{\sqrt2}(|00\rangle+|10\rangle)\) in Qiskit terms: which qubit is in superposition?

\(X\) on qubit 0 is \(I\otimes X\), and \((I\otimes X)|0\rangle|0\rangle=|0\rangle|1\rangle=|01\rangle\), basis vector number 1. \(X\) on qubit 1 is \(X\otimes I\), giving \(|10\rangle\), basis vector number 2.

For the second part, factor out: \(\tfrac{1}{\sqrt2}(|00\rangle+|10\rangle)=\tfrac{1}{\sqrt2}(|0\rangle+|1\rangle)\otimes|0\rangle=|+\rangle\otimes|0\rangle\). The left factor is qubit 1, so qubit 1 is in \(|+\rangle\) and qubit 0 is in \(|0\rangle\). In Qiskit this state comes from qc.h(1), not qc.h(0). Notice that factoring the ket never depends on the convention; only the names of the factors do.

idea — three habits that prevent ordering bugs

(1) When you write a ket by hand, write the qubit names above the digits, \(|\overset{q_1}{0}\,\overset{q_0}{1}\rangle\), until you no longer need to. (2) When comparing with a textbook, check its convention first; reversing every bit string converts one convention to the other. (3) When a Qiskit result looks wrong, test the ordering on a basis state: prepare \(|0\cdots01\rangle\) with a single x(0) and print it.

4 — Product states and entangled states

Section 2 built two-qubit states out of one-qubit states. The central question of this lecture is whether every two-qubit state arises that way.

definition 5.5 — product state, entangled state

A two-qubit state \(|\psi\rangle\) is a product state if \(|\psi\rangle=|a\rangle\otimes|b\rangle\) for some single-qubit states \(|a\rangle,|b\rangle\). Otherwise \(|\psi\rangle\) is entangled.

A product state is a pair of qubits, each with a state of its own. An entangled state is a single object: it describes the pair perfectly, yet (as Lecture 18 will make precise) neither qubit has a pure state of its own. The first example shows that entangled states exist.

proposition 5.2 — the singlet is entangled

The state \(|\Psi^-\rangle=\tfrac{1}{\sqrt2}(|01\rangle-|10\rangle)\) is not a product state.

Suppose \(|\Psi^-\rangle=(a_0|0\rangle+a_1|1\rangle)\otimes(b_0|0\rangle+b_1|1\rangle)\). Expanding the right-hand side with Definition 5.2 and comparing the four amplitudes gives

$$a_0b_0=0,\qquad a_0b_1=\tfrac{1}{\sqrt2},\qquad a_1b_0=-\tfrac{1}{\sqrt2},\qquad a_1b_1=0 .$$

The second equation forces \(a_0\neq0\), and then the first forces \(b_0=0\). But then \(a_1b_0=0\), contradicting the third equation. So no such factors exist.

The proof worked by trying to solve for the factors and failing. A cleaner test comes from arranging the four amplitudes in a square.

definition 5.6 — coefficient matrix

The coefficient matrix of \(|\psi\rangle=\sum_{i,j}c_{ij}|ij\rangle\) is the \(2\times2\) matrix

$$C=\begin{pmatrix}c_{00}&c_{01}\\[2pt] c_{10}&c_{11}\end{pmatrix},$$

whose rows are indexed by the left qubit (\(q_1\)) and columns by the right qubit (\(q_0\)). Its entries are the state vector read in order, two at a time.

theorem 5.3 — the determinant test

A two-qubit state is a product state if and only if \(\det C=0\), that is, \(c_{00}c_{11}=c_{01}c_{10}\).

(\(\Rightarrow\)) If \(|\psi\rangle=|a\rangle\otimes|b\rangle\) then \(c_{ij}=a_ib_j\), so \(C=a\,b^{\mathsf T}\) is an outer product of two vectors, and

$$\det C=a_0b_0\,a_1b_1-a_0b_1\,a_1b_0=0 .$$

(\(\Leftarrow\)) Suppose \(\det C=0\). Since \(|\psi\rangle\neq0\), some row of \(C\) is nonzero; call it \(w^{\mathsf T}\). A \(2\times2\) matrix with zero determinant has linearly dependent rows, so each row is a multiple of \(w^{\mathsf T}\), say row \(i\) equals \(\lambda_iw^{\mathsf T}\). Then \(C=\lambda\,w^{\mathsf T}\), which means \(c_{ij}=\lambda_iw_j\) and \(|\psi\rangle=|\lambda\rangle\otimes|w\rangle\) with \(|\lambda\rangle=\lambda_0|0\rangle+\lambda_1|1\rangle\) and \(|w\rangle=w_0|0\rangle+w_1|1\rangle\). Finally rescale: \(\|\lambda\|\,\|w\|=\||\psi\rangle\|=1\), so \(|\lambda\rangle/\|\lambda\|\) and \(\|\lambda\|\,|w\rangle\) are unit vectors with the same tensor product.

Tick every product state.

Theorem 5.3: write the coefficient matrix and check whether \(c_{00}c_{11}=c_{01}c_{10}\).
The first is \(|-\rangle\otimes|-\rangle\) and the fourth is \(|0\rangle\otimes|{+i}\rangle\); both have \(\det C=0\). The other three have nonzero determinants and are entangled.
example 5.3 — three quick verdicts

Decide which of these are product states, and factor the ones that are:

$$\begin{aligned}|\alpha\rangle&=\tfrac12\big(|00\rangle+|01\rangle+|10\rangle+|11\rangle\big),\\[2pt] |\beta\rangle&=\tfrac12\big(|00\rangle+|01\rangle+|10\rangle-|11\rangle\big),\\[2pt] |\Phi^+\rangle&=\tfrac{1}{\sqrt2}\big(|00\rangle+|11\rangle\big).\end{aligned}$$

The coefficient matrices and determinants are

$$C_\alpha=\frac12\begin{pmatrix}1&1\\[2pt] 1&1\end{pmatrix},\quad C_\beta=\frac12\begin{pmatrix}1&1\\[2pt] 1&-1\end{pmatrix},\quad C_{\Phi^+}=\frac{1}{\sqrt2}\begin{pmatrix}1&0\\[2pt] 0&1\end{pmatrix},$$ $$\det C_\alpha=\tfrac14(1-1)=0,\quad \det C_\beta=\tfrac14(-1-1)=-\tfrac12,\quad \det C_{\Phi^+}=\tfrac12 .$$

So \(|\alpha\rangle\) is a product state, and the proof of Theorem 5.3 finds the factors: both rows are \(\tfrac12(1,1)\), so \(|\alpha\rangle=|+\rangle\otimes|+\rangle\). The other two are entangled. Notice how little separates \(|\alpha\rangle\) from \(|\beta\rangle\): one sign. Entanglement is not about how many terms a state has; it is about whether the amplitudes factor.

The Bell state \(|\Phi^+\rangle\) in Example 5.3 is the standard entangled pair, and Lecture 6 shows how to make it with two gates. Measure both qubits and the outcomes are \(00\) or \(11\), each with probability \(\tfrac12\): each bit alone is a fair coin, yet the two always agree. Explore the determinant test with the widget.

Is it entangled?

Pick a preset or set four real amplitudes (they are normalised for you) and a phase on the \(|11\rangle\) amplitude. The panel shows the coefficient matrix \(C\), its determinant, the Schmidt coefficients of Section 6 and the entanglement entropy. For a product state it also shows the two factors.

crypto connection — entanglement as a key source

In the E91 protocol (Lecture 20) Alice and Bob each hold one qubit of many \(|\Phi^+\rangle\) pairs. Measuring in the same basis gives identical random bits: a shared key that neither of them chose. The security argument rests on a property of pure entangled states that we will prove with density matrices in Lecture 18: if Alice and Bob can verify that their pairs really are in the pure state \(|\Phi^+\rangle\), then the state of the whole universe factors as (their pair) \(\otimes\) (everything else), so no eavesdropper can be correlated with their bits. Entanglement is monogamous.

5 — The singular value decomposition

The determinant test is a yes/no answer. Both \(|\Phi^+\rangle\) and the slightly lopsided state \(\sqrt{0.99}\,|00\rangle+\sqrt{0.01}\,|11\rangle\) are entangled, but the second is almost the product state \(|00\rangle\). To measure how entangled a state is, we need a tool that most first courses in linear algebra skip: the singular value decomposition. This section develops it from scratch for \(2\times2\) matrices, which is all we need; everything works the same way for any size.

Lecture 2's spectral theorem diagonalises a Hermitian matrix \(M\) using one orthonormal basis: \(M=\sum_k\lambda_k|e_k\rangle\langle e_k|\). A coefficient matrix \(C\) is usually not Hermitian, or even diagonalisable by a unitary. The SVD fixes this by allowing two orthonormal bases, one for the inputs of \(C\) and one for its outputs.

theorem 5.4 — singular value decomposition

For every complex \(2\times2\) matrix \(C\) there are orthonormal bases \(\{|w_1\rangle,|w_2\rangle\}\) and \(\{|u_1\rangle,|u_2\rangle\}\) of \(\mathbb C^2\) and numbers \(s_1\ge s_2\ge0\) such that

$$\begin{aligned}&C\,|w_k\rangle=s_k\,|u_k\rangle\quad(k=1,2),\\[4pt] &\text{equivalently}\quad C=s_1|u_1\rangle\langle w_1|+s_2|u_2\rangle\langle w_2| .\end{aligned}$$

The \(s_k\) are the singular values of \(C\), the \(|w_k\rangle\) are its right singular vectors and the \(|u_k\rangle\) its left singular vectors. The singular values are unique: \(s_1^2\) and \(s_2^2\) are the eigenvalues of \(C^\dagger C\). In matrix form, \(C=U\Sigma W\) where \(U\) is the unitary with columns \(|u_k\rangle\), \(\Sigma=\mathrm{diag}(s_1,s_2)\), and \(W\) is the unitary with rows \(\langle w_k|\).

The proof is a recipe, and it is how you compute an SVD by hand.

Step 1. The matrix \(C^\dagger C\) is Hermitian, since \((C^\dagger C)^\dagger=C^\dagger C\). Its eigenvalues are nonnegative: if \(C^\dagger C|x\rangle=\lambda|x\rangle\) with \(\|x\|=1\), then \(\lambda=\langle x|C^\dagger C|x\rangle=\|Cx\|^2\ge0\). By the spectral theorem (Lecture 2) it has orthonormal eigenvectors \(|w_1\rangle,|w_2\rangle\) with eigenvalues \(\lambda_1\ge\lambda_2\ge0\).

Step 2. Put \(s_k=\sqrt{\lambda_k}\).

Step 3. For each \(s_k>0\) put \(|u_k\rangle=C|w_k\rangle/s_k\). These are orthonormal:

$$\langle u_j|u_k\rangle=\frac{\langle w_j|C^\dagger C|w_k\rangle}{s_js_k}=\frac{\lambda_k\langle w_j|w_k\rangle}{s_js_k}=\begin{cases}1,&j=k\\ 0,&j\ne k.\end{cases}$$

If \(s_2=0\), then \(\|Cw_2\|^2=\lambda_2=0\), so \(C|w_2\rangle=0\), and we may take \(|u_2\rangle\) to be any unit vector orthogonal to \(|u_1\rangle\). (If \(C=0\), both singular values are 0 and any orthonormal bases work.)

Step 4. Both sides of \(C=\sum_k s_k|u_k\rangle\langle w_k|\) send \(|w_j\rangle\) to \(s_j|u_j\rangle\). Two linear maps that agree on a basis are equal. Uniqueness of the \(s_k\): from the formula, \(C^\dagger C=\sum_k s_k^2|w_k\rangle\langle w_k|\), so the \(s_k^2\) are its eigenvalues.

Geometrically, the SVD says that every matrix is a rotation, then a stretch along the axes, then another rotation (rotations possibly combined with a reflection or phases). Real \(2\times2\) matrices can be drawn: \(C\) maps the unit circle to an ellipse whose semi-axes are \(s_1|u_1\rangle\) and \(s_2|u_2\rangle\). So \(s_1\) is the largest factor by which \(C\) stretches any unit vector, \(s_2\) the smallest, and \(s_1s_2=|\det C|\) is the factor by which \(C\) scales areas.

Find the singular values of \(M=\begin{pmatrix}0&3\\ -2&0\end{pmatrix}\).

Compute \(M^{\mathsf T}M\) first; the singular values are the square roots of its eigenvalues, listed largest first. They are not the eigenvalues of \(M\).
\(M^{\mathsf T}M=\mathrm{diag}(4,9)\), so \(s_1=3\) and \(s_2=2\). The eigenvalues of \(M\) are \(\pm i\sqrt6\), which are not even real. Check: \(s_1s_2=6=|\det M|\).
The SVD of A = [[3,0],[4,5]] as rotate, stretch, rotateFour panels. Panel 1: the unit circle with the right singular vectors w1 = (1,1)/sqrt2 and w2 = (-1,1)/sqrt2; a highlighted quarter arc runs from (1,0) to (0,1). Panel 2: after W, a rotation by -45 degrees, w1 and w2 land on the coordinate axes and the circle is unchanged. Panel 3: after Sigma the circle is stretched into an axis-aligned ellipse with semi-axes 3 sqrt5 = 6.71 and sqrt5 = 2.24. Panel 4: after U, a rotation, the ellipse is tilted, with semi-axes s1 u1 along (1,3) and s2 u2 along (-3,1). Panel 4 is exactly the image of the unit circle under A. Panels 3 and 4 are drawn at one seventh of the scale of panels 1 and 2.unit circlew1w2Wafter W: rotatee1e2Sigmaafter Sigma: stretchs1 e1s2 e2Uafter U: rotates1 u1s2 u2A = U Sigma W: the unit circle becomes an ellipse with semi-axes s1 u1 and s2 u2
The SVD of the matrix \(A\) of Example 5.4, applied to the unit circle one factor at a time. \(W\) rotates the right singular vectors onto the axes, \(\Sigma\) stretches by \(s_1=3\sqrt5\) and \(s_2=\sqrt5\), and \(U\) rotates the axes onto the left singular vectors. The amber arc (the first quadrant of the circle) shows where each point goes. The last two panels are drawn at \(1/7\) of the scale of the first two.
example 5.4 — an SVD by hand

Find the SVD of

$$A=\begin{pmatrix}3&0\\[2pt] 4&5\end{pmatrix}.$$

Step 1. \(A\) is real, so \(A^\dagger=A^{\mathsf T}\) and

$$A^{\mathsf T}A=\begin{pmatrix}3&4\\[2pt] 0&5\end{pmatrix}\begin{pmatrix}3&0\\[2pt] 4&5\end{pmatrix}=\begin{pmatrix}25&20\\[2pt] 20&25\end{pmatrix}.$$

Its characteristic polynomial is \((25-\lambda)^2-400\), so \(25-\lambda=\pm20\) and \(\lambda_1=45\), \(\lambda_2=5\). The eigenvectors are

$$|w_1\rangle=\frac{1}{\sqrt2}\begin{pmatrix}1\\[2pt] 1\end{pmatrix}\ (\lambda_1=45),\qquad |w_2\rangle=\frac{1}{\sqrt2}\begin{pmatrix}-1\\[2pt] 1\end{pmatrix}\ (\lambda_2=5).$$

Step 2. \(s_1=\sqrt{45}=3\sqrt5\approx6.708\) and \(s_2=\sqrt5\approx2.236\).

Step 3. Apply \(A\) and divide:

$$|u_1\rangle=\frac{A|w_1\rangle}{s_1}=\frac{1}{3\sqrt5}\cdot\frac{1}{\sqrt2}\begin{pmatrix}3\\[2pt] 9\end{pmatrix}=\frac{1}{\sqrt{10}}\begin{pmatrix}1\\[2pt] 3\end{pmatrix},$$ $$|u_2\rangle=\frac{A|w_2\rangle}{s_2}=\frac{1}{\sqrt5}\cdot\frac{1}{\sqrt2}\begin{pmatrix}-3\\[2pt] 1\end{pmatrix}=\frac{1}{\sqrt{10}}\begin{pmatrix}-3\\[2pt] 1\end{pmatrix}.$$

They are orthogonal, as the proof promised: \(1\cdot(-3)+3\cdot1=0\).

Step 4. Assemble:

$$A=\underbrace{\frac{1}{\sqrt{10}}\begin{pmatrix}1&-3\\[2pt] 3&1\end{pmatrix}}_{U}\;\underbrace{\begin{pmatrix}3\sqrt5&0\\[2pt] 0&\sqrt5\end{pmatrix}}_{\Sigma}\;\underbrace{\frac{1}{\sqrt2}\begin{pmatrix}1&1\\[2pt] -1&1\end{pmatrix}}_{W}.$$

Multiplying out confirms it. Two checks worth making every time: \(s_1s_2=15=|\det A|\), and \(s_1^2+s_2^2=50\), the sum of the squares of all four entries of \(A\) (because both equal \(\mathrm{tr}\,A^{\mathsf T}A\)).

Notice that the eigenvalues of \(A\) are 3 and 5 (it is triangular), which are not its singular values. Eigenvalues describe vectors that \(A\) maps to multiples of themselves; singular values describe how much \(A\) stretches, and they need two different bases.

example 5.5 — a complex coefficient matrix

Find the SVD of the coefficient matrix of

$$|\psi\rangle=\frac{1}{\sqrt{10}}\big(2|00\rangle+i|01\rangle+2i|10\rangle+|11\rangle\big).$$

Reading the amplitudes two at a time (Definition 5.6),

$$C=\frac{1}{\sqrt{10}}\begin{pmatrix}2&i\\[2pt] 2i&1\end{pmatrix},\qquad C^\dagger=\frac{1}{\sqrt{10}}\begin{pmatrix}2&-2i\\[2pt] -i&1\end{pmatrix}.$$

Step 1. Multiply carefully, remembering \((-2i)(2i)=4\) and \((-i)(i)=1\):

$$C^\dagger C=\frac{1}{10}\begin{pmatrix}4+4&2i-2i\\[2pt] -2i+2i&1+1\end{pmatrix}=\begin{pmatrix}\tfrac45&0\\[2pt] 0&\tfrac15\end{pmatrix}.$$

It is already diagonal, so \(|w_1\rangle=|0\rangle\) and \(|w_2\rangle=|1\rangle\), with \(\lambda_1=\tfrac45\) and \(\lambda_2=\tfrac15\).

Step 2. \(s_1=\tfrac{2}{\sqrt5}\approx0.894\) and \(s_2=\tfrac{1}{\sqrt5}\approx0.447\).

Step 3. The columns of \(C\) are \(C|0\rangle\) and \(C|1\rangle\), so

$$|u_1\rangle=\frac{\sqrt5}{2}\cdot\frac{1}{\sqrt{10}}\begin{pmatrix}2\\[2pt] 2i\end{pmatrix}=\frac{1}{\sqrt2}\begin{pmatrix}1\\[2pt] i\end{pmatrix}=|{+i}\rangle,$$ $$|u_2\rangle=\sqrt5\cdot\frac{1}{\sqrt{10}}\begin{pmatrix}i\\[2pt] 1\end{pmatrix}=\frac{i}{\sqrt2}\begin{pmatrix}1\\[2pt] -i\end{pmatrix}=i\,|{-i}\rangle .$$

Step 4. So \(C=\tfrac{2}{\sqrt5}\,|{+i}\rangle\langle0|+\tfrac{1}{\sqrt5}\,i|{-i}\rangle\langle1|\). The checks: \(s_1s_2=\tfrac25=|\det C|\), since \(\det C=\tfrac{1}{10}(2-i\cdot2i)=\tfrac{4}{10}\); and \(s_1^2+s_2^2=1\), as it must be for a state. We will read off what this says about \(|\psi\rangle\) in the next section.

idea — the SVD by hand, in one line each

(1) Compute \(C^\dagger C\) and find its eigenvalues \(\lambda_1\ge\lambda_2\) and orthonormal eigenvectors \(|w_1\rangle,|w_2\rangle\). (2) Take square roots: \(s_k=\sqrt{\lambda_k}\). (3) Set \(|u_k\rangle=C|w_k\rangle/s_k\). (4) Check \(s_1s_2=|\det C|\) and \(s_1^2+s_2^2=\sum|c_{ij}|^2\). For a \(2\times2\) matrix the eigenvalues in step 1 come straight from the trace and determinant: \(\lambda^2-\mathrm{tr}(C^\dagger C)\,\lambda+|\det C|^2=0\). In numpy, U, s, W = np.linalg.svd(C) returns the three factors with \(C = U\Sigma W\); its vectors may differ from yours by signs or phases (see the code below), but the \(s_k\) always agree.

SVD explorer

Set the four entries of a real \(2\times2\) matrix. Left: the unit circle and the right singular vectors \(w_1\) (blue) and \(w_2\) (red). Right: its image, an ellipse, with \(s_1u_1\) and \(s_2u_2\) along the semi-axes. The amber dot is \((1,0)\) and its image. Try a rotation (both singular values 1), a shear, and a rank-one matrix (the ellipse collapses to a segment).

tool — checking Example 5.4 with numpy
import numpy as np

A = np.array([[3, 0], [4, 5]])
U, s, W = np.linalg.svd(A)          # A = U @ diag(s) @ W
print(s.round(4))
print(U.round(4))
print(W.round(4))
print(np.allclose(U @ np.diag(s) @ W, A), np.linalg.eigvals(A))
[6.7082 2.2361]
[[-0.3162 -0.9487]
 [-0.9487  0.3162]]
[[-0.7071 -0.7071]
 [-0.7071  0.7071]]
True [5. 3.]

The singular values match. The second pair of singular vectors is ours exactly; the first pair is \(-|u_1\rangle\) and \(-\langle w_1|\). Flipping both signs of a pair changes nothing, because \((-|u\rangle)(-\langle w|)=|u\rangle\langle w|\). The last output confirms that the eigenvalues, 5 and 3, are different numbers.

6 — The Schmidt decomposition: how entangled?

Now apply the SVD to the coefficient matrix of a state. The result is the most useful normal form for two-part quantum states.

theorem 5.5 — Schmidt decomposition (two qubits)

Every two-qubit state can be written as

$$|\psi\rangle=s_1\,|u_1\rangle|v_1\rangle+s_2\,|u_2\rangle|v_2\rangle,$$

where \(\{|u_1\rangle,|u_2\rangle\}\) and \(\{|v_1\rangle,|v_2\rangle\}\) are orthonormal bases of \(\mathbb C^2\) and the Schmidt coefficients \(s_1\ge s_2\ge0\) are the singular values of \(C\). They satisfy \(s_1^2+s_2^2=1\) and \(|\det C|=s_1s_2\).

Write the SVD as \(C=\sum_k s_k|u_k\rangle\langle w_k|\). Entrywise, \(c_{ij}=\sum_k s_k\,(u_k)_i\,\overline{(w_k)_j}\). Substituting into \(|\psi\rangle=\sum_{i,j}c_{ij}|i\rangle|j\rangle\) and regrouping,

$$|\psi\rangle=\sum_k s_k\Big(\sum_i (u_k)_i|i\rangle\Big)\Big(\sum_j\overline{(w_k)_j}\,|j\rangle\Big)=\sum_k s_k\,|u_k\rangle|v_k\rangle ,$$

where \(|v_k\rangle=|\overline{w_k}\rangle\) is \(|w_k\rangle\) with its entries conjugated (for real \(w_k\) the two are the same). Conjugating entries preserves inner products up to conjugation, so the \(|v_k\rangle\) are orthonormal. Next, \(\sum_{i,j}|c_{ij}|^2=\mathrm{tr}(C^\dagger C)=s_1^2+s_2^2\), which is 1 for a state. Finally \(|\det C|^2=\det(C^\dagger C)=s_1^2s_2^2\).

For Example 5.5 this reads off immediately: the right singular vectors \(|0\rangle,|1\rangle\) are real, so

$$|\psi\rangle=\frac{2}{\sqrt5}\,|{+i}\rangle|0\rangle+\frac{1}{\sqrt5}\,\big(i|{-i}\rangle\big)|1\rangle ,$$

which you can confirm by expanding. The product state \(|+\rangle|-\rangle\), by contrast, has a coefficient matrix whose two rows are both \(\tfrac12(1,-1)\). It has rank one, its singular values are 1 and 0, and its Schmidt decomposition has a single term.

Theorem 5.5 contains Theorem 5.3: \(\det C=0\) exactly when \(s_2=0\), and then the decomposition has a single term, a product state. Because the Schmidt probabilities \(s_1^2,s_2^2\) add to 1, they measure how evenly the state is spread over its two terms. The standard way to turn them into one number is Shannon entropy.

definition 5.7 — entanglement entropy

The entanglement entropy of a two-qubit pure state with Schmidt coefficients \(s_1,s_2\) is

$$E(\psi)=-\,s_1^2\log_2 s_1^2-s_2^2\log_2 s_2^2\quad\text{bits},$$

with \(0\log 0=0\). It is 0 exactly for product states, and it reaches its maximum of 1 bit exactly when \(s_1=s_2=\tfrac{1}{\sqrt2}\), in which case the state is called maximally entangled.

By the AM–GM inequality, \(s_1s_2\le\tfrac12(s_1^2+s_2^2)=\tfrac12\), so \(|\det C|\le\tfrac12\) for every state, with equality exactly at maximal entanglement. The quantity \(2|\det C|\), which runs from 0 to 1, is called the concurrence of the (pure) state. For \(|\Phi^+\rangle\) and \(|\beta\rangle\) of Example 5.3, \(|\det C|=\tfrac12\): both are maximally entangled.

A two-qubit state has \(|\det C|=0.3\). Find its Schmidt probabilities \(s_1^2\ge s_2^2\).

You know \(s_1^2+s_2^2=1\) and \(s_1^2s_2^2=|\det C|^2=0.09\). So \(s_1^2\) and \(s_2^2\) are the roots of \(x^2-x+0.09=0\).
\(x=\tfrac{1\pm\sqrt{1-0.36}}{2}=\tfrac{1\pm0.8}{2}\), so \(s_1^2=0.9\) and \(s_2^2=0.1\). The concurrence is \(2|\det C|=0.6\).
example 5.6 — Schmidt forms of two entangled states

(a) Write \(|\beta\rangle=\tfrac12(|00\rangle+|01\rangle+|10\rangle-|11\rangle)\) in Schmidt form. (b) Find the Schmidt coefficients and entanglement entropy of \(|\gamma\rangle=\tfrac{1}{\sqrt3}(|00\rangle+|01\rangle+|10\rangle)\).

(a) The coefficient matrix is a multiple of the unitary \(H\):

$$C_\beta=\frac12\begin{pmatrix}1&1\\[2pt] 1&-1\end{pmatrix}=\frac{1}{\sqrt2}H=I\cdot\Big(\tfrac{1}{\sqrt2}I\Big)\cdot H ,$$

and the right-hand side is already an SVD. Both singular values are \(\tfrac{1}{\sqrt2}\), the \(u\)'s are the columns of \(I\), and the \(v\)'s are the rows of \(H\), namely \(|+\rangle\) and \(|-\rangle\):

$$|\beta\rangle=\frac{1}{\sqrt2}\Big(|0\rangle|+\rangle+|1\rangle|-\rangle\Big).$$

Expanding the right-hand side confirms it. \(E(\beta)=1\) bit: maximally entangled, like \(|\Phi^+\rangle\).

(b) Here

$$C_\gamma=\frac{1}{\sqrt3}\begin{pmatrix}1&1\\[2pt] 1&0\end{pmatrix}.$$

This matrix is real symmetric, so its singular values are the absolute values of its eigenvalues: if \(C=\sum_k\lambda_k|e_k\rangle\langle e_k|\) (spectral theorem), then \(C^{\mathsf T}C=\sum_k\lambda_k^2|e_k\rangle\langle e_k|\), so \(s_k=\sqrt{\lambda_k^2}=|\lambda_k|\). The eigenvalues of \(\sqrt3\,C_\gamma\) solve \(\lambda^2-\lambda-1=0\), so they are the golden ratio \(\varphi=\tfrac{1+\sqrt5}{2}\) and \(1-\varphi=-1/\varphi\). Hence

$$\begin{aligned}s_1&=\frac{\varphi}{\sqrt3}\approx 0.9342, & s_2&=\frac{\varphi-1}{\sqrt3}\approx 0.3568,\\[4pt] s_1^2&\approx0.8727, & s_2^2&\approx0.1273 .\end{aligned}$$

Check: \(s_1s_2=\tfrac{\varphi(\varphi-1)}{3}=\tfrac13=|\det C_\gamma|\). The eigenvectors give the Schmidt bases: with \(|e_1\rangle=\cos t\,|0\rangle+\sin t\,|1\rangle\), \(|e_2\rangle=\sin t\,|0\rangle-\cos t\,|1\rangle\) and \(\tan t=1/\varphi\) (so \(t\approx31.72^\circ\)),

$$|\gamma\rangle=s_1\,|e_1\rangle|e_1\rangle-s_2\,|e_2\rangle|e_2\rangle ,$$

where the minus sign (from the negative eigenvalue) can be absorbed into \(|v_2\rangle=-|e_2\rangle\). The entanglement entropy is

$$E(\gamma)=-0.8727\log_2 0.8727-0.1273\log_2 0.1273\approx 0.550\ \text{bits}.$$

So \(|\gamma\rangle\) is entangled, but only about half as much as a Bell pair.

idea — entanglement cannot be created by local gates

If \(U\) and \(V\) are single-qubit gates, then \((U\otimes V)|\psi\rangle\) has coefficient matrix \(UCV^{\mathsf T}\), which has the same singular values as \(C\). So gates applied to the qubits separately never change the Schmidt coefficients, and never change the amount of entanglement. Creating entanglement requires a gate that acts on both qubits at once. That is Lecture 6.

Alice holds qubit 1 of \(|\Phi^+\rangle\) and applies \(H\) to it. What is the entanglement entropy of the new two-qubit state?

Use the idea just above: a local gate turns \(C\) into \(UCV^{\mathsf T}\). What happens to the singular values?
The Schmidt coefficients stay \(\tfrac1{\sqrt2},\tfrac1{\sqrt2}\), so the entropy stays 1 bit. Only a gate acting on both qubits can change it.

7 — n qubits and the memory wall

Everything above extends to \(n\) qubits. The state space is \((\mathbb C^2)^{\otimes n}=\mathbb C^{2^n}\), with basis \(|q_{n-1}\cdots q_0\rangle\) indexed by \(n\)-bit strings, so a general state needs \(2^n\) complex amplitudes. A product state \(|a_{n-1}\rangle\otimes\cdots\otimes|a_0\rangle\) needs only \(2n\), two per qubit. The gap between \(2n\) and \(2^n\) is filled by entangled states, and it is the first hint of why quantum computers might be powerful.

Memory needed to store an n-qubit state vectorLog-scale plot of 16 times 2 to the n bytes against the number of qubits n, from 1 to 60. A 16 gigabyte laptop holds at most 29 qubits; one petabyte holds at most 45 qubits; 50 qubits need about 18 petabytes. Every added qubit doubles the memory.1 kB1 MB1 GB1 TB1 PB1 EB0102030405060number of qubits n16 GB laptop: 29 qubits1 PB: 45 qubits50 qubits: about 18 PB
Memory for a full state vector at 16 bytes per amplitude (two 64-bit floats), on a logarithmic scale. Every added qubit doubles the requirement. A 16 GB laptop holds at most 29 qubits, a petabyte (\(10^{15}\) bytes) holds 45, and 50 qubits need about \(1.8\times10^{16}\) bytes, or 18 PB.

The numbers are easy to check: \(16\cdot2^{29}\approx8.6\times10^9\) bytes fits in 16 GB, but \(16\cdot2^{30}\approx1.7\times10^{10}\) does not; and \(16\cdot2^{50}\approx1.80\times10^{16}\) bytes is about 18 PB, more than the memory of the largest supercomputers. This is the memory wall for brute-force simulation.

At 16 bytes per amplitude, how many gigabytes (\(10^9\) bytes) does the state vector of 32 qubits need?

There are \(2^{32}\approx4.29\times10^9\) amplitudes. Multiply by 16 bytes and divide by \(10^9\).
\(16\cdot2^{32}\approx6.87\times10^{10}\) bytes, about 68.7 GB: past a laptop, though within reach of a large workstation. Each extra qubit doubles it.
idea — what the wall does and does not mean

It does not mean that 50 qubits compute \(2^{50}\) things at once for us to read. Measurement returns \(n\) bits, and Lecture 1's warning stands: quantum speedups come only from interference arranged by an algorithm. It also does not mean every 50-qubit circuit is hard to simulate. States with little entanglement, measured by Schmidt coefficients across cuts, can be compressed; this is the idea behind tensor-network simulators. What the wall does mean is that a device whose states are generically entangled cannot be tracked by storing its state vector.

8 — Try it in code

tool — labels, circuits and tensor products agree (tested with qiskit 2.5)
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector, Operator

def probs(sv):                                  # tidy printing of probabilities_dict()
    return {str(k): round(float(v), 4) for k, v in sv.probabilities_dict().items()}

print(Statevector.from_label("01"))           # the label is read |q1 q0>

qc = QuantumCircuit(2)
qc.x(0)                                       # flip qubit 0 only
print(probs(Statevector.from_instruction(qc)))

plus, zero = Statevector.from_label("+"), Statevector.from_label("0")
print(probs(plus ^ zero))                     # plus on qubit 1, zero on qubit 0

h0 = QuantumCircuit(2); h0.h(0)
print(Operator(h0).equiv(Operator.from_label("IH")))   # H on qubit 0 is I (x) H
Statevector([0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j],
            dims=(2, 2))
{'01': 1.0}
{'00': 0.5, '10': 0.5}
True

The label "01" and the circuit with x(0) give the same state, amplitude 1 at index 1. The operator ^ is Qiskit's tensor product, with the right operand becoming qubit 0, so plus ^ zero is Example 5.2's \(|+\rangle\otimes|0\rangle\). Pauli labels such as "IH" are read the same way: the rightmost letter acts on qubit 0.

tool — coefficient matrix, determinant and Schmidt coefficients
import numpy as np
from qiskit.quantum_info import Statevector, schmidt_decomposition

psi = Statevector(np.array([1, 1, 1, 0]) / np.sqrt(3))   # |gamma> of Example 5.6
C = psi.data.reshape(2, 2)          # C[q1, q0]: row = qubit 1, column = qubit 0
print("det C =", np.linalg.det(C).real.round(4))
s = np.linalg.svd(C, compute_uv=False)
print("Schmidt coefficients:", s.round(4))
p = s**2
print("entanglement entropy:", round(float(-(p * np.log2(p)).sum()), 4), "bits")

for coef, a, b in schmidt_decomposition(psi, [0]):
    print(round(float(coef), 4), a.data.real.round(4), b.data.real.round(4))
det C = -0.3333
Schmidt coefficients: [0.9342 0.3568]
entanglement entropy: 0.55 bits
0.9342 [-0.8507 -0.5257] [-0.8507 -0.5257]
0.3568 [-0.5257  0.8507] [ 0.5257 -0.8507]

reshape(2, 2) fills rows first, which is exactly Definition 5.6. Qiskit's schmidt_decomposition returns the same coefficients, with Schmidt vectors that match Example 5.6 up to sign: the first pair is \(-|e_1\rangle,-|e_1\rangle\) (two signs that cancel) and the second pair is \(-|e_2\rangle,|e_2\rangle\), which carries the minus sign of Example 5.6. Signs and phases of Schmidt vectors are never unique; only the coefficients are.

9 — Summary and exercises

summary

Next time: gates that act on two qubits at once, CNOT and friends, the four Bell states, and measuring only part of a system. HW3 covers Lectures 5 and 6.

exercises 5
  1. Compute \(\tfrac{1}{\sqrt2}(|0\rangle+i|1\rangle)\otimes|1\rangle\) and \(|1\rangle\otimes\tfrac{1}{\sqrt2}(|0\rangle+i|1\rangle)\) as vectors in \(\mathbb C^4\). In Qiskit's convention, which qubit is in the superposition in each case?
  2. Which of these states are product states? Factor those that are. $$\begin{aligned}&\text{(a) }\tfrac12\big(|00\rangle-|01\rangle+|10\rangle-|11\rangle\big)\\[4pt] &\text{(b) }\tfrac{1}{\sqrt2}\big(|00\rangle-|11\rangle\big)\\[4pt] &\text{(c) }\tfrac15\big(3|00\rangle+4|01\rangle\big)\\[4pt] &\text{(d) }\tfrac12\big(|00\rangle+i|01\rangle+i|10\rangle-|11\rangle\big)\end{aligned}$$
  3. Compute \((I\otimes H)(|0\rangle\otimes|+\rangle)\) and \((H\otimes H)|00\rangle\). Which Qiskit qubit does \(I\otimes H\) act on?
  4. For which angles \(a\) is \(\cos a\,|00\rangle+\sin a\,|11\rangle\) a product state? Find its Schmidt coefficients and entanglement entropy, and the angles at which it is maximally entangled.
  5. Prove that \((A\otimes B)^\dagger=A^\dagger\otimes B^\dagger\) for \(2\times2\) matrices, and deduce that \(U\otimes V\) is unitary when \(U\) and \(V\) are.
  6. How many complex amplitudes describe 20 qubits, and how many bytes is that at 16 bytes each? How many numbers describe a 20-qubit product state? What is the largest number of qubits whose state vector fits in 1 TB (\(10^{12}\) bytes)?
  7. Find the SVD of \(B\) below by the four-step recipe, and compare its singular values with its eigenvalues. $$B=\begin{pmatrix}2&2\\[2pt] 1&-1\end{pmatrix}$$
  8. Show that all singular values of a \(2\times2\) unitary are 1. Deduce that a two-qubit state is maximally entangled exactly when its coefficient matrix is \(\tfrac{1}{\sqrt2}\) times a unitary, and check this for the four Bell states.
  1. Using Definition 5.2, $$\tfrac{1}{\sqrt2}(|0\rangle+i|1\rangle)\otimes|1\rangle=\frac{1}{\sqrt2}\begin{pmatrix}0\\[2pt] 1\\[2pt] 0\\[2pt] i\end{pmatrix},$$ $$|1\rangle\otimes\tfrac{1}{\sqrt2}(|0\rangle+i|1\rangle)=\frac{1}{\sqrt2}\begin{pmatrix}0\\[2pt] 0\\[2pt] 1\\[2pt] i\end{pmatrix}.$$ In the first, the left factor, qubit 1, is in the superposition \(|{+i}\rangle\) and qubit 0 is \(|1\rangle\). In the second, qubit 1 is \(|1\rangle\) and qubit 0 is in \(|{+i}\rangle\).
  2. (a) The coefficient matrix $$C=\frac12\begin{pmatrix}1&-1\\[2pt] 1&-1\end{pmatrix}$$ has \(\det C=0\): product. Both rows are \(\tfrac12(1,-1)\), so the state is \(|+\rangle\otimes|-\rangle\).
    (b) \(\det C=-\tfrac12\neq0\): entangled (it is the Bell state \(|\Phi^-\rangle\)).
    (c) The bottom row of \(C\) is zero, so \(\det C=0\): product, \(|0\rangle\otimes\tfrac15(3|0\rangle+4|1\rangle)\).
    (d) \(\det C=\tfrac14\big(1\cdot(-1)-i\cdot i\big)=0\): product. The rows are \(\tfrac12(1,i)\) and \(\tfrac{i}{2}(1,i)\), so the state is \(|{+i}\rangle\otimes|{+i}\rangle\).
  3. By Proposition 5.1, \((I\otimes H)(|0\rangle\otimes|+\rangle)=|0\rangle\otimes H|+\rangle=|0\rangle|0\rangle=|00\rangle\), and \((H\otimes H)|00\rangle=|+\rangle|+\rangle=\tfrac12(|00\rangle+|01\rangle+|10\rangle+|11\rangle)\). The right factor is qubit 0, so \(I\otimes H\) is h(0).
  4. \(C=\mathrm{diag}(\cos a,\sin a)\) and \(\det C=\cos a\sin a=\tfrac12\sin 2a\), which vanishes exactly when \(a\) is a multiple of \(\pi/2\) (then the state is \(\pm|00\rangle\) or \(\pm|11\rangle\)). The state is already in Schmidt form, with coefficients \(|\cos a|\) and \(|\sin a|\) (signs go into the Schmidt vectors), so $$E=-\cos^2\!a\,\log_2\cos^2\!a-\sin^2\!a\,\log_2\sin^2\!a .$$ It equals 1 bit exactly when \(\cos^2a=\sin^2a=\tfrac12\), that is, \(a=\pi/4+k\pi/2\); at \(a=\pi/4\) the state is \(|\Phi^+\rangle\).
  5. The entry of \(A\otimes B\) in row \(ik\), column \(jl\) is \(a_{ij}b_{kl}\). The adjoint's entry in row \(jl\), column \(ik\) is the conjugate of that, \(\overline{a_{ij}}\,\overline{b_{kl}}=(A^\dagger)_{ji}(B^\dagger)_{lk}\), which is the entry of \(A^\dagger\otimes B^\dagger\) in row \(jl\), column \(ik\). Then, by Proposition 5.1(2), \((U\otimes V)^\dagger(U\otimes V)=(U^\dagger U)\otimes(V^\dagger V)=I\otimes I\), the \(4\times4\) identity.
  6. \(2^{20}=1{,}048{,}576\) amplitudes, which is \(16\cdot2^{20}=16{,}777{,}216\) bytes, about 16.8 MB: easy. A product state needs \(2\cdot20=40\) amplitudes. For 1 TB we need \(16\cdot2^n\le10^{12}\), i.e. \(2^n\le6.25\times10^{10}\). Since \(2^{35}\approx3.4\times10^{10}\) and \(2^{36}\approx6.9\times10^{10}\), the answer is 35 qubits.
  7. First, $$B^{\mathsf T}B=\begin{pmatrix}5&3\\[2pt] 3&5\end{pmatrix},$$ with eigenvalues 8 and 2 and eigenvectors \(|w_1\rangle=\tfrac{1}{\sqrt2}(1,1)\) and \(|w_2\rangle=\tfrac{1}{\sqrt2}(1,-1)\). So \(s_1=2\sqrt2\) and \(s_2=\sqrt2\). Then \(|u_1\rangle=B|w_1\rangle/s_1=\tfrac{1}{2\sqrt2}\cdot\tfrac{1}{\sqrt2}(4,0)=(1,0)\) and \(|u_2\rangle=B|w_2\rangle/s_2=\tfrac{1}{\sqrt2}\cdot\tfrac{1}{\sqrt2}(0,2)=(0,1)\). Hence \(U=I\) and $$B=\begin{pmatrix}2\sqrt2&0\\[2pt] 0&\sqrt2\end{pmatrix}\cdot\frac{1}{\sqrt2}\begin{pmatrix}1&1\\[2pt] 1&-1\end{pmatrix}.$$ Checks: \(s_1s_2=4=|\det B|\) and \(s_1^2+s_2^2=10=4+4+1+1\). The eigenvalues solve \(\lambda^2-\lambda-4=0\), so they are \(\tfrac{1\pm\sqrt{17}}{2}\approx2.56,\,-1.56\): different numbers again, and one of them is negative, which a singular value never is.
  8. If \(C\) is unitary then \(C^\dagger C=I\), whose eigenvalues are 1 and 1, so \(s_1=s_2=1\). A state has \(s_1^2+s_2^2=1\), and it is maximally entangled when \(s_1=s_2=\tfrac{1}{\sqrt2}\), i.e. when \(C^\dagger C=\tfrac12I\), i.e. when \(\sqrt2\,C\) is unitary. For \(|\Phi^+\rangle,|\Phi^-\rangle,|\Psi^+\rangle,|\Psi^-\rangle\) the matrix \(\sqrt2\,C\) is \(I\), \(Z\), \(X\) and \(iY\) respectively, all unitary.

Reading and sources

all numbers and figures in these notes are computed in python (verify_L05.py) and follow the page theme