ψQuantum Computing 2026

REFERENCE TOOLKIT

Appendix A — Mathematical toolkit

This appendix supplies details that are useful across chapters. It can be read when a calculation first needs them rather than memorized before beginning.

A.1 Matrix multiplication and adjoints

For matrices A of shape m×n and B of shape n×p, (AB)jk=∑ℓ=1nAjℓBℓk(AB)_{jk}=\sum_{\ell=1}^nA_{j\ell}B_{\ell k}. The inner dimensions must match. For two square matrices,

(abcd)(efgh)=(ae+bgaf+bhce+dgcf+dh).\begin{pmatrix}a&b\\c&d\end{pmatrix} \begin{pmatrix}e&f\\g&h\end{pmatrix} =\begin{pmatrix}ae+bg&af+bh\\ce+dg&cf+dh\end{pmatrix}.

The adjoint conjugates entries and transposes: (A†)jk=Akj*(A^\dagger)_{jk}=A_{kj}^*. It reverses products: (AB)†=B†A†(AB)^\dagger=B^\dagger A^\dagger. Consequently a circuit’s inverse reverses gate order and replaces each gate with its adjoint.

An outer product |u⟩⟨v||u\rangle\langle v| is a matrix with entries ujvk*u_jv_k^*. Its action on |w⟩|w\rangle is |u⟩(⟨v|w⟩)|u\rangle(\langle v|w\rangle). An inner product is a scalar. Confusing the order changes the mathematical type of the result.

A.2 Eigenvectors and diagonalization

An eigenvector satisfies A|v⟩=λ|v⟩A|v\rangle=\lambda|v\rangle with nonzero v. Eigenvalues solve det(A−λI)=0\det(A-\lambda I)=0. For a Hermitian two-by-two matrix

A=(acc*b),a,b∈ℝ,A=\begin{pmatrix}a&c\\c^*&b\end{pmatrix},\quad a,b\in\mathbb R,

the characteristic equation is

(a−λ)(b−λ)−|c|2=0,(a-\lambda)(b-\lambda)-|c|^2=0, λ2−(a+b)λ+ab−|c|2=0.\lambda^2-(a+b)\lambda+ab-|c|^2=0.

Thus

λ±=a+b±(a−b)2+4|c|22.\lambda_\pm=\frac{a+b\pm\sqrt{(a-b)^2+4|c|^2}}2.

These are real. Solve (A−λI)v=0(A-\lambda I)v=0 for each eigenvector and normalize. If eigenvalues are distinct, Hermiticity makes the eigenvectors orthogonal: taking matrix elements in both orders gives (λ−μ)⟨v|w⟩=0(\lambda-\mu)\langle v|w\rangle=0.

The spectral theorem writes a Hermitian matrix as A=∑jλj|vj⟩⟨vj|A=\sum_j\lambda_j|v_j\rangle\langle v_j| with an orthonormal eigenbasis. It defines functions of A: f(A)=∑jf(λj)|vj⟩⟨vj|f(A)=\sum_jf(\lambda_j)|v_j\rangle\langle v_j|. This explains exponentials of Hamiltonians, square roots of positive matrices, and matrix entropy.

A matrix is positive semidefinite exactly when all its eigenvalues are nonnegative. A two-by-two Hermitian density matrix with trace one is physical if its diagonal entries and determinant are nonnegative. Checking only trace and Hermiticity is insufficient.

A.3 Gram–Schmidt and projection

Given a normalized vector |u⟩|u\rangle and another vector |v⟩|v\rangle, subtract its component along u:

|w⟩=|v⟩−|u⟩⟨u|v⟩.|w\rangle=|v\rangle-|u\rangle\langle u|v\rangle.

Then ⟨u|w⟩=⟨u|v⟩−⟨u|u⟩⟨u|v⟩=0\langle u|w\rangle=\langle u|v\rangle-\langle u|u\rangle\langle u|v\rangle=0. If w is nonzero, normalize it. Repeating this process builds an orthonormal basis from linearly independent vectors.

For an orthonormal set, the projector onto its span is P=∑j|uj⟩⟨uj|P=\sum_j|u_j\rangle\langle u_j|. It obeys P2=P=P†P^2=P=P^\dagger. For a complete basis, P=I. Expanding a vector using this identity yields its projection coefficients.

