# Approximation in $L^2$

Let $G$ be a domain assumed smooth enough. I want to show that the mean value $m$ is minimizing $m \rightarrow \| f-m\|_{ L^2(G)}$ for $f \in L^2(G)$. Is it unique? Is it allowed to derive under the integral?

-

There is no need to derivate inside the integra. To minimize $\|f-m\|_2$ is equivalent to minimize $$\int_G(f(x)-m)^2\,dx=\int_Gf(x)^2\,dx-2\,m\int_Gf(x)\,dx+m^2\int_Gdx.$$