TITLE: Uniqueness of weak derivatives
QUESTION [6 upvotes]: Let $\Omega$ be an open set in $\mathbb{R}^n$ and let $f\in L^1_{\text{loc}}(\Omega)$. To show that weak derivatives are unique up to a set of measure zero, suppose $g_{x_i}, \tilde{g}_{x_i}\in L^1_{\text{loc}}(\Omega)$ are two weak derivatives of $f$ with respect to $x_i$. Then, 
$$\int_{\Omega}f\varphi_{x_i}\, dx=-\int_{\Omega}g_{x_i}\varphi\, dx$$
and $$\int_{\Omega}f\varphi_{x_i}\, dx=-\int_{\Omega}\tilde{g}_{x_i}\varphi\, dx$$ for any $\varphi\in C^{\infty}_c(\Omega)$. So we have $$\int_{\Omega}(g_{x_i}-\tilde{g}_{x_i})\varphi\,dx=0.$$
From here, how can I conclude $g_{x_i}=\tilde{g}_{x_i}$ almost everywhere on $\Omega$? If someone knows the answer, please let me know.

REPLY [9 votes]: Yes. We are to prove that if $f\in L^1_{\rm{loc}}(\Omega)$ satisfies $\displaystyle\int_{\Omega}f\varphi=0$ for all $\varphi\in C_{0}^{\infty}(\Omega)$, then $f=0$ a.e. on $\Omega$.
Let $K$ be any compact subset of $\Omega$, and take $\psi\in C_{0}^{\infty}(\Omega)$ such that $\psi=1$ on $K$. Define a function $f_\psi$ on $\mathbb{R}^n$ as 
\begin{equation*}
f_{\psi}(x)=
\begin{cases}
0 & x\notin\Omega, \\
f(x)\psi(x) & x\in\Omega.
\end{cases}
\end{equation*}
which extends $f$ canonically to the whole ${\bf{R}}^{n}$. Then $f_{\psi}\in L^{1}({\bf{R}}^{n})$. Pick a  mollifier $\varphi\in C_{0}^{\infty}({\bf{R}}^{n})$. Note that $\varphi_{\epsilon}\ast f_{\psi}\rightarrow f_{\psi}$ in $L^{1}_{\rm{loc}}({\mathbb{R}}^{n})$ as $\epsilon\to 0$. We have 
\begin{align*}
\varphi_{\epsilon}\ast f_{\psi}(x)=\int f(y)\psi(y)\varphi_{\epsilon}(x-y)dy,
\end{align*} 
and note that for a fixed $x$, the map $y\mapsto\psi(y)\varphi_{\epsilon}(x-y)\in C_{0}^{\infty}(\Omega)$, so $\varphi_{\epsilon}\ast f_{\psi}=0$ by hypothesis. As $\epsilon\to 0$, we have $\varphi_{\epsilon}\ast f_{\psi}\to f_{\psi}$ and thus $f_{\psi}=0$ a.e. on $\Omega$
Hence $f=0$ a.e. on $K$. Since $K$ is arbitrary compact subset of $\Omega$, we have $f=0$ a.e. on $\Omega$.