Approximation in $L^2$ by piecewise constant functions I would like to know if there is any general result on the approximation of $L^2$ functions by piecewise constant functions. More specifically, I'd like to know if the following approximability property is correct
for all $w\in V$, $\lim_{h\rightarrow 0}\inf_{w^h\in V^h}||w-w^h||=0$,
where $V=L^2([0, 1]^d)$, $V^h$ is the space of piecewise constant functions on a regular (orthogonal grid), with step $h$.
Could you point to any reference ?
 A: By "step $h$" I assume you mean the spacing of your grid points, i.e. $w^h$ is a linear combination of indicators of boxes of the form $\prod_i (x_i, x_i + h]$, where $x_i$ is perhaps an integer multiple of $h$, or something like that.  Then yes, it is true, and follows a standard approximation argument.  I'm too lazy to write the details here, but if you look up a proof that step functions are dense in $L^2$, essentially the same argument applies.  The key is that the set of all your boxes generates the Borel $\sigma$-algebra on $[0,1]^d$.
A: Let $1>\epsilon > 0$ be given. Let $w\in V$ be arbitrary. Since you know that $C^\infty$ is dense in $V$, let $f \in C^\infty$ be a smooth function such that
$$\Vert w - f \Vert_2 < \epsilon/2$$
Now since $f$ is continuous on the compact set $[0,1]^d$, by uniform continuity there exists $\delta >0$ such that for all $x,y \in [0,1]^d$
$$|x-y| < \delta \; \implies \; |f(x) - f(y)| < \epsilon/2$$
Now let $h$ be small enough, so that on each cube of the grid, the maximal distance of points is smaller than $\delta$. Then by choosing $w^h \in V^h$ to take on an arbitrary value of $f$ in each cube where $w^h$ is constant, we have
$$\Vert f - w^h \Vert_\infty^2 < \left(\epsilon/2\right)^2 \le \epsilon/2 $$
Hence 
\begin{eqnarray*}
\Vert w - w^h \Vert_2 &\le& \Vert w - f\Vert_2 + \Vert f - w^h \Vert_2  \\
&\le& \Vert w - f\Vert_2 + \lambda([0,1]^d) \cdot \Vert f - w^h \Vert_\infty \\
&<& \frac \epsilon 2 + \frac \epsilon 2 = \epsilon
\end{eqnarray*}
So that $V^h$ must be dense in $V$.
