
# Schmidt Decomposition

> Every bipartite pure state, however tangled it looks, has a hidden diagonal form: a *single* sum that
> pairs one orthonormal vector on the left with one on the right. That canonical form is the **Schmidt
> decomposition**, and it falls straight out of the singular value decomposition of the coefficient
> matrix. Its weights — the **Schmidt coefficients** — are immune to anything either party can do
> locally, which is exactly why they, and the single number built from them (the **entanglement
> entropy**), are *the* measure of entanglement for pure states. This lesson turns the qualitative
> "entangled vs. not" of [1.4.1](01-multi-qubit-states.md) into a quantitative dial.

## Learning Objectives

After this lesson you will be able to:

1. **State and prove** the Schmidt decomposition theorem from the SVD of the coefficient matrix.
2. Read off the **Schmidt coefficients**, **Schmidt rank**, and Schmidt bases of a bipartite pure state.
3. Show the Schmidt spectrum is a **local-unitary invariant**, and use Schmidt rank as the separability test.
4. Define the **entanglement entropy** $E = -\sum_k\lambda_k\log_2\lambda_k$ and identify **maximally entangled** states by their flat spectrum.
5. Compute Schmidt decompositions numerically with `numpy.linalg.svd` and interpret the spectrum.

---

## Intuition

A bipartite state generally needs $d_A d_B$ amplitudes — a whole matrix $C$ of them. The Schmidt
decomposition says you can always *rotate the local bases* (a new basis for $A$, a new basis for $B$) so
that this matrix becomes **diagonal**: the state collapses to a single sum $\sum_k\sigma_k\lvert u_k\rangle\lvert v_k\rangle$
with at most $\min(d_A,d_B)$ terms. The number of terms (the **Schmidt rank**) and the diagonal weights
(the **Schmidt coefficients** $\sigma_k$) are intrinsic — choosing different starting bases, or applying
any gates locally, just relabels $\lvert u_k\rangle$ and $\lvert v_k\rangle$ but never touches the
$\sigma_k$. A product state is the special case of *one* term ($\sigma=(1,0,\dots)$); a Bell state is the
opposite extreme, a perfectly *flat* spectrum. So "how entangled is this pure state?" has a clean answer:
look at how spread-out the Schmidt spectrum is, and the SVD hands it to you for free.

---

## Theory

### Setup: the coefficient matrix

From [1.4.1](01-multi-qubit-states.md), any pure state of a bipartite system $\mathcal{H}_A\otimes\mathcal{H}_B$
(dimensions $d_A,d_B$) expands in product bases $\{\lvert i\rangle_A\}$, $\{\lvert j\rangle_B\}$ as

$$
\lvert\Psi\rangle = \sum_{i=1}^{d_A}\sum_{j=1}^{d_B} C_{ij}\,\lvert i\rangle_A\otimes\lvert j\rangle_B,
\qquad C\in\mathbb{C}^{d_A\times d_B},
$$

and normalization is $\langle\Psi\lvert\Psi\rangle = \sum_{ij}|C_{ij}|^2 = \lVert C\rVert_F^2 = 1$
(the Frobenius norm). The matrix $C$ holds everything about the state; the Schmidt decomposition is just
its SVD, read as a statement about $\lvert\Psi\rangle$.

### The theorem

> **Schmidt decomposition.** For any pure state $\lvert\Psi\rangle\in\mathcal{H}_A\otimes\mathcal{H}_B$ there
> exist orthonormal sets $\{\lvert u_k\rangle\}\subset\mathcal{H}_A$ and $\{\lvert v_k\rangle\}\subset\mathcal{H}_B$
> and unique reals $\sigma_k > 0$ with $\sum_k\sigma_k^2 = 1$ such that
> $$
> \boxed{\ \lvert\Psi\rangle = \sum_{k=1}^{r}\sigma_k\,\lvert u_k\rangle\otimes\lvert v_k\rangle\ }
> $$
> The $\sigma_k$ are the **Schmidt coefficients**, $r\le\min(d_A,d_B)$ is the **Schmidt rank**, and the
> $\{\lvert u_k\rangle\},\{\lvert v_k\rangle\}$ are the **Schmidt bases**.

