Trace
So far, we have studied vectors, matrices, eigenvalues, orthogonality, and quadratic forms, all
within the concrete world of \(\mathbb{R}^n\). This page marks a quiet turning point. On the
surface, the trace looks like just another scalar attached to a square matrix: the sum of its
diagonal entries. But this simple operation will lead us, within a few paragraphs, to an inner
product on the space of \(m \times n\) matrices, a space that is not \(\mathbb{R}^n\). Once
"inner product" and "norm" are shown to live on spaces other than \(\mathbb{R}^n\), a larger
question becomes unavoidable: What exactly is a norm? What is a distance? The final section
of this page opens that door. The rest of the curriculum, beginning with the foundations of
analysis, walks through it.
Despite its simple definition, the trace has deep connections to eigenvalues and matrix norms, and appears
throughout optimization and machine learning. Its cyclic permutation property, in particular, makes it
indispensable for manipulating matrix expressions.
Definition: Trace
The trace of an \(n \times n\) matrix \(A\) is the sum of the diagonal entries
of \(A\) and is denoted by \(\operatorname{tr}(A)\):
\[
\operatorname{tr}(A) =\sum_{k=1}^n a_{kk}.
\]
The trace satisfies several important properties:
Theorem: Properties of Trace
Let \(A, B\) be \(n \times n\) matrices and \(c \in \mathbb{R}\). The trace satisfies:
- Linearity: \(\operatorname{tr}(cA) = c \operatorname{tr}(A)\)
- Additivity: \(\operatorname{tr}(A + B) = \operatorname{tr}(A) + \operatorname{tr}(B)\)
- Transpose invariance: \(\operatorname{tr}(A^\top) = \operatorname{tr}(A)\)
- Frobenius inner product: \(\operatorname{tr}(A^\top B) = \sum_{i=1}^n \sum_{j=1}^n a_{ij} b_{ij}\)
- Cyclic permutation: \(\operatorname{tr}(AB) = \operatorname{tr}(BA)\)
- Eigenvalue sum: \(\operatorname{tr}(A) = \sum_{i=1}^n \lambda_i\) where \(\lambda_1, \ldots, \lambda_n\)
are the eigenvalues of \(A\) (counted with algebraic multiplicity, over \(\mathbb{C}\)).
Note that Property 5 extends to rectangular matrices. If \(A\) is \(m \times n\) and \(B\) is
\(n \times m\), then both \(AB\) and \(BA\) are square and
\(\operatorname{tr}(AB) = \operatorname{tr}(BA)\). More generally,
\(\operatorname{tr}(ABC) = \operatorname{tr}(CAB) = \operatorname{tr}(BCA)\). Property 4
generalizes to \(A, B \in \mathbb{R}^{m \times n}\) with the double sum running over
\(1 \leq i \leq m\) and \(1 \leq j \leq n\). We revisit this in the definition of the Frobenius
inner product below.
Proof (sketch):
Properties 1, 2 follow immediately from the diagonal-sum definition and the linearity of summation.
For Property 3, note that \((A^\top)_{ii} = a_{ii}\), so \(\operatorname{tr}(A^\top) = \sum_i (A^\top)_{ii} = \sum_i a_{ii} = \operatorname{tr}(A)\).
For Property 5, compute directly from the definitions of trace and matrix product:
\[
\begin{align*}
\operatorname{tr}(AB)
&= \sum_{i=1}^n (AB)_{ii} \\\\
&= \sum_{i=1}^n \sum_{j=1}^n a_{ij} b_{ji} \\\\
&= \sum_{j=1}^n \sum_{i=1}^n b_{ji} a_{ij} \\\\
&= \sum_{j=1}^n (BA)_{jj} \\\\
&= \operatorname{tr}(BA),
\end{align*}
\]
where the middle equality interchanges the order of a finite double sum.
Property 4 follows from the same kind of direct computation. It does not require
Property 5. Expanding the product entrywise:
\[
\begin{align*}
\operatorname{tr}(A^\top B)
&= \sum_{i=1}^n (A^\top B)_{ii} \\\\
&= \sum_{i=1}^n \sum_{j=1}^n (A^\top)_{ij} b_{ji} \\\\
&= \sum_{i=1}^n \sum_{j=1}^n a_{ji} b_{ji}.
\end{align*}
\]
Renaming dummy indices (swap \(i \leftrightarrow j\)) gives \(\sum_{i=1}^n \sum_{j=1}^n a_{ij} b_{ij}\), matching the stated form.
Property 6 requires the
characteristic polynomial.
Write \(p_A(\lambda) = \det(\lambda I - A)\), which has the same roots as
\(\det(A - \lambda I)\) because the two differ by the factor \((-1)^n\). We first show by
induction on \(n\) that \(p_A\) is a monic polynomial of degree \(n\) whose coefficient of
\(\lambda^{n-1}\) is \(-\operatorname{tr}(A)\). For \(n = 1\) it is \(\lambda - a_{11}\). For
\(n \geq 2\), expand \(\det(\lambda I - A)\) along the first row as in the
definition of the determinant.
The term \(j = 1\) is \((\lambda - a_{11}) \det(\lambda I - A_{11})\), where \(A_{11}\) is \(A\)
with its first row and column deleted, and by the induction hypothesis this equals
\(\lambda^n - (a_{11} + \operatorname{tr}(A_{11}))\lambda^{n-1} + \cdots = \lambda^n - \operatorname{tr}(A)\lambda^{n-1} + \cdots\).
For \(j \geq 2\) the term is \((-1)^{1+j}(-a_{1j})\) times the determinant of a minor in which only
\(n - 2\) rows contain \(\lambda\). Since every product in the cofactor expansion uses exactly
one entry from each row, that term has degree at most \(n - 2\). Over \(\mathbb{C}\), the
fundamental theorem of algebra factors the monic polynomial \(p_A\) as
\(\prod_{i=1}^n (\lambda - \lambda_i)\), where the \(\lambda_i\) are its roots counted with
multiplicity, that is, the eigenvalues of \(A\) counted with
algebraic multiplicity.
Comparing
the coefficient of \(\lambda^{n-1}\) gives \(\operatorname{tr}(A) = \sum_i \lambda_i\).
Insight: The Trace Trick
Consider a quadratic form \(\mathbf{x}^\top A \mathbf{x} \in \mathbb{R}\).
While this expression is a scalar, we often rewrite it using the trace operator to gain
structural advantages:
\[
\mathbf{x}^\top A \mathbf{x} = \operatorname{tr}(\mathbf{x}^\top A \mathbf{x}) = \operatorname{tr}(A \mathbf{x} \mathbf{x}^\top).
\]
This "trace trick" is used throughout computer science and statistics for the following reasons:
-
Decoupling System and Data.
It separates the system matrix \(A\) from the data-dependent rank-1 matrix
\(\mathbf{x} \mathbf{x}^\top\). In the original form, \(A\) is "sandwiched" between vectors,
making it difficult to analyze the contribution of \(A\) and \(\mathbf{x}\) independently.
-
Computational Efficiency (The Summation Trick).
Suppose we need to compute the average of quadratic forms over \(N\) data points. The trace trick lets
us factor it through the second-moment matrix \(\Sigma\) (the covariance matrix when
the data are centered):
\[
\begin{align*}
\frac{1}{N} \sum_{i=1}^N \mathbf{x}_i^\top A \mathbf{x}_i
&= \operatorname{tr}\!\left( A \cdot \frac{1}{N} \sum_{i=1}^N \mathbf{x}_i \mathbf{x}_i^\top \right) \\\\
&= \operatorname{tr}(A \Sigma).
\end{align*}
\]
Once \(\Sigma\) has been computed, the average for any further matrix \(A\) costs the single trace
\(\operatorname{tr}(A\Sigma)\) instead of \(N\) vector-matrix-vector products.
-
Structural Analysis.
This form is the gateway to advanced topics like the expectation of quadratic
forms. In statistics, \(\mathbb{E}[\mathbf{x}^\top A \mathbf{x}]\) simplifies to
\(\operatorname{tr}(A \, \mathbb{E}[\mathbf{x} \mathbf{x}^\top])\), which is awkward to
express without the trace trick.
Although \(\mathbf{x}^\top A \mathbf{x}\) is a \(1 \times 1\) scalar, the internal term
\(A \mathbf{x} \mathbf{x}^\top\) is an \(n \times n\) matrix. The trace "compresses" this matrix
back to the scalar.
Property 4 deserves a closer look. Up to this point, the
inner product has
lived on \(\mathbb{R}^n\): a structure on arrows in \(n\)-dimensional space. But nothing in the
defining axioms of an inner product (bilinearity, symmetry, positivity) is tied to \(\mathbb{R}^n\).
Property 4 reveals more than a formula. The trace defines an inner product on an entirely
different space, the space \(\mathbb{R}^{m \times n}\) of matrices. The formula
\(\langle A, B \rangle_F = \operatorname{tr}(A^\top B)\) satisfies all the same axioms, since the
double sum is the ordinary dot product of the \(mn\) entries, just with matrices playing the role
that vectors played before. The notion of "inner product" survives the transplant intact.
This is the first hint of a general pattern. Inner products, and the norms and distances they
induce, are abstract structures that can live on many different vector spaces. We give this
instance a name.
Definition: Frobenius Inner Product
For matrices \(A, B \in \mathbb{R}^{m \times n}\), the Frobenius inner product is defined as:
\[
\left\langle A, B \right\rangle_F = \operatorname{tr}(A^\top B) = \sum_{i=1}^m \sum_{j=1}^n a_{ij} b_{ij}.
\]
Definition: Frobenius Norm
The Frobenius norm of a matrix \(A \in \mathbb{R}^{m \times n}\) is defined as
\[
\begin{align*}
\| A \|_F
&= \sqrt{\left\langle A, A \right\rangle_F} \\\\
&= \sqrt{\operatorname{tr}(A^\top A)} \\\\
&= \sqrt{\sum_{i=1}^m \sum_{j=1}^n a_{ij}^2}.
\end{align*}
\]
This is one of many possible matrix norms. Each norm emphasizes different aspects of a matrix's structure
and is suited to different applications.
Norms
While the trace characterizes matrices through a single scalar, norms provide a way to measure the
"size" or "magnitude" of both vectors and matrices. In machine learning, norms are fundamental for
training stability, and they are used to scale data to a common range, so that no feature dominates
merely because of its units. This normalization process is important in distance-based
models such as
support vector machines (SVMs) and
\(k\)-nearest neighbors (k-NN). Norms also appear in
regularization, which penalizes model
complexity to avoid overfitting and help the model generalize to new data.
We begin with norms on vectors. The Euclidean norm used throughout linear algebra is the case
\(p = 2\) of the following family.
Definition: \(p\)-Norm
For \(p \geq 1\), the \(p\)-norm of a vector \(\mathbf{x} \in \mathbb{R}^n\) is
\[
\| \mathbf{x} \|_p = \left( \sum_{i=1}^n |x_i|^p \right)^{1/p}.
\]
The restriction \(p \geq 1\) ensures the triangle inequality holds (Minkowski's inequality,
which we do not prove here). For \(0 \lt p \lt 1\) and \(n \geq 2\), the expression above still
defines a function but fails to be a norm, since the standard basis vectors satisfy
\(\|\mathbf{e}_1 + \mathbf{e}_2\|_p = 2^{1/p} \gt 2 = \|\mathbf{e}_1\|_p + \|\mathbf{e}_2\|_p\).
The case \(p = 1\) gives the Manhattan norm (or \(\ell_1\) norm), common in
grid-based environments. It also serves as a regularizer when we need sparsity in models
such as Lasso regression.
When \(p \to \infty\), we obtain the maximum norm:
\[
\| \mathbf{x} \|_\infty = \lim_{p \to \infty} \| \mathbf{x} \|_p = \max_{i} |x_i|.
\]
The limit exists and equals the maximum because
\(\max_i |x_i| \leq \|\mathbf{x}\|_p \leq n^{1/p} \max_i |x_i|\) and \(n^{1/p} \to 1\). In numerical
analysis, the maximum norm is used for "worst-case" error analysis. Similarly, in machine learning,
it appears when we want to minimize the worst error rather than the total error across sample data.
For matrices, a popular alternative to the Frobenius norm is the nuclear norm
(also called the trace norm).
Definition: Nuclear Norm (Trace Norm)
Given a matrix \(A \in \mathbb{R}^{m \times n}\), the nuclear norm of \(A\) is defined as the sum of its
singular values:
\[
\| A \|_{\ast} = \sum_{i=1}^{\min(m,n)} \sigma_i \geq 0.
\]
That \(\|\cdot\|_{\ast}\) satisfies the triangle inequality is not obvious. We prove it later on this
page, once the spectral norm is available, as a consequence of the
variational characterization of the nuclear norm.
To compute the nuclear norm through the square root of a positive semidefinite matrix, we first
record that such a square root exists and is unique.
Theorem: Square Root of a Positive Semidefinite Matrix
Let \(S \in \mathbb{R}^{n \times n}\) be symmetric and
positive semidefinite.
Then there is exactly one symmetric positive semidefinite matrix \(R \in \mathbb{R}^{n \times n}\)
with \(R^2 = S\). We denote it by \(\sqrt{S}\). If \(S = Q \Lambda Q^\top\) with \(Q\) orthogonal
and \(\Lambda = \operatorname{diag}(\lambda_1, \ldots, \lambda_n)\), then every \(\lambda_i \geq 0\) and
\[
\sqrt{S} = Q \operatorname{diag}\!\left(\sqrt{\lambda_1}, \ldots, \sqrt{\lambda_n}\right) Q^\top.
\]
Proof:
Existence.
By the spectral theorem,
\(S\) has a factorization \(S = Q \Lambda Q^\top\) with \(Q\) orthogonal and
\(\Lambda = \operatorname{diag}(\lambda_1, \ldots, \lambda_n)\). Fix any such factorization and write
\(\mathbf{q}_i = Q\mathbf{e}_i\) for the \(i\)-th column of \(Q\). Positive semidefiniteness gives
\[
\lambda_i = \mathbf{e}_i^\top \Lambda \mathbf{e}_i = \mathbf{q}_i^\top S \mathbf{q}_i \geq 0.
\]
Set \(R = Q \Lambda_+ Q^\top\) with \(\Lambda_+ = \operatorname{diag}(\sqrt{\lambda_1}, \ldots, \sqrt{\lambda_n})\).
Then \(R\) is symmetric,
\[
\begin{align*}
R^2 &= Q \Lambda_+ Q^\top Q \Lambda_+ Q^\top \\\\
&= Q \Lambda_+^2 Q^\top = S,
\end{align*}
\]
and for every \(\mathbf{x} \in \mathbb{R}^n\), putting \(\mathbf{y} = Q^\top \mathbf{x}\),
\[
\begin{align*}
\mathbf{x}^\top R \mathbf{x} &= \mathbf{y}^\top \Lambda_+ \mathbf{y} \\\\
&= \sum_{i=1}^n \sqrt{\lambda_i}\, y_i^2 \geq 0.
\end{align*}
\]
So \(R\) is a symmetric positive semidefinite square root of \(S\), and it satisfies
\(R\mathbf{q}_i = Q \Lambda_+ \mathbf{e}_i = \sqrt{\lambda_i}\, \mathbf{q}_i\) for every \(i\).
Uniqueness.
Let \(R'\) be any symmetric positive semidefinite matrix with \(R'^2 = S\).
Then \(R'S = R'^3 = SR'\). Fix an eigenvalue \(\mu\) of \(S\) and let
\(E_\mu = \{\mathbf{v} \in \mathbb{R}^n : S\mathbf{v} = \mu\mathbf{v}\}\), of dimension \(k \geq 1\).
For \(\mathbf{v} \in E_\mu\) we have \(S(R'\mathbf{v}) = R'S\mathbf{v} = \mu R'\mathbf{v}\), so \(R'\)
maps \(E_\mu\) into itself. Let \(P \in \mathbb{R}^{n \times k}\) have as columns an orthonormal basis
\(\mathbf{p}_1, \ldots, \mathbf{p}_k\) of \(E_\mu\) (the
Gram-Schmidt process
followed by normalization provides one). By the
coordinate formula for an orthogonal basis,
every \(\mathbf{v} \in E_\mu\) satisfies
\(\mathbf{v} = \sum_{j=1}^k (\mathbf{p}_j^\top \mathbf{v})\, \mathbf{p}_j = PP^\top \mathbf{v}\). Every column of
\(R'P\) lies in \(E_\mu\), so \(R'P = PC\) with \(C = P^\top R' P \in \mathbb{R}^{k \times k}\).
The matrix \(C\) is symmetric, so the spectral theorem gives \(C = Z \Gamma Z^\top\) with \(Z\)
orthogonal and \(\Gamma = \operatorname{diag}(\gamma_1, \ldots, \gamma_k)\). The columns of \(PZ\) are
orthonormal, since \((PZ)^\top PZ = Z^\top P^\top P Z = I_k\), and they lie in \(E_\mu\). Orthonormal
vectors are linearly independent, and there are \(k = \dim E_\mu\) of them, so they form an
orthonormal basis of \(E_\mu\). Moreover \(R'PZ = PCZ = PZ\Gamma\), so the \(j\)-th column
\(\mathbf{u}\) of \(PZ\) satisfies \(R'\mathbf{u} = \gamma_j \mathbf{u}\). Then
\(\gamma_j = \mathbf{u}^\top R' \mathbf{u} \geq 0\) and
\[
\gamma_j^2 \mathbf{u} = R'^2 \mathbf{u} = S\mathbf{u} = \mu \mathbf{u},
\]
so \(\gamma_j = \sqrt{\mu}\). Hence \(R'\) acts as \(\sqrt{\mu}\) on a basis of \(E_\mu\), that is,
\(R'\mathbf{v} = \sqrt{\mu}\,\mathbf{v}\) for every \(\mathbf{v} \in E_\mu\).
Finally, each column \(\mathbf{q}_i\) of \(Q\) satisfies \(S\mathbf{q}_i = Q\Lambda\mathbf{e}_i = \lambda_i \mathbf{q}_i\),
so \(\mathbf{q}_i \in E_{\lambda_i}\) and therefore
\[
R'\mathbf{q}_i = \sqrt{\lambda_i}\,\mathbf{q}_i = R\mathbf{q}_i.
\]
The \(\mathbf{q}_i\) form a basis of \(\mathbb{R}^n\), so \(R' = R\). In particular \(R\) does not depend on
the chosen factorization of \(S\), which justifies the formula in the theorem.
Theorem: Nuclear Norm via SVD
Let \(A \in \mathbb{R}^{m \times n}\) have
singular value decomposition
(SVD) \(A = U \Sigma V^\top\), and let \(\sqrt{A^\top A}\) denote the unique symmetric positive
semidefinite square root of \(A^\top A\) given by the
square root theorem (the theorem
applies because \(A^\top A\) is symmetric and
\(\mathbf{x}^\top A^\top A \mathbf{x} = \|A\mathbf{x}\|_2^2 \geq 0\) for every \(\mathbf{x} \in \mathbb{R}^n\)). Then
\[
\| A \|_{\ast} = \sum_{i=1}^{\min(m,n)} \sigma_i = \operatorname{tr}\!\left(\sqrt{A^\top A}\right).
\]
Proof:
Let \(A = U\Sigma V^\top\) be an SVD of \(A\), with \(U \in \mathbb{R}^{m \times m}\) and
\(V \in \mathbb{R}^{n \times n}\) orthogonal and \(\Sigma \in \mathbb{R}^{m \times n}\)
containing the singular values \(\sigma_1 \geq \cdots \geq \sigma_{\min(m,n)} \geq 0\) on its
diagonal. Since \(U^\top U = I_m\),
\[
A^\top A = V \Sigma^\top U^\top U \Sigma V^\top = V (\Sigma^\top \Sigma) V^\top,
\]
where \(\Sigma^\top \Sigma \in \mathbb{R}^{n \times n}\) is diagonal with entries
\(\sigma_1^2, \ldots, \sigma_{\min(m,n)}^2\) (padded with zeros if \(n \gt m\)). The displayed
identity is a factorization of the kind used in the
square root theorem, with
\(S = A^\top A\), \(Q = V\), and \(\Lambda = \Sigma^\top \Sigma\). That theorem therefore gives the
square root by taking nonnegative square roots of the diagonal entries \(\sigma_i^2\) and of the
padded zeros, namely \(\sqrt{\sigma_i^2} = \sigma_i\) (as \(\sigma_i \geq 0\)) and \(0\):
\[
\begin{align*}
\sqrt{A^\top A} &= V \, \Sigma_+ \, V^\top, \\\\
\Sigma_+ &= \operatorname{diag}(\sigma_1, \ldots, \sigma_{\min(m,n)}, 0, \ldots, 0).
\end{align*}
\]
Here \(\Sigma_+ \in \mathbb{R}^{n \times n}\), so \(\sqrt{A^\top A}\) is an \(n \times n\) matrix and its
trace is well-defined.
By the cyclic permutation property of trace (Property 5) together with \(V^\top V = I_n\),
\[
\begin{align*}
\operatorname{tr}\!\left(\sqrt{A^\top A}\right)
&= \operatorname{tr}(V \Sigma_+ V^\top) \\\\
&= \operatorname{tr}(\Sigma_+ V^\top V) \\\\
&= \operatorname{tr}(\Sigma_+) \\\\
&= \sum_{i=1}^{\min(m,n)} \sigma_i \\\\
&= \|A\|_{\ast}.
\end{align*}
\]
Each \(p\)-norm from the start of this section also induces
a notion of size for matrices.
Definition: Induced Norm
Given a vector \(p\)-norm on \(\mathbb{R}^n\) and \(\mathbb{R}^m\), the induced norm
(or operator norm) of a matrix \(A \in \mathbb{R}^{m \times n}\) is
\[
\begin{align*}
\| A \|_p
&= \max_{\mathbf{x} \neq \mathbf{0}} \frac{\| A \mathbf{x} \|_p}{\| \mathbf{x} \|_p} \\\\
&= \max_{\| \mathbf{x} \|_p = 1} \| A \mathbf{x} \|_p.
\end{align*}
\]
The two expressions are equal because the ratio \(\|A \mathbf{x}\|_p / \|\mathbf{x}\|_p\) is
invariant under nonzero scaling of \(\mathbf{x}\). The maximum is attained, not merely
approached, because \(\mathbf{x} \mapsto \|A\mathbf{x}\|_p\) is continuous on the closed and
bounded unit sphere, a fact we take from analysis.
Definition: Spectral Norm
When \(p = 2\), the induced norm is called the spectral norm of \(A\) and equals the largest singular value:
\[
\| A \|_2 = \sigma_{\max}(A) = \sqrt{\lambda_{\max}(A^\top A)},
\]
where \(\lambda_{\max}(A^\top A)\) is the largest eigenvalue of \(A^\top A\).
Derivation:
Let \(A = U \Sigma V^\top\) be an SVD with \(U, V\) orthogonal and singular values ordered as
\(\sigma_1 \geq \sigma_2 \geq \cdots \geq \sigma_{\min(m,n)} \geq 0\). The remaining singular
values \(\sigma_i\), \(\min(m,n) \lt i \leq n\), vanish, since \(A^\top A\) has rank at most
\(m\). For any \(\mathbf{x} \in \mathbb{R}^n\) with \(\|\mathbf{x}\|_2 = 1\), set
\(\mathbf{y} = V^\top \mathbf{x}\). Since \(V\) is orthogonal,
\(\|\mathbf{y}\|_2 = \|\mathbf{x}\|_2 = 1\) by the
norm-preserving property.
Similarly \(U\) preserves norms, so:
\[
\begin{align*}
\|A \mathbf{x}\|_2^2
&= \|U \Sigma V^\top \mathbf{x}\|_2^2 \\\\
&= \|\Sigma \mathbf{y}\|_2^2 \\\\
&= \sum_{i=1}^n \sigma_i^2 \, y_i^2.
\end{align*}
\]
Bounding above by the largest singular value,
\[
\begin{align*}
\|A \mathbf{x}\|_2^2
&= \sum_{i=1}^n \sigma_i^2 y_i^2 \\\\
&\leq \sigma_1^2 \sum_{i=1}^n y_i^2 \\\\
&= \sigma_1^2.
\end{align*}
\]
Equality is achieved by \(\mathbf{y} = \mathbf{e}_1\) (equivalently
\(\mathbf{x} = V \mathbf{e}_1\), the first right singular vector), which gives
\(\|A\mathbf{x}\|_2^2 = \sigma_1^2\). Thus \(\|A\|_2 = \sigma_1 = \sigma_{\max}\). The equality
\(\sigma_{\max} = \sqrt{\lambda_{\max}(A^\top A)}\) follows directly from the
definition of singular values
as \(\sigma_i = \sqrt{\lambda_i(A^\top A)}\).
The spectral norm is commonly used to control the Lipschitz continuity of functions in
neural networks. Bounding it
guards against exploding gradients, although an upper bound alone cannot
prevent vanishing ones.
For a symmetric matrix the spectral norm can be read off from the eigenvalues directly.
Corollary: Spectral Norm of a Symmetric Matrix
Let \(A \in \mathbb{R}^{n \times n}\) be symmetric, and let \(A = Q \Lambda Q^\top\) be any
factorization with \(Q\) orthogonal and \(\Lambda = \operatorname{diag}(d_1, \ldots, d_n)\) (one
exists by the
spectral theorem).
Then the set of eigenvalues of \(A\) is \(\{d_1, \ldots, d_n\}\), and
\[
\|A\|_2 = \max_{1 \leq i \leq n} |d_i|.
\]
Proof:
Each \(d_i\) is an eigenvalue, since \(AQ\mathbf{e}_i = Q\Lambda Q^\top Q\mathbf{e}_i = Q\Lambda\mathbf{e}_i = d_i\, Q\mathbf{e}_i\)
and \(Q\mathbf{e}_i \neq \mathbf{0}\). Conversely, if \(A\mathbf{v} = \lambda\mathbf{v}\) with
\(\mathbf{v} \neq \mathbf{0}\), then \(\mathbf{y} = Q^\top\mathbf{v} \neq \mathbf{0}\) satisfies
\(\Lambda\mathbf{y} = \lambda\mathbf{y}\), that is, \(d_i y_i = \lambda y_i\) for every \(i\). Choosing
\(i\) with \(y_i \neq 0\) gives \(\lambda = d_i\).
Since \(A\) is symmetric, \(A^\top A = A^2 = Q\Lambda^2 Q^\top\), and
\(\Lambda^2 = \operatorname{diag}(d_1^2, \ldots, d_n^2)\). The argument just given, applied to this
factorization of the symmetric matrix \(A^\top A\), shows that the set of eigenvalues of \(A^\top A\)
is \(\{d_1^2, \ldots, d_n^2\}\). By the
spectral norm formula,
\[
\begin{align*}
\|A\|_2 &= \sqrt{\lambda_{\max}(A^\top A)} \\\\
&= \sqrt{\max_{i} d_i^2} \\\\
&= \max_{i} |d_i|.
\end{align*}
\]
With the spectral norm in hand, we can settle the question left open after the definition of the
nuclear norm. The two norms are tied together through the
Frobenius inner product.
Theorem: Variational Characterization of the Nuclear Norm
For every \(A \in \mathbb{R}^{m \times n}\),
\[
\|A\|_{\ast} = \max_{\|W\|_2 \leq 1} \langle W, A \rangle_F,
\]
where \(W\) ranges over \(\mathbb{R}^{m \times n}\) and
\(\langle W, A \rangle_F = \operatorname{tr}(W^\top A)\).
Consequently \(\|\cdot\|_{\ast}\) is a norm on \(\mathbb{R}^{m \times n}\). For all
\(A, B \in \mathbb{R}^{m \times n}\) and \(c \in \mathbb{R}\),
\[
\begin{align*}
\|A\|_{\ast} = 0 &\iff A = 0, \\\\
\|cA\|_{\ast} &= |c| \, \|A\|_{\ast}, \\\\
\|A + B\|_{\ast} &\leq \|A\|_{\ast} + \|B\|_{\ast}.
\end{align*}
\]
Proof:
Upper bound.
Let \(A = U\Sigma V^\top\) be an SVD as in the proof of the
nuclear norm via SVD, so that all
off-diagonal entries of \(\Sigma\) vanish and \(\Sigma_{ii} = \sigma_i\) for \(1 \leq i \leq \min(m,n)\).
Fix \(W \in \mathbb{R}^{m \times n}\) with \(\|W\|_2 \leq 1\) and put
\(M = U^\top W V \in \mathbb{R}^{m \times n}\). The cyclic property of the trace (Property 5, applied to
the \(n \times n\) product \((W^\top U \Sigma) V^\top\)) and \(V^\top W^\top U = M^\top\) give
\[
\begin{align*}
\operatorname{tr}(W^\top A)
&= \operatorname{tr}(W^\top U \Sigma V^\top) \\\\
&= \operatorname{tr}(V^\top W^\top U \Sigma) \\\\
&= \operatorname{tr}(M^\top \Sigma) \\\\
&= \sum_{i=1}^{\min(m,n)} \sigma_i \, M_{ii},
\end{align*}
\]
where the last step is Property 4 for \(m \times n\) matrices, with only the diagonal entries of
\(\Sigma\) contributing.
Next, \(\|M\|_2 = \|W\|_2\). Indeed, \(U^\top\) is orthogonal (since \(UU^\top = I_m\)), so
\(U^\top\) preserves Euclidean length on \(\mathbb{R}^m\) and \(V\) preserves it on \(\mathbb{R}^n\), by the
norm-preserving property.
Hence, for \(\mathbf{x} \in \mathbb{R}^n\), \(\|M\mathbf{x}\|_2 = \|W(V\mathbf{x})\|_2\) and \(\|V\mathbf{x}\|_2 = \|\mathbf{x}\|_2\). As
\(\mathbf{x}\) runs over the unit sphere of \(\mathbb{R}^n\), so does \(V\mathbf{x}\) (with inverse
\(V^\top\)), and the two maxima in the
induced norm coincide. Now \(M_{ii}\)
is the \(i\)-th entry of \(M\mathbf{e}_i\), so
\[
\begin{align*}
|M_{ii}| &\leq \|M\mathbf{e}_i\|_2 \\\\
&\leq \|M\|_2 \, \|\mathbf{e}_i\|_2 \\\\
&= \|W\|_2 \leq 1.
\end{align*}
\]
Since every \(\sigma_i \geq 0\),
\[
\begin{align*}
\operatorname{tr}(W^\top A)
&\leq \sum_{i=1}^{\min(m,n)} \sigma_i \, |M_{ii}| \\\\
&\leq \sum_{i=1}^{\min(m,n)} \sigma_i \\\\
&= \|A\|_{\ast}.
\end{align*}
\]
The bound is attained.
Let \(J \in \mathbb{R}^{m \times n}\) have \(J_{ii} = 1\) for
\(1 \leq i \leq \min(m,n)\) and all other entries \(0\), and put \(W_0 = UJV^\top\). The matrix
\(M\) built from \(W_0\) is \(U^\top U J V^\top V = J\), so \(\|W_0\|_2 = \|J\|_2\) by the previous
paragraph. For \(\mathbf{x} \in \mathbb{R}^n\),
\(\|J\mathbf{x}\|_2^2 = \sum_{i=1}^{\min(m,n)} x_i^2 \leq \|\mathbf{x}\|_2^2\), with equality at
\(\mathbf{x} = \mathbf{e}_1\), so \(\|W_0\|_2 = 1\). The computation above gives
\(\operatorname{tr}(W_0^\top A) = \sum_i \sigma_i J_{ii} = \|A\|_{\ast}\). Hence the maximum exists
and equals \(\|A\|_{\ast}\).
Norm properties.
If \(\|A\|_{\ast} = 0\), the nonnegative numbers \(\sigma_i\) sum to zero,
so \(\Sigma = 0\) and \(A = U\Sigma V^\top = 0\). Conversely, every eigenvalue of
\(0^\top 0 = 0\) is zero, so all singular values of the zero matrix vanish. For homogeneity, the
linearity of the trace gives \(\operatorname{tr}(W^\top (cA)) = c\,\operatorname{tr}(W^\top A)\).
If \(c \geq 0\), taking the maximum over \(W\) gives \(\|cA\|_{\ast} = c\|A\|_{\ast}\). If
\(c \lt 0\), write \(c\,\operatorname{tr}(W^\top A) = |c|\operatorname{tr}((-W)^\top A)\) and note that
\(W \mapsto -W\) maps the set \(\{\|W\|_2 \leq 1\}\) onto itself (since
\(\|(-W)\mathbf{x}\|_2 = \|W\mathbf{x}\|_2\) for every \(\mathbf{x}\)), so again
\(\|cA\|_{\ast} = |c|\,\|A\|_{\ast}\). For the triangle inequality, every \(W\) with
\(\|W\|_2 \leq 1\) satisfies
\[
\begin{align*}
\operatorname{tr}(W^\top (A + B))
&= \operatorname{tr}(W^\top A) + \operatorname{tr}(W^\top B) \\\\
&\leq \|A\|_{\ast} + \|B\|_{\ast}
\end{align*}
\]
by the upper bound, and taking the maximum over \(W\) gives
\(\|A + B\|_{\ast} \leq \|A\|_{\ast} + \|B\|_{\ast}\).
In words, the nuclear norm is the largest value of the Frobenius inner product
\(\langle W, A \rangle_F\) over the unit ball of the spectral norm. This
is the sense in which the nuclear norm is called the dual norm of the spectral norm.
Introduction to Metric Spaces
Let us look back over the norms we have collected in the previous two sections: the Frobenius norm on
matrices, the \(p\)-norms on vectors (with the Manhattan and maximum norms as special cases), and the
nuclear and spectral norms measuring singular-value magnitudes. At first glance they feel ad hoc, each
invented for a specific purpose on a specific space. But something invariant runs through all of
them. Every norm we have seen turns differences into distances, and those distances satisfy three
properties: positive definiteness, symmetry, and the triangle inequality. These
three properties, and nothing more, are what "distance" actually is. When we extract them
from the vector setting and apply them to an arbitrary set, we arrive at one of the most fertile
structures in modern mathematics: the metric space.
Definition: Metric Space
A metric space is an ordered pair \((M, d)\) consisting of a nonempty set
\(M\) and a metric \(d\) on \(M\). The metric \(d\) is a function
\(d: M \times M \to \mathbb{R}\) that defines the distance between any two elements of \(M\).
For all \(a, b, c \in M\), the following axioms must hold:
- Positive definiteness: \(d(a,b) \geq 0\) with equality if and only if \(a = b\).
- Symmetry: \(d(a,b) = d(b,a)\).
- Triangle inequality: \(d(a,b) \leq d(a,c) + d(c, b)\).
Two things stand out in this definition. First, \(M\) is any nonempty set. It is not
required to be a vector space, and it is not required to have any algebraic structure at all. Points
could be matrices, functions, probability distributions, strings of DNA, or vertices of a graph.
Second, the axioms are minimal. Often we just say "the metric space \(M\)" when \(d\) is understood
from context.
Notational aside. For sets \(X\) and \(Y\), the Cartesian product is the set of ordered pairs
\[
X \times Y = \{(x, y) \mid x \in X, y \in Y\},
\]
which is the natural domain for \(d\).
Every vector space
equipped with a norm becomes a metric space, since each metric axiom is inherited from the
corresponding property of the norm. The norm \(\|\cdot\|\) induces a metric via
\(d(\mathbf{u}, \mathbf{v}) = \|\mathbf{u} - \mathbf{v}\|\). This includes every setting we have
worked with so far. Even more specifically, most of the linear algebra so far has lived inside
inner product spaces, where the norm itself comes from an inner product:
\[
d(\mathbf{u}, \mathbf{v}) = \|\mathbf{u} - \mathbf{v}\| = \sqrt{\langle \mathbf{u} - \mathbf{v}, \mathbf{u} - \mathbf{v} \rangle}.
\]
The most familiar example is the Euclidean space \(\mathbb{R}^n\). But now the
Frobenius inner product has shown us that \(\mathbb{R}^{m \times n}\) carries exactly the same
structure. Both are special cases of a much broader family.
Why This Abstraction Matters for ML and CS
The convergence of iterative algorithms (gradient descent, Newton's method, EM, MCMC) is not
fundamentally about real numbers or Euclidean geometry. It is about whether successive iterates (for
MCMC, the successive distributions of the state) get closer to a limit, in some notion of
distance. The relevant notion depends on the space:
- On \(\mathbb{R}^n\), gradient descent is analyzed using the Euclidean metric.
- On spaces of matrices, low-rank recovery is analyzed using the Frobenius or nuclear norm.
- On spaces of probability distributions, convergence is measured by the Wasserstein metric, or by divergences such as the KL divergence, which is not a metric.
- On function spaces (where neural networks live in the infinite-width limit), a natural metric comes from an \(L^p\) norm.
Each metric here defines a different metric space. To speak the language of convergence in modern ML
(why an algorithm converges, at what rate, and to what limit), one must first speak the language of
metric spaces, which is exactly where
this path continues.