Uniqueness of the weak derivative with the fundamental lemma of the Calculus of Variations I have a homework question where I need to prove why a specific integrable (but not continuous) function $u$ on the interval $[-1,1]$ has one and only one weak derivative. This raised the question of how to prove that if $f$ and $g$ are weak derivatives of an arbitrary integrable $u: [a,b] \to \mathbb{R}$, then $f = g$.
Given any $h \in C^1([a,b])$ that is zero at the endpoints, we obtain $\int_a^b [f(x)-g(x)]h(x) \, dx = 0$ from the definition of weak derivative. If $\varphi := f-g$ was continuous, then obviously we could just apply the fundamental lemma and we'd get $f=g$, but what if the finite or countable set $X \subset [a,b]$ of $\varphi$'s discontinuities is non-empty?
I've only looked at the finite case $X:=\{x_1,...,x_{n-1}\}, \, n \geq 2$, and partitioned the interval into the set of open intervals $I_{k} := (x_{k-1}, x_k), \, k=1,...,n$ (where $x_0=a$ and $x_n=b$). $\varphi h$ is continuous on all of these sub-intervals, and I'm trying to use a proof by strong induction: given $1 \leq p \leq n$, assume that $\varphi \equiv 0$ on $n-s$ of these intervals $I_k$ (for all $0 \leq s < p$) implies $\varphi \equiv 0$ on $[a,b]\setminus X$; now prove that if $\varphi \equiv 0$ on $n-p$ of the intervals, then $\varphi \equiv 0$ on $[a,b] \setminus X$. Since $X$ has measure zero, we show that $f=g$ up to a null set.
I think I can prove the case where $X$ is countable after I show it holds for the finite one.

You'd want to use the fact that $\{h \in C^1([a, b]) | h(a) = h(b) = 0\}$ is a dense subset of $L^1([a, b])$.
Consider the measurable set $S_n = \{x \in [a, b] | f(x) - g(x) > \frac{1}{n}\}$. Then approximate the characteristic function $\chi_S$ within $\epsilon$ by a function $k \in C^1([a, b])$ such that $k(a) = k(b) = 0$. Then we have $\int (f - g) k\; dx = 0$. Then we have $\int (f - g) \chi_S \; dx < \epsilon$ for all positive $\epsilon$. And we also have $\int (f - g) \chi_S \; dx \geq \frac{1}{n} \mu(S_n)$, where $\mu$ is the measure. Thus, we must have $\mu(S_n) = 0$.
Therefore, we have $\mu(\{x \in [a, b] | f(x) - g(x) > 0\}) = \mu(\bigcup\limits_{n = 0}^\infty S_n) \leq \sum\limits_{n = 0}^\infty \mu(S_n) = 0$.
Similarly, we have $\mu(\{x \in [a, b] | f(x) - g(x) < 0\}) = 0$.
Thus, we see $f = g$ almost everywhere.
