Exercises: Chapter 3 — The Mathematics of Quantum Computing: State Vectors, Bra-Ket Notation, Unitary Operators, and the Linear Algebra You Need

Exercise 3.1: Bra-Ket Manipulation

Given $| \psi \rangle = \frac{1}{\sqrt{3}}|0\rangle + \sqrt{\frac{2}{3}}|1\rangle$ and $| \phi \rangle = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)$, compute: (a) $\langle \psi | \phi \rangle$ (b) $|\langle \psi | \phi \rangle|^2$ (c) The outer product $| \psi \rangle \langle \phi |$ (d) The projector $|\psi\rangle\langle\psi|$ and its eigenvalues (e) Verify your results with NumPy.

Exercise 3.2: Unitary Verification

Prove that if $U$ and $V$ are unitary, then $U \otimes V$ is unitary. Then verify numerically for $U = H$ (Hadamard) and $V = X$ (Pauli-X).

Exercise 3.3: Spectral Decomposition

Compute the spectral decomposition of the matrix $A = \begin{pmatrix} 3 & 1+i \\ 1-i & 2 \end{pmatrix}$. Verify that $A$ is Hermitian, find its eigenvalues and eigenvectors, and reconstruct $A$ from its spectral decomposition.

Exercise 3.4: Tensor Product Practice

Compute by hand and verify with NumPy: (a) $H \otimes H$ (the 2-qubit Hadamard) (b) $X \otimes Z$ (c) Apply $H \otimes H$ to $|00\rangle$ and interpret the result. (d) Apply $X \otimes Z$ to $|01\rangle$ and interpret the result.

Exercise 3.5: Pauli Matrix Algebra

Prove the anti-commutation relation $\{X, Z\} = 0$ both algebraically and numerically. Show that any $2 \times 2$ matrix can be written as $a_0 I + \vec{a} \cdot \vec{\sigma}$ where $\vec{\sigma} = (X, Y, Z)$ and find the coefficients for the Hadamard matrix.

Exercise 3.6: Density Matrix and Purity

(a) Compute the density matrix for the state $|\psi\rangle = \frac{1}{\sqrt{5}}|0\rangle + \frac{2i}{\sqrt{5}}|1\rangle$. (b) Verify that $\text{Tr}(\rho) = 1$ and $\text{Tr}(\rho^2) = 1$. (c) Compute the density matrix for the mixed state $\rho = \frac{3}{4}|0\rangle\langle 0| + \frac{1}{4}|+\rangle\langle+|$ and find its purity.

Exercise 3.7: Partial Trace and Entanglement

(a) Compute the density matrix of the state $|\Psi^-\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$. (b) Compute the reduced density matrix of the first qubit by tracing out the second. (c) Is the reduced state pure or mixed? What is the purity? (d) Repeat for the product state $|+\rangle \otimes |0\rangle$. Compare the purities.

Exercise 3.8: Completeness Relation

(a) Verify the completeness relation $\sum_i |i\rangle\langle i| = I$ for the computational basis $\{|0\rangle, |1\rangle\}$. (b) Verify it for the Hadamard basis $\{|+\rangle, |-\rangle\}$. (c) Use the completeness relation to show that $A = \sum_{i,j} A_{ij}|i\rangle\langle j|$ where $A_{ij} = \langle i|A|j\rangle$.

Exercise 3.9: Rotation Gates on the Bloch Sphere

(a) Compute $R_x(\pi)$, $R_y(\pi)$, and $R_z(\pi)$ explicitly as $2 \times 2$ matrices. (b) Show that $R_x(\pi) = -iX$, $R_y(\pi) = -iY$, and $R_z(\pi) = -iZ$ (up to global phase). (c) Compute $R_y(\pi/2)$ and apply it to $|0\rangle$. What state do you get? Where is it on the Bloch sphere? (d) Decompose the Hadamard gate as $H = R_z(\pi) \cdot R_y(\pi/2) \cdot R_z(0)$ and verify numerically (up to global phase).

Exercise 3.10: Cauchy-Schwarz Inequality

For the states $|\psi\rangle = \frac{3}{5}|0\rangle + \frac{4}{5}|1\rangle$ and $|\phi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)$: (a) Compute $|\langle\psi|\phi\rangle|^2$. (b) Compute $\langle\psi|\psi\rangle \cdot \langle\phi|\phi\rangle$. (c) Verify that $|\langle\psi|\phi\rangle|^2 \leq \langle\psi|\psi\rangle \cdot \langle\phi|\phi\rangle$ (Cauchy-Schwarz). (d) When does equality hold in the Cauchy-Schwarz inequality? What does this mean physically?