**Proof.** Apply the SVD ([0.1.6](../../term-0-foundations/c01-linear-algebra/06-special-operators.md)) to the
coefficient matrix: $C = U\Sigma V^\dagger$, with $U$ ($d_A\times d_A$) and $V$ ($d_B\times d_B$) unitary
and $\Sigma$ diagonal with entries $\sigma_k\ge0$ (the singular values). Componentwise
$C_{ij} = \sum_k U_{ik}\,\sigma_k\,(V^\dagger)_{kj} = \sum_k\sigma_k\,U_{ik}\,\overline{V_{jk}}$. Substitute:

$$
\lvert\Psi\rangle
= \sum_{ij}\sum_k \sigma_k\,U_{ik}\,\overline{V_{jk}}\,\lvert i\rangle\lvert j\rangle
= \sum_k \sigma_k\Big(\underbrace{\textstyle\sum_i U_{ik}\lvert i\rangle}_{\lvert u_k\rangle}\Big)\otimes
\Big(\underbrace{\textstyle\sum_j \overline{V_{jk}}\lvert j\rangle}_{\lvert v_k\rangle}\Big).
$$

Because $U$ is unitary its columns $\lvert u_k\rangle$ are orthonormal; likewise the conjugated columns of
$V$ give orthonormal $\lvert v_k\rangle$. Keeping only the $r$ strictly positive $\sigma_k$ gives the boxed
form. Normalization forces $\sum_k\sigma_k^2 = \lVert C\rVert_F^2 = 1$. The $\sigma_k$ are the singular
values of $C$, which are **unique**; the Schmidt bases are unique up to phases (and up to rotation within
any degenerate $\sigma_k$ subspace). $\blacksquare$

The decisive feature: it is a **single** sum over one index $k$, not a double sum over $i,j$. One left
vector is matched to exactly one right vector.

### Schmidt rank and the separability test

The Schmidt rank $r = \operatorname{rank}(C)$ (number of nonzero $\sigma_k$) is the sharp measure of *whether*
a pure state is entangled — exactly the criterion promised in [1.4.1](01-multi-qubit-states.md) and
[1.1.4](../c01-postulates/04-composite-systems-postulate.md):

- $r = 1$: $\lvert\Psi\rangle = \sigma_1\lvert u_1\rangle\lvert v_1\rangle$ is a **product** state (separable). With
  $\sigma_1=1$ this is just $\lvert u_1\rangle\otimes\lvert v_1\rangle$.
- $r \ge 2$: **entangled** — no single product of local vectors can reproduce it.

### The Schmidt spectrum is a local-unitary invariant

Suppose Alice applies $U_A$ and Bob applies $U_B$. The coefficient matrix transforms as
$C \to U_A\,C\,U_B^{\top}$ (Exercise E3; the transpose comes from $U_B$ acting on the second factor). Left
and right multiplication by unitaries **does not change singular values**
([0.1.6](../../term-0-foundations/c01-linear-algebra/06-special-operators.md)). Hence:

$$
\boxed{\ \text{Local unitaries }U_A\otimes U_B\text{ leave every Schmidt coefficient }\sigma_k\text{ unchanged.}\ }
$$

They only rotate the Schmidt vectors $\lvert u_k\rangle\to U_A\lvert u_k\rangle$, $\lvert v_k\rangle\to U_B^*\lvert v_k\rangle$.
This is *why* the spectrum measures entanglement: it is precisely the part of the state that survives
quotienting out each party's choice of local basis. Anything that genuinely changes entanglement must be a
**joint** (entangling) operation.

### Reduced states and entanglement entropy

The Schmidt coefficients are the bridge to the density-matrix formalism of Course 1.5. Tracing out one
side of $\lvert\Psi\rangle\langle\Psi\lvert$ (the **partial trace**, [1.5.2](../c05-density-matrices/02-partial-trace-reduced-states.md))
gives diagonal reduced states in the Schmidt bases:

$$
\rho_A = \sum_k \sigma_k^2\,\lvert u_k\rangle\langle u_k\lvert,
\qquad
\rho_B = \sum_k \sigma_k^2\,\lvert v_k\rangle\langle v_k\lvert .
$$

