How $\langle f,\phi\rangle_{L^2} = 0 \ (\le0)$ implies $f = 0 \ (\le0)$ I was reading a paper where I found a statement that if $f$ is some function in $L^2(\Omega)$ where $\Omega$ is an open subset of say $\mathbb R^d, d\ge2$, then

$f = 0 \ (\le0)$ in an open subset $A$ of $\Omega$ if $\langle
 f,\phi\rangle_{L^2} = 0 \ (\le0)$ for all $\phi\in H_0^1(A)$ (with
  $\phi\ge0$).

I am not getting how to solve this as to get $f=0$ is quite visible but that too only if I take $\phi\in \mathbb D(A)$.
Please suggest way on how to proceed with this
Any type of help will be appreciated. Thanks in advance.
 A: So, if I understood correctly you want to prove: $$
\big\{\langle f,\phi\rangle =0 , \ \forall \phi \in L^2(A), \ \phi\geq 0 \ \hbox{in } A\big\} \quad \implies \quad f\equiv 0.
$$
In fact, let's proceed by contradiction. So, assume that $\langle f,\phi\rangle=0$ for all positive $\phi\in L^2(A)$ but that $f\neq 0$ a.e.. Thus, there exists a Lebesgue point $x_0\in A$ such that $f(x_0)=c\neq 0$ for some $c\in\mathbb{R}$. Then, consider a sequence of positive functions $\phi_n \in C^\infty_0(A)$ with supports satisfying $$
\mathrm{supp}(\phi_n)=(x_0-\tfrac{2}{n},x_0+\tfrac{2}{n}).$$
Additionally, suppose that $\phi'(x)\geq 0$ for all $x\leq x_0$, $\phi'(x)\leq 0$ for all $x\geq x_0$ and $$
\forall x\in (x_0-\tfrac{1}{n},x_0+\tfrac{1}{n}), \quad  \phi(x)\equiv \tfrac{n}{2},
$$
(basically, $\phi_n$ is a family of bump functions shrinking to $x_0$). Then, by Lebesgue's differentiation Theorem (notice that here we are using the fact that $x_0$ is a Lebesgue point) we conclude
$$
\lim_{n\to+\infty}\langle f,\phi_n\rangle=f(x_0)\neq 0.
$$
Hence, by continuity of the inner product (since $f\in L^2$ and $\{\phi_n\}\subset L^2$), for all $\varepsilon>0$ there exists $N\in\mathbb{N}$ sufficiently large such that for all integer $n\geq N$ we have $$
f(x_0)+\varepsilon\geq \langle f,\phi_n\rangle \geq f(x_0)-\varepsilon
$$
Hence, by taking $\varepsilon$ small enough we obtain a contradiction. Thus, $f\equiv 0$.
Edit: Notice that the proof shows that there is no need to consider the set of test functions to be $H^1_0$. It is enough to assume that the property holds for any function $\phi\in C_0^\infty(A)$, which of course is a strict subset of $H_0^1(A)$, which at the same time is a strict subset of $L^2$.
A: An attempt. Tell me what you think.
If equality holds for every $\phi$ positive, it also holds for every negative $\phi$ (just multiply by $-1$). Let $\phi$ change sign. Write $\phi = \phi^+ + \phi^-$. We know that
$$
\int_A f(\phi^+ - \phi^-) \ dx = 0 \implies \int_A f \phi^+ \ dx = \int_A f \phi^- \ dx. = 0. 
$$
Hence 
$$
\int_A f \phi \ dx = 0 \quad \forall \phi \in H_0^1(A).
$$
Since the equality holds for every $\phi \in C_c^\infty(A)$ and this space is dense in $L^2$, and since the functional $g \mapsto \int_A f(x) g(x) \ dx$ is continuous in $L^2$,we have that 
$$
\int_A f(x) g(x) \ dx = 0 \quad \forall g \in L^2(A).
$$
Putting $g = f$ yields the result.
A: I assume you already know that if $g\geq 0$ and $\int g\,dx=0$, then $g=0$ (btw, all these equalities and inequalities are to be understood in the almost everywhere sense).
I think the cleanest way to prove this is the following: Both claims would follow easily from the fact mentioned above if we could test with all $\phi\in L^2$. For the first claim we would take $\phi=f$ and for the second $\phi=f_+$.
Herewe are not allowed to take all $\phi\in L^2$, but we can still approximate. Of course $H^1_0$ is dense in $L^2$ (because it contains $C_c^\infty$), but the nonnegative functions in $H^1_0$ are also dense in the nonnegative functions in $L^2$. In fact, if $\phi\in H^1_0$, then $\phi_\pm\in H^1_0$, and if $\phi_n\to \phi$ in $L^2$, then $\phi_n^\pm\to \phi^\pm$ in $L^2$. I'll leave the last statement as an exercise (hint: $\nabla \phi_+=1_{\{\phi>0\}}\nabla \phi$).
Now if $f\in L^2$ and $\phi_n\in H^1_0$ such that $\phi_n\to f$, then
$$
\langle f,f\rangle_2=\lim_{n\to\infty}\langle f,\phi_n\rangle_2=0
$$
in the first case, and
$$
\langle f_+,f_+\rangle_2=\langle f,f_+\rangle_2=\lim_{n\to\infty}\langle f,\phi_n^-\rangle_2\leq 0
$$
in the second case.
