Haar projection (source code)

= Haar projection
{c}
{title2=$\Pi_{V_J}f=\sum_k\langle f,\phi_{J,k}\rangle\phi_{J,k}$}

= Haar approximation
{c}
{synonym}

= Haar wavelet projection
{c}
{synonym}

The <Haar projection> at level $J$ is the <orthogonal projection> onto the <functions> constant on level-$J$ <dyadic intervals>. On each cell it replaces $f$ by its <cell average>. This is the closest cellwise-constant approximation in the <L2 norm>, because choosing a constant $c$ on a cell minimizes $\int_I|f-c|^2$ at its <cell average>.

On $[0,1]$, take the <step function> with values $2,4,6,8$ on successive quarter-intervals. At level zero, its <Haar projection> is the constant $5$. At level one, it has values $3$ and $7$ on the two halves. At level two, it recovers the four original values exactly. With normalized <Haar wavelets>, these approximations are
$$
P_0f=5\phi,\qquad
P_1f=5\phi-2\psi,\qquad
P_2f=5\phi-2\psi-\frac1{\sqrt2}\psi_{1,0}-\frac1{\sqrt2}\psi_{1,1}.
$$
The coefficients are <L2 inner products>, so they differ from the discrete vector coefficients by the factor $1/\sqrt4=1/2$. Their squared sum also has a direct meaning:
$$
\|f\|_2^2=\frac{2^2+4^2+6^2+8^2}{4}
=30=5^2+(-2)^2+\left(-\frac1{\sqrt2}\right)^2+\left(-\frac1{\sqrt2}\right)^2.
$$
The approximation errors in squared <L2 norm> of $P_0f,P_1f,P_2f$ are respectively $5,1,0$: each added detail removes exactly its own squared coefficient from the error.

\Image[/haar-wavelet-multiscale-reconstruction.png]
{title=Coarse mean, half-interval contrasts and quarter-interval details reconstruct the same four-step function}

The <Haar projection> can be expressed using level-$J$ <Haar scaling functions>, or through a coarse scaling family and the <Haar wavelets> at intermediate levels. On $[0,1]$ with lowest level zero, that coarse family is the single constant function $\phi$. On the whole <real line>, use the integer translates of a coarse <Haar scaling function> instead; one global constant is not <square-integrable>. Refinement improves the representation while retaining the earlier coefficients.