
# Appendix E — Math Identities Cheat-Sheet

> The identities you'll reach for constantly. Conventions match [Appendix C](C-notation-glossary.md):
> $\hbar = 1$, big-endian qubits, rotation gates use the half-angle $e^{-i\theta\sigma/2}$.

---

## 1. Pauli Matrices

$$
I=\begin{pmatrix}1&0\\0&1\end{pmatrix},\quad
X=\begin{pmatrix}0&1\\1&0\end{pmatrix},\quad
Y=\begin{pmatrix}0&-i\\ i&0\end{pmatrix},\quad
Z=\begin{pmatrix}1&0\\0&-1\end{pmatrix}.
$$

**Basic properties** (let $\sigma_j \in \{X,Y,Z\}$):

- Hermitian and unitary: $\sigma_j = \sigma_j^\dagger$ and $\sigma_j^2 = I$.
- Traceless: $\mathrm{Tr}(\sigma_j) = 0$; eigenvalues $\pm 1$.
- $\det(\sigma_j) = -1$.

**Products and (anti)commutators** (with Levi-Civita $\varepsilon_{jkl}$, $\{j,k,l\}$ a permutation
of $\{x,y,z\}$):

$$
XY = iZ,\quad YZ = iX,\quad ZX = iY \qquad(\text{cyclic});
$$
$$
[\sigma_j,\sigma_k] = 2i\,\varepsilon_{jkl}\,\sigma_l,\qquad
\{\sigma_j,\sigma_k\} = 2\,\delta_{jk} I,\qquad
\sigma_j\sigma_k = \delta_{jk} I + i\,\varepsilon_{jkl}\sigma_l.
$$

**Completeness:** $\{I, X, Y, Z\}$ is an orthogonal basis for $2\times2$ Hermitian matrices under the
Hilbert–Schmidt inner product $\langle A,B\rangle = \mathrm{Tr}(A^\dagger B)$, with
$\mathrm{Tr}(\sigma_j\sigma_k) = 2\delta_{jk}$. Hence any single-qubit density matrix is
$$
\rho = \tfrac12\big(I + \vec r\cdot\vec\sigma\big),\qquad \vec r = (\langle X\rangle,\langle Y\rangle,\langle Z\rangle),\ \ |\vec r|\le 1.
$$

---

## 2. Common Gate Matrices

$$
H=\frac{1}{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix},\quad
S=\begin{pmatrix}1&0\\0&i\end{pmatrix},\quad
T=\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix}.
$$

Relations: $S = T^2$, $Z = S^2$, $H X H = Z$, $H Z H = X$, $H Y H = -Y$, $S X S^\dagger = Y$.

**Two-qubit (big-endian, control = qubit 0):**
$$
\text{CNOT}=\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{pmatrix},\quad
\text{CZ}=\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&-1\end{pmatrix},\quad
\text{SWAP}=\begin{pmatrix}1&0&0&0\\0&0&1&0\\0&1&0&0\\0&0&0&1\end{pmatrix}.
$$

Useful: $\text{CZ} = (I\otimes H)\,\text{CNOT}\,(I\otimes H)$, and
$\text{SWAP} = \text{CNOT}_{01}\,\text{CNOT}_{10}\,\text{CNOT}_{01}$.

---

## 3. Rotation Gates (Exponentials of Paulis)

Since $\sigma_j^2 = I$, the exponential closes into sines and cosines:
$$
e^{-i\theta\,\hat n\cdot\vec\sigma/2}
= \cos\!\tfrac{\theta}{2}\,I - i\sin\!\tfrac{\theta}{2}\,(\hat n\cdot\vec\sigma),
\qquad |\hat n| = 1.
$$

The single-axis rotations:
$$
R_x(\theta)=\begin{pmatrix}\cos\frac\theta2 & -i\sin\frac\theta2\\ -i\sin\frac\theta2 & \cos\frac\theta2\end{pmatrix},\
R_y(\theta)=\begin{pmatrix}\cos\frac\theta2 & -\sin\frac\theta2\\ \sin\frac\theta2 & \cos\frac\theta2\end{pmatrix},\
R_z(\theta)=\begin{pmatrix}e^{-i\theta/2}&0\\0&e^{i\theta/2}\end{pmatrix}.
$$

Identities:
- $R_z(\pi) = e^{-i\pi/2}Z$, $\ R_x(\pi) = -iX$, $\ R_y(\pi) = -iY$ (note the global phases).
- $H = e^{i\pi/2} R_y(\tfrac{\pi}{2}) R_z(\pi)$ (up to global phase); more simply $H$ is a $\pi$
  rotation about the $\hat n = (\hat x + \hat z)/\sqrt2$ axis.

**Euler (ZYZ) decomposition.** Any single-qubit unitary $U$ can be written, for some
$\alpha,\beta,\gamma,\delta\in\mathbb R$,
$$
U = e^{i\alpha}\,R_z(\beta)\,R_y(\gamma)\,R_z(\delta).
$$
This is why $\{R_y, R_z\}$ (plus phase) generate all of $SU(2)$ — see
[Term 2.2](../term-2-qc-core/c02-universality/02-circuit-identities-decompositions.md).

---

## 4. Operator Identities