So $\rho_A$ and $\rho_B$ share the **same nonzero eigenvalues** $\lambda_k := \sigma_k^2$ — a striking fact:
two subsystems of very different sizes have identically-shaped spectra. Since $\{\lambda_k\}$ is a probability
distribution ($\lambda_k\ge0$, $\sum_k\lambda_k=1$), we measure entanglement by its **Shannon entropy**
([0.2.3](../../term-0-foundations/c02-probability-information/03-classical-information-theory.md)):

$$
\boxed{\ E(\Psi) = -\sum_k \lambda_k\log_2\lambda_k = -\sum_k \sigma_k^2\log_2\sigma_k^2\ }\quad\text{(the \textbf{entanglement entropy}, in ebits).}
$$

It is symmetric ($E_A = E_B$, since both sides share $\{\lambda_k\}$), zero **iff** the state is a product
($r=1$), and — being a function of the LU-invariant spectrum — itself a local-unitary invariant.

### Maximal entanglement = flat spectrum

$E$ is maximized when the distribution $\{\lambda_k\}$ is **uniform**. For Schmidt rank $r$, the maximum is
$E = \log_2 r$, attained when all $\sigma_k = 1/\sqrt r$. A state of two $d$-dimensional systems is
**maximally entangled** when $\sigma_k = 1/\sqrt d$ for all $k$, giving $E = \log_2 d$ and *maximally mixed*
reduced states $\rho_A=\rho_B=I/d$. For two qubits ($d=2$) that is $E = 1$ **ebit** — the Bell states
([1.4.2](02-bell-states.md)), whose flat spectrum $(\tfrac1{\sqrt2},\tfrac1{\sqrt2})$ is exactly what
"maximally entangled" means. The entanglement entropy thus interpolates continuously from $0$ (product) to
$\log_2 d$ (maximal): a genuine dial, not a yes/no flag.

---

## Worked Examples

### Example 1 — The Bell state is already in Schmidt form

$\lvert\Phi^+\rangle = \tfrac1{\sqrt2}(\lvert00\rangle+\lvert11\rangle)$ has coefficient matrix
$C = \tfrac1{\sqrt2}\begin{psmallmatrix}1&0\\0&1\end{psmallmatrix} = \tfrac1{\sqrt2}I$. Its singular values are
both $\tfrac1{\sqrt2}$, so $\sigma = (\tfrac1{\sqrt2},\tfrac1{\sqrt2})$, Schmidt rank $r=2$, with Schmidt bases
$\{\lvert0\rangle,\lvert1\rangle\}$ on each side. The spectrum is flat, so $\lambda = (\tfrac12,\tfrac12)$ and
$E = -2\cdot\tfrac12\log_2\tfrac12 = 1$ ebit — maximally entangled, with $\rho_A = \rho_B = I/2$.

### Example 2 — Entanglement as a continuous dial

$\lvert\Psi_\theta\rangle = \cos\theta\,\lvert00\rangle + \sin\theta\,\lvert11\rangle$ is *already* a Schmidt
decomposition: $C = \operatorname{diag}(\cos\theta,\sin\theta)$, so $\sigma = (\cos\theta,\sin\theta)$ (for
$\theta\in[0,\tfrac\pi4]$) and $\lambda = (\cos^2\theta,\sin^2\theta)$. The entanglement entropy is the binary
entropy $E(\theta) = H_2(\cos^2\theta)$. At $\theta=0$ the state is $\lvert00\rangle$, a product ($r=1$, $E=0$);
at $\theta=\tfrac\pi4$ it is $\lvert\Phi^+\rangle$, maximal ($E=1$); in between it is *partially* entangled.
One parameter sweeps the whole range from separable to maximal.

### Example 3 — One sign flip: product vs. maximal

Compare two states that look almost identical:

$$
\lvert P\rangle = \tfrac12(\lvert00\rangle+\lvert01\rangle+\lvert10\rangle+\lvert11\rangle),
\qquad
\lvert M\rangle = \tfrac12(\lvert00\rangle+\lvert01\rangle+\lvert10\rangle-\lvert11\rangle).
$$

