Let $f \in L^p(\mathbb R^n)$ be given. Consider a partition of rectangles $I\_{ij}:=[x\_i,x\_{i+1}]\times [x\_j,x\_{j+1}]$ of $\mathbb R^2.$


Then, we may define the coefficients 


$$\alpha\_{ij}= \frac{1}{\left\lvert I\_{ij} \right\rvert} \int\_{I\_{ij}} f(s) \ ds$$


and consider the function $$g(x):=\sum\_{ij} \alpha\_{ij}\chi\_{I\_{ij}}(x).$$


I ask: If the distance between $x\_i$ and $x\_{i+1}$ goes uniformly in $i$ to zero. Does this imply that $g$ converges in $L^p$ to $f$? The functions $\chi$ are just indicator functions.



Convergence of $L^p$ of approximation
$\newcommand{\al}{\alpha}
\newcommand{\de}{\delta}
\newcommand{\De}{\Delta}
\newcommand{\ep}{\varepsilon}
\newcommand{\ga}{\gamma}
\newcommand{\Ga}{\Gamma}
\newcommand{\la}{\lambda}
\newcommand{\Si}{\Sigma}
\newcommand{\thh}{\theta}
\newcommand{\R}{\mathbb{R}}
\newcommand{\F}{\mathcal{F}}
\newcommand{\E}{\operatorname{\mathsf E}} 
\newcommand{\PP}{\operatorname{\mathsf P}}
\newcommand{\ii}[1]{\operatorname{\mathsf I}\{#1\}} 
\renewcommand{\bar}{\overline}$ 


The answer is yes, at least for $p\ge1$. This follows because [compactly supported continuous functions are dense in $L^p$](http://planetmath.org/compactlysupportedcontinuousfunctionsaredenseinlp) and such functions are uniformly continuous. 


Here are details. For any $f\in L^p(\R^n)$, let $\bar f$ be defined as your function $g$: 
\begin{equation\*}
 \bar f:=\sum\_{ij} \al\_{f;ij}\chi\_{I\_{ij}}, 
\end{equation\*}
where 
\begin{equation\*}
 \al\_{f;ij}:=\frac1{|I\_{ij}|} \int\_{I\_{ij}} f(s)\,ds. 
\end{equation\*}


Take any real $\ep\in(0,1)$ and take any continuous function $f\_\ep$ with a support $K\_\ep\subseteq[-M\_\ep,M\_\ep]^n$ for some real $M\_\ep>0$ such that 
\begin{equation\*}
 \|f-f\_\ep\|\_p<\ep. \tag{1}
\end{equation\*}
Let $$\ep\_1:=\ep/(2M\_\ep+2)^{n/p}.$$ 
By the uniform continuity of $f\_\ep$, there is some real $\de\_\ep>0$ such that 
\begin{equation\*}
 |f\_\ep-\bar{f\_\ep}|=\sum\_{ij} |f\_\ep-\bar{f\_\ep}|\,\chi\_{I\_{ij}}\le
 \sum\_{ij} \ep\_1\chi\_{I\_{ij}}=\ep\_1
\end{equation\*}
as soon as 
\begin{equation\*}
 \max\_i(x\_{i+1}-x\_i)<\de\_\ep. \tag{2}
\end{equation\*}
Hence, 
\begin{multline\*}
 \|f\_\ep-\bar{f\_\ep}\|\_p^p
 =\int\_{\R^n} |f\_\ep-\bar{f\_\ep}|^p
 =\int\_{[-M\_\ep-1,M\_\ep+1]^n} |f\_\ep-\bar{f\_\ep}|^p \\ 
 \le\ep\_1^p(2M\_\ep+2)^n=\ep^p. \tag{3}
\end{multline\*}
Also, for $h:=f-f\_\ep$, by Jensen's inequality and (1),
\begin{multline\*}
 \|\bar f-\bar{f\_\ep}\|\_p^p=\|\,\bar h\,\|\_p^p=\int\_{\R^n}|\,\bar h\,|^p
 =\sum\_{ij}\int\_{I\_{ij}}|\,\bar h\,|^p
 =\sum\_{ij}|\,\bar h\,|^p\,|I\_{ij}| \\ 
 \le\sum\_{ij}\bar{|h|^p}\,|I\_{ij}|
 =\sum\_{ij}\int\_{I\_{ij}}|h|^p
 =\|h\|\_p^p=\|f-f\_\ep\|\_p^p<\ep^p. \tag{4}
\end{multline\*}
Thus, by (1), (3), (4), and Minkowski's inequality, 
\begin{equation\*}
 \|f-\bar f\|\_p\le3\ep
\end{equation\*}
as soon as (2) holds. 


