I'd like to prove that, if $f\in {L^1}_{loc}(\mathbb{R}^n)$ and $g$ is a bounded, measurable function with compact support and if $\int_{\mathbb{R}^n} fgdx = 0$ $\forall g$, then $f$ is almost everywhere equal to $0$.
Surely $fg\in L^1(\mathbb{R}^n)$: by hypothesis, $|g|\leq c\in\mathbb{R}$, so we have
$||fg||_1=\int_{\mathbb{R}^n} |fg| dx\leq c\int_{K}|f|dx\leq +\infty$, where $K$ is the support of the function $g$. So I applied Lebesgue differentiation theorem to $fg$, in order to have
$lim_{r\to 0^{+}} \frac{1}{|B(x,r)|} \int_{B(x,r)} f(y)g(y)dy = f(x)g(x)$ almost everywhere, but now I don't know how to use the hypothesis about the integral of this product over $\mathbb{R}^{n}$. How can I proceed?
Since $g = 1_{B(x,r)}$ is measurable and bounded with compact support you could also proceed with your idea as follows:
$$\int_{B(x,r)} f = \int_{\Bbb R^n} fg = 0$$
Thus for almost every $x\in\Bbb R^n$ $$0 = \lim_{r\searrow 0} \frac{1}{\vert B(x,r)\vert} \int_{B(x,r)} f = f(x)$$