Their coefficient matrices are $C_P = \tfrac12\begin{psmallmatrix}1&1\\1&1\end{psmallmatrix}$ and
$C_M = \tfrac12\begin{psmallmatrix}1&1\\1&-1\end{psmallmatrix} = \tfrac1{\sqrt2}H$. The rows of $C_P$ are
identical, so $\operatorname{rank}(C_P)=1$: $\sigma=(1,0)$, and indeed $\lvert P\rangle = \lvert+\rangle\lvert+\rangle$
is a **product** state, $E=0$. But $H$ is unitary, so $C_M = \tfrac1{\sqrt2}H$ has both singular values equal
to $\tfrac1{\sqrt2}$: $\sigma=(\tfrac1{\sqrt2},\tfrac1{\sqrt2})$, $r=2$, $E=1$ — $\lvert M\rangle$ is **maximally
entangled** (it is $\lvert\Phi^+\rangle$ dressed by a local $H$). A single sign separates a product state from
a Bell state, and only the Schmidt spectrum sees it at a glance.

---

## Hands-on (Python)

```python
import numpy as np

def schmidt(state, dA, dB, tol=1e-12):
    """Schmidt decomposition of a bipartite pure state (big-endian, A⊗B).
    Returns (sigma, U_cols, Vh_rows) keeping only sigma_k > tol."""
    C = state.reshape(dA, dB)                 # coefficient matrix C_{ij}
    U, s, Vh = np.linalg.svd(C)               # C = U diag(s) Vh
    keep = s > tol
    return s[keep], U[:, keep], Vh[keep, :]   # |u_k> = U[:,k], |v_k> = Vh[k,:]

def entanglement_entropy(sigma):
    """E = -sum lambda log2 lambda,  lambda = sigma^2 (in ebits)."""
    lam = sigma**2
    lam = lam[lam > 0]
    return float(max(0.0, -np.sum(lam * np.log2(lam))))   # entropy is nonnegative

# Build a few 2-qubit states (big-endian: index 2i+j ↔ |i>|j>):
def two_qubit(c00, c01, c10, c11):
    v = np.array([c00, c01, c10, c11], dtype=complex)
    return v / np.linalg.norm(v)

bell    = two_qubit(1, 0, 0, 1)               # |Φ+>
prod    = two_qubit(1, 1, 1, 1)               # |+>|+>  (Example 3, |P>)
maximal = two_qubit(1, 1, 1, -1)              # one sign flip (Example 3, |M>)

for name, st in [("Bell", bell), ("|+>|+>", prod), ("sign-flip", maximal)]:
    s, _, _ = schmidt(st, 2, 2)
    print(f"{name:>10}: sigma={np.round(s,3)}  rank={len(s)}  E={entanglement_entropy(s):.3f} ebits")
#       Bell: sigma=[0.707 0.707]  rank=2  E=1.000   (flat -> maximal)
#     |+>|+>: sigma=[1.]           rank=1  E=0.000   (product; the second σ≈0 is dropped)
#  sign-flip: sigma=[0.707 0.707]  rank=2  E=1.000   (Bell up to a local H)
```

```python
# The dial of Example 2: E(θ) = H2(cos^2 θ), peaking at θ = π/4.
for theta in (0, np.pi/8, np.pi/4):
    st = two_qubit(np.cos(theta), 0, 0, np.sin(theta))
    s, _, _ = schmidt(st, 2, 2)
    print(f"θ={theta:.3f}: sigma={np.round(s,3)}  E={entanglement_entropy(s):.4f}")
# θ=0.000: sigma=[1.]           E=0.0000   (product)
# θ=0.393: sigma=[0.924 0.383]  E=0.6009   (partial)
# θ=0.785: sigma=[0.707 0.707]  E=1.0000   (maximal)

# Reconstruction check: Σ_k σ_k |u_k>⊗|v_k> rebuilds the state exactly.
s, U, Vh = schmidt(maximal, 2, 2)
rebuilt = sum(sk * np.kron(U[:, k], Vh[k, :]) for k, sk in enumerate(s))
print("reconstruct OK:", np.allclose(rebuilt, maximal))      # True

# Local-unitary invariance: H ⊗ I leaves the Schmidt spectrum unchanged.
H = np.array([[1, 1], [1, -1]], dtype=complex) / np.sqrt(2)
I2 = np.eye(2)
st2 = np.kron(H, I2) @ bell
print("σ after H⊗I:", np.round(schmidt(st2, 2, 2)[0], 3))    # [0.707 0.707] — unchanged
```