- **Adjoint of a product:** $(AB)^\dagger = B^\dagger A^\dagger$; $(A\otimes B)^\dagger = A^\dagger\otimes B^\dagger$.
- **Trace is cyclic:** $\mathrm{Tr}(ABC) = \mathrm{Tr}(CAB) = \mathrm{Tr}(BCA)$ (basis-independent).
- **Trace of a tensor product:** $\mathrm{Tr}(A\otimes B) = \mathrm{Tr}(A)\,\mathrm{Tr}(B)$.
- **Expectation:** $\langle A\rangle = \mathrm{Tr}(\rho A)$; for pure $\rho=|\psi\rangle\langle\psi|$, $=\langle\psi|A|\psi\rangle$.
- **Spectral decomposition:** a normal operator $A=\sum_i \lambda_i |v_i\rangle\langle v_i|$ with
  $\{|v_i\rangle\}$ orthonormal; then $f(A)=\sum_i f(\lambda_i)|v_i\rangle\langle v_i|$ for any function $f$.
- **Function of a unitary's generator:** if $H=\sum_i E_i|E_i\rangle\langle E_i|$ then
  $e^{-iHt}=\sum_i e^{-iE_i t}|E_i\rangle\langle E_i|$.

**Baker–Campbell–Hausdorff (BCH):**
$$
e^{A}e^{B} = e^{A+B+\frac12[A,B]+\frac1{12}[A,[A,B]]-\frac1{12}[B,[A,B]]+\cdots}.
$$
If $[A,B]=0$ then $e^A e^B = e^{A+B}$. This is exactly why **Trotterization** is needed when
$[A,B]\neq 0$ (see [Term 3.4](../term-3-algorithms/c04-hhl/01-hamiltonian-simulation.md)):
$$
e^{-i(A+B)t} = \lim_{n\to\infty}\Big(e^{-iAt/n}e^{-iBt/n}\Big)^{n},\qquad
e^{-i(A+B)\delta} = e^{-iA\delta}e^{-iB\delta} + O(\delta^2).
$$

**Hadamard lemma (operator conjugation):**
$$
e^{A}Be^{-A} = B + [A,B] + \tfrac1{2!}[A,[A,B]] + \cdots.
$$

---

## 5. Tensor-Product (Kronecker) Identities

- **Mixed-product:** $(A\otimes B)(C\otimes D) = (AC)\otimes(BD)$.
- **Action on product states:** $(A\otimes B)(|a\rangle\otimes|b\rangle) = (A|a\rangle)\otimes(B|b\rangle)$.
- **Adjoint / inverse / transpose distribute:** $(A\otimes B)^{-1} = A^{-1}\otimes B^{-1}$, etc.
- **Eigenvalues:** if $A|u\rangle=a|u\rangle$ and $B|v\rangle=b|v\rangle$, then
  $(A\otimes B)(|u\rangle\otimes|v\rangle) = ab\,(|u\rangle\otimes|v\rangle)$.
- **Dimension:** $A\,(m\times m)\otimes B\,(n\times n)$ is $mn\times mn$.

---

## 6. Complex Numbers, Roots of Unity, and the QFT Kernel

- **Euler:** $e^{i\theta} = \cos\theta + i\sin\theta$; $\ |e^{i\theta}|=1$.
- **$N$-th roots of unity:** $\omega = e^{2\pi i/N}$ satisfies $\omega^N = 1$ and
  $\sum_{k=0}^{N-1}\omega^{k} = 0$ (for $N>1$).
- **Geometric sum:** $\displaystyle\sum_{k=0}^{N-1} r^k = \frac{1-r^N}{1-r}$ for $r\neq1$.
- **Orthogonality (DFT/QFT core):**
  $\displaystyle \frac1N\sum_{x=0}^{N-1} e^{2\pi i x(j-k)/N} = \delta_{jk}.$
- **QFT action:** $\displaystyle \text{QFT}\,|x\rangle = \frac{1}{\sqrt N}\sum_{y=0}^{N-1} e^{2\pi i xy/N}\,|y\rangle,\quad N=2^n.$

---

## 7. Probability & Statistics (for shots and estimation)

- **Born rule:** $p_i = |\langle i|\psi\rangle|^2$; $\sum_i p_i = 1$.
- **Sample-mean estimator of $\langle A\rangle$** from $M$ shots has standard error
  $\sigma/\sqrt M$; halving the error costs $4\times$ the shots. Plan QPU budgets accordingly.
- **Binomial outcome:** estimating a probability $p$ from $M$ shots gives variance $p(1-p)/M$.
- **Hoeffding bound:** $\Pr[\,|\hat p - p| \ge \epsilon\,] \le 2e^{-2M\epsilon^2}$ — how many shots
  guarantee a target confidence.

---

## 8. Frequently Used Special Values

| Quantity | Value |
|---|---|
| $\cos(\pi/8),\ \sin(\pi/8)$ | $\approx 0.9239,\ 0.3827$ |
| $\langle 0|H|0\rangle$ | $1/\sqrt2$ |
| Optimal Grover iterations (database size $N$, one marked) | $\big\lfloor \frac{\pi}{4}\sqrt N \big\rfloor$ |
| CHSH classical bound / quantum (Tsirelson) bound | $2$ / $2\sqrt2$ |
| Purity range for $d$-dim state | $\big[\tfrac1d,\,1\big]$ |
| QFT gate count ($n$ qubits) | $\Theta(n^2)$ |

---

## Further Reading

- [NC] Nielsen & Chuang, §2.1, §4.2, and the inside-cover gate tables.
- [Pre] Preskill, Ch. 2–3 for the operator algebra; Ch. 5 for channels.
- [Appendix C — Notation & Glossary](C-notation-glossary.md) for symbol conventions.

---

← Prev: [Appendix D — References](D-references-bibliography.md) · Back to [Program Index](../README.md) →