The Cauchy–Schwarz inequality |⟨u|v⟩|2≤⟨u|u⟩⟨v|v⟩|\langle u|v\rangle|^2\le\langle u|u\rangle\langle v|v\rangle ensures that overlap probabilities between normalized states lie in [0,1]. Equality occurs when the vectors are linearly dependent.

A.4 Singular values and Schmidt form

For any matrix M, the eigenvalues of M†MM^\dagger M are nonnegative. Their square roots are its singular values. A singular-value decomposition is M=UΣV†M=U\Sigma V^\dagger, with diagonal nonnegative Σ and unitary U,V of suitable shapes.

For a bipartite pure state’s coefficient matrix Mab=cabM_{ab}=c_{ab}, the singular values are square roots of the Schmidt probabilities. In the fixed product bases, the reduced operators are ρA=MM†\rho_A=MM^\dagger and ρB=MTM*=(M†M)T\rho_B=M^T M^*=(M^\dagger M)^T. Indeed, (ρB)bb′=∑aMabMab′*(\rho_B)_{bb'}=\sum_a M_{ab}M^*_{ab'}. Both have the same nonzero eigenvalues. Their equality of spectra explains equal reduced entropies for a pure joint state.

The largest singular value is the operator norm ‖M‖, the maximum stretching of a unit vector. The trace norm sums singular values. The Frobenius norm is ∥M∥F=∑jk|Mjk|2\|M\|_F=\sqrt{\sum_{jk}|M_{jk}|^2}. Different norms answer different error questions; state overlap, global operator error, and local observable error should not be interchanged.

A.5 Geometric sums and Fourier cancellation

For r≠1,

1+r+⋯+rN−1=1−rN1−r.1+r+\cdots+r^{N-1}=\frac{1-r^N}{1-r}.

Multiply the left side by 1−r and all intermediate terms cancel. For a nontrivial Nth root of unity, rN=1r^N=1, so the sum is zero. For r=1, the sum is N; using the quotient without taking the limit would divide by zero.

This one identity proves QFT column orthogonality and determines finite-precision phase-estimation peaks. Binary Hadamard cancellation is a related character-orthogonality identity for XOR rather than addition modulo N.

A.6 Continued fractions by recurrence

For partial quotients a0,a1,…a_0,a_1,\ldots, initialize p−2=0,p−1=1,q−2=1,q−1=0p_{-2}=0,p_{-1}=1,q_{-2}=1,q_{-1}=0. Then

pk=akpk−1+pk−2,qk=akqk−1+qk−2.p_k=a_kp_{k-1}+p_{k-2},\qquad q_k=a_kq_{k-1}+q_{k-2}.

The kth convergent is pk/qkp_k/q_k. For [0;2,1,170][0;2,1,170]: 0/10/1, 1/21/2, 1/31/3, and 171/512171/512 follow directly. In order finding, a good rational approximation still needs a modular check; the recurrence does not know the physical problem’s order.

A.7 Confidence and finite samples

For independent Bernoulli samples, the standard deviation of a sample proportion is p(1−p)/N\sqrt{p(1-p)/N}. Substituting p̂\hat p gives an estimated standard error, but near zero or one a naive normal interval can be misleading.

A distribution-free bound for independent bounded trials is Hoeffding’s inequality:

Pr(|p̂−p|≥ϵ)≤2e−2Nϵ2.\Pr(|\hat p-p|\ge\epsilon)\le2e^{-2N\epsilon^2}.

To make this at most δ, it suffices that N≥ln(2/δ)/(2ϵ2)N\ge\ln(2/\delta)/(2\epsilon^2). This is conservative but does not require an unknown p in the bound. It still assumes independence; repeated drift or correlated experimental errors need another analysis.

For several simultaneous claims, their combined error probability must be controlled. A union bound can allocate δ across them. Reporting many favorable outcomes from a large unreported search is not equivalent to testing one prespecified prediction.

A.8 Global phase in numerical comparisons

Two vectors may represent the same pure state while having different entries. Fidelity |⟨ψ|ϕ⟩|2|\langle\psi|\phi\rangle|^2 compares them without global-phase sensitivity. To compare entries, estimate the phase from a nonzero overlap and align one vector first.

Do not use phase-insensitive comparison when relative phases between controlled branches matter. A subroutine equal to a target up to phase may produce a different controlled operation if that phase is not tracked. The scope of the comparison must match the circuit’s use.