> **Numerical Schmidt rank.** The rank is the count of singular values above a tolerance, never an exact
> equality test — finite precision turns a "zero" coefficient into something like $10^{-16}$. This is the
> careful version of the `schmidt_rank` helper from [1.4.1](01-multi-qubit-states.md): pick `tol`
> comfortably above machine noise (here $10^{-12}$). The same SVD also drives the matrix-product-state
> truncation used in tensor-network simulators (Term 5.3).

---

## Exercises

**E1 (easy).** Give the Schmidt coefficients, rank, and entanglement entropy of
$\lvert\Psi_\theta\rangle = \cos\theta\lvert00\rangle+\sin\theta\lvert11\rangle$ for $\theta=0$, $\tfrac\pi6$, $\tfrac\pi4$.

<details><summary>Solution</summary>

It is already in Schmidt form: $\sigma=(\cos\theta,\sin\theta)$. At $\theta=0$: $\sigma=(1,0)$, rank $1$, $E=0$
(product). At $\theta=\tfrac\pi6$: $\sigma=(\tfrac{\sqrt3}2,\tfrac12)$, rank $2$, $E = H_2(\tfrac34) = -\tfrac34\log_2\tfrac34-\tfrac14\log_2\tfrac14\approx0.811$.
At $\theta=\tfrac\pi4$: $\sigma=(\tfrac1{\sqrt2},\tfrac1{\sqrt2})$, rank $2$, $E=1$ (maximal). ∎
</details>

**E2 (easy).** Why must $\sum_k\sigma_k^2 = 1$ for any normalized state?

<details><summary>Solution</summary>

Normalization gives $1 = \langle\Psi\lvert\Psi\rangle = \sum_{ij}|C_{ij}|^2 = \lVert C\rVert_F^2$, and the squared
Frobenius norm equals the sum of squared singular values, $\lVert C\rVert_F^2 = \sum_k\sigma_k^2$. So
$\sum_k\sigma_k^2 = 1$, which is also why $\lambda_k=\sigma_k^2$ is a valid probability distribution. ∎
</details>

**E3 (medium).** Show that under local unitaries the coefficient matrix transforms as $C \to U_A\,C\,U_B^{\top}$,
and conclude the Schmidt coefficients are unchanged.

<details><summary>Solution</summary>

