Analysis question about projections I just got back my exam and got $0$ marks in this question:
consider a continuously differentiable function $f: [0,1] \to [0, \infty)$ with $|f'(x)| \leq M$ for every $x \in [0,1]$. For each $n \geq 1 $consider also the $\sigma$-algebra  $\mathcal{G}_n$ generated by the interval $E_n(k) = [ \frac{k}{2^{n}}, \frac{k+1}{2^n}) \subset [0,1]$ with $k =0,1,2,...,2^n -1 $. The question was:
Give a formula for $f_n \in L^2([0,1])$ which is the projection of $f$ onto the space $\mathcal{G}_n$ of measurable functions. Show that $f_n$ is perperndicular to $f - f_n$.
I had no idea how to do this problem in exam. If someone can help me, I would be really thankful.
 A: This is so called conditional expectation operator. For your case the desired formula is
$$
f_n=
\mathcal{E}_n(f)
=\sum\limits_{k=0}^{2^n-1}\left(\frac{1}{\mu(E_n(k))}\int_{E_n(k)} f(s)d\mu(s)\right)\chi_{E_n(k)}
$$
For details see section 6.1 in Topics in Banach space theory. F. Albiac, N. Kalton.
I leave it to you to check that $f-f_n$ is orthogonal to $f_n$. 
A: It seems the following. 
Fix a number $n\ge 1$ and put $N=2^n$. Then the function $g$ is $\mathcal{G}_n$-measurable iff the restriction of $g$ on the halfinterval $E_n(k)$  is constant for every $k =0,1,2,\dots,N-1$. Define the set of all such functions as $\mathcal M_n$. Since $L^2([0,1])$ is a Hilbert space and $f_n$ is a projection of the function $f$ into the space $\mathcal M_n$, then  $(f-f_n,g)=0$ for each $g\in\mathcal M_n$. The space $\mathcal M_n$ has a natural basis $e_0,e_1,\dots, e_{N-1}$ where $e_i|E_n(k)\equiv 1$ if $i=k$ and $e_i|E_n(k)\equiv 0$ otherwise. Since $f_n\in \mathcal M_n$, there exist real numbers $c_0,c_1,\dots,c_{N-1}$ such that $f_n=\sum_{i=0}^{N-1} c_ie_i$. The function $f-f_n$ is orthogonal to the subspace $\mathcal M_n$ iff $( f-f_n,e_i)=0$ for each $i=0,1,2,\dots,N-1$. But 
$$(f-f_n,e_i)=\int_{E_n(i)}f-f_n d\mu=\int_{E_n(i)}fd\mu –\frac {c_i}{2^n}.$$
Therefore $c_i=2^n\int_{E_n(i)}fd\mu$ for each $i=0,1,2,\dots,N-1$.
