hard exercice in Lieb--Loss Analysis book I am looking the solution of the exercice 7.4 in the book Analysis of Lieb--Loss:
Suppose that $f\in H^1(\mathbb R^n)$. Show that for each $1\leq i\leq n$
$$
\int_{\mathbb R^n}|\partial_if|^2=\lim_{t\to 0}\frac{1}{t^2}\int_{\mathbb R^n}|f(x+t\mathbf{e}_i)-f(x)|^2{\rm d}x
$$
where $\mathbf{e}_i$ is the unit vector in the direction $i$.
My approach is to approximate $f\in H^1(\mathbb R^n)$ by a sequence of $C_c^\infty(\mathbb R^n)$ functions. Then we can check the above identity for this smooth with compact support function. But then I do not know how to go back to the function in $H^1(\mathbb R^n)$.
 A: You're right - since there is a limit $t \to 0$ involved, it's not obvious how to apply the density of $C_c^\infty$ in $W^{1,2}$. A priori it's not even clear that the limit exists. You can do it as follows. 
To simplify the notation, let 
$$
\partial^t_i f(x) := \frac{f(x + t e_i) - f(x)}{t}.
$$
Step 1. Check that $\| \partial_i^t f \|_{L^2} \le \| \partial_i f \|_{L^2}$ for each $f \in C_c^\infty$ and $t > 0$. 
Step 2. By density, the same holds also for $f \in W^{1,2}$. This shows that 
$$
\| \partial_i f \|_{L^2} \ge \limsup_{t \to 0} \| \partial_i^t f \|_{L^2}.
$$
Step 3. Consider $f \in W^{1,2}$. Assume that for some sequence $t_k \to 0$, $\partial_i^{t_k} f$ tends weakly in $L^2$ to some function $g \in L^2$, then $g$ is the distributional partial derivative $\partial_i f$. To see it, consider the integral $\int \partial_i^t f \varphi$ with some test function $\varphi \in C_c^\infty$, apply discrete integration by parts and take the limit. 
Note that weak convergence gives you $\| g \|_{L^2} \le \liminf_{k \to \infty} \| \partial_i^{t_k} f \|_{L^2}$ and so 
$$
\| \partial_i f \|_{L^2} \le \liminf_{t \to 0} \| \partial_i^t f \|_{L^2}.
$$