$(U_A\otimes U_B)\lvert\Psi\rangle = \sum_{ij}C_{ij}(U_A\lvert i\rangle)\otimes(U_B\lvert j\rangle)
= \sum_{ij}C_{ij}\sum_{i'}(U_A)_{i'i}\lvert i'\rangle\sum_{j'}(U_B)_{j'j}\lvert j'\rangle$. The new coefficient of
$\lvert i'\rangle\lvert j'\rangle$ is $\sum_{ij}(U_A)_{i'i}C_{ij}(U_B)_{j'j} = (U_A C\,U_B^{\top})_{i'j'}$. Singular
values are invariant under left/right multiplication by unitaries ($U_B^{\top}$ is unitary since $U_B$ is), so
every $\sigma_k$ — hence $E$ — is unchanged; only the Schmidt vectors rotate. ∎
</details>

**E4 (medium).** Without numerics, find the Schmidt rank and entanglement entropy of
$\lvert M\rangle = \tfrac12(\lvert00\rangle+\lvert01\rangle+\lvert10\rangle-\lvert11\rangle)$.

<details><summary>Solution</summary>

$C_M = \tfrac12\begin{psmallmatrix}1&1\\1&-1\end{psmallmatrix} = \tfrac1{\sqrt2}H$ with $H$ the (unitary) Hadamard.
A unitary has all singular values $1$, so $C_M$ has both singular values $\tfrac1{\sqrt2}$: $\sigma=(\tfrac1{\sqrt2},\tfrac1{\sqrt2})$,
rank $2$, flat spectrum, $E=1$ ebit. It is maximally entangled — a Bell state up to the local unitary $H$ on one
qubit. ∎
</details>

**E5 (medium).** Prove that $\rho_A = \operatorname{Tr}_B\lvert\Psi\rangle\langle\Psi\lvert = \sum_k\sigma_k^2\lvert u_k\rangle\langle u_k\lvert$,
and deduce that $\rho_A$ is pure **iff** $\lvert\Psi\rangle$ is a product state.

<details><summary>Solution</summary>

Write $\lvert\Psi\rangle=\sum_k\sigma_k\lvert u_k\rangle\lvert v_k\rangle$. Then $\lvert\Psi\rangle\langle\Psi\lvert
=\sum_{k,l}\sigma_k\sigma_l\lvert u_k\rangle\langle u_l\lvert\otimes\lvert v_k\rangle\langle v_l\lvert$. The partial
trace over $B$ replaces $\lvert v_k\rangle\langle v_l\lvert$ by $\langle v_l\lvert v_k\rangle=\delta_{kl}$
(orthonormality), leaving $\rho_A=\sum_k\sigma_k^2\lvert u_k\rangle\langle u_k\lvert$ — already diagonal, with
eigenvalues $\lambda_k=\sigma_k^2$. $\rho_A$ is pure iff one eigenvalue is $1$ and the rest $0$, i.e. a single
nonzero $\sigma_k$, i.e. Schmidt rank $1$, i.e. $\lvert\Psi\rangle$ is a product. ∎ (Partial trace: [1.5.2](../c05-density-matrices/02-partial-trace-reduced-states.md).)
</details>

**E6 (hard).** Show $r\le\min(d_A,d_B)$, and that for two $d$-level systems the maximum entanglement entropy is
$\log_2 d$, attained exactly when $\sigma_k=1/\sqrt d$ for all $k$.

<details><summary>Solution</summary>

$r=\operatorname{rank}(C)$ and $C$ is $d_A\times d_B$, so $r\le\min(d_A,d_B)$; for two $d$-level systems
$r\le d$. Entanglement entropy is the Shannon entropy $H(\{\lambda_k\})$ of a distribution on $r\le d$ outcomes,
which is maximized by the uniform distribution and equals $\log_2 r\le\log_2 d$
([0.2.3](../../term-0-foundations/c02-probability-information/03-classical-information-theory.md)). The bound
$\log_2 d$ is reached only when $r=d$ and all $\lambda_k=1/d$, i.e. $\sigma_k=1/\sqrt d$ — the flat spectrum,
giving $\rho_A=\rho_B=I/d$. ∎
</details>

---

## Checkpoint

1. State the Schmidt decomposition and the key structural fact that distinguishes it from a generic double sum.
2. How do you compute the Schmidt coefficients of a state in practice?
3. What does Schmidt rank tell you, and why is the Schmidt spectrum unchanged by local unitaries?
4. Define the entanglement entropy and give its value for a product state and for a two-qubit Bell state.
5. What is the Schmidt spectrum of a maximally entangled state of two $d$-level systems, and what are its reduced states?

<details><summary>Answers</summary>

1. $\lvert\Psi\rangle = \sum_k\sigma_k\lvert u_k\rangle\lvert v_k\rangle$ with orthonormal $\{\lvert u_k\rangle\}$,
   $\{\lvert v_k\rangle\}$ and $\sigma_k>0$, $\sum_k\sigma_k^2=1$. It is a *single* sum pairing one $A$-vector with one $B$-vector.
2. Form the coefficient matrix $C$ and take its singular values via the SVD; the $\sigma_k$ are those singular values.
3. Rank $1$ ⟺ product, rank $\ge2$ ⟺ entangled. Local unitaries send $C\to U_A C U_B^{\top}$, which preserves singular values.
4. $E = -\sum_k\sigma_k^2\log_2\sigma_k^2$; $E=0$ for a product state, $E=1$ ebit for a Bell state.
5. Flat: $\sigma_k=1/\sqrt d$ for all $k$, $E=\log_2 d$; reduced states are maximally mixed, $\rho_A=\rho_B=I/d$.

</details>

---

## Further Reading

- **[NC]** Nielsen & Chuang, §2.5 — the Schmidt decomposition and its consequences for entanglement.
- **[Pre]** Preskill, *Ph219*, Ch. 2 — Schmidt decomposition, purification, and the reduced density operator.
- **[Wat]** Watrous, *The Theory of Quantum Information*, Ch. 2 — operator-Schmidt and SVD viewpoint.
- **[NC]** §12.5.1 — entanglement entropy as the entanglement measure for pure bipartite states.

---

← Prev: [Nonlocality & the CHSH Inequality](03-nonlocality-chsh.md) · Up: [Term 1](../README.md) · Next: [The Density Operator](../c05-density-matrices/01-density-operator.md) →
