Week 3 | two qubits live in C4, and most of C4 is entangled | reading: Watrous §2.1–2.2
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.
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.
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?
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.
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\).
Compute \(|+\rangle\otimes|0\rangle\) and \(|0\rangle\otimes|+\rangle\).
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.
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}\).
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.
For vectors \(a,b,c,d\), matrices \(A,B,C,D\) of matching sizes and scalars \(\lambda\):
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\).
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 .
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.
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\).
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
.
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.
(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.
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.
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.
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.
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.
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.
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.
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.
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.
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}\).
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.
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.
(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.
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.
Now apply the SVD to the coefficient matrix of a state. The result is the most useful normal form for two-part quantum states.
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.
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\).
(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.
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?
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.
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?
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.
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.
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.
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.
h(0).tensor, probabilities_dict) and quantum_info (schmidt_decomposition). Qiskit's documentation also has a short guide to its bit-ordering convention.all numbers and figures in these notes are computed in python (verify_L05.py) and follow the page theme