Let $H$ be a real or complex [Hilbert space](/page/Hilbert%20Space), let $(e_k)_{k \in I}$ be an [orthonormal basis](/page/Orthonormal%20Basis) of $H$, and let $f \in H$. For each $k \in I$, define the Fourier coefficient
paragraph
admin
\begin{align*}
a_k := (f,e_k)_H.
\end{align*}
latex_env
admin
Assume
paragraph
admin
\begin{align*}
f = \sum_{k \in I} a_k e_k
\end{align*}
latex_env
admin
with convergence in $H$. Let $(a_j^*)_{j \ge 1}$ be the nonincreasing rearrangement of the multiset $\{|a_k| : k \in I\}$, with zeros appended if only finitely many coefficients are nonzero.
paragraph
admin
Fix $n \in \mathbb{N}$ and assume that $I$ contains at least $n$ distinct indices. For a finite set $S \subset I$ with $|S| = n$, the unique best approximation to $f$ from $\operatorname{span}\{e_k : k \in S\}$ is
paragraph
admin
\begin{align*}
P_S f := \sum_{k \in S} a_k e_k.
\end{align*}
latex_env
admin
Moreover, for the dictionary $\mathcal{D} := \{e_k : k \in I\}$,
then $P_S f$ is a best $n$-term approximant. If no such set exists, then no $n$-term approximant attains the infimum, but the displayed formula still gives the infimum of the squared errors.