Show that if $w$ is continuous on $[0,1]$ and $\int_0^1wv\, dx=0$ then $w=0$ everywhere in $[0,1]$

continuityfinite element methodintegration

I was hoping someone could check my proof of the following. The problem comes from section 1.1 of Finite Element Method by Claes Johnson.

Problem statement:

Let $$V:=\{v: v \text{ is a continuous function on } [0,1],~v' \text{is piecewise continuous and bounded on } [0,1] \text{, and } v(0)=v(1)=0\}.$$

Show that if $w$ is continuous on $[0,1]$ and
$$ \int_0^1 wv\,dx=0~~~~\forall~v\in V$$
then $w(x)=0$ for $x\in[0,1]$.

Proof Attempt:

$\textit{Lemma:}$

For $w: [0,1] \mapsto \mathbb{R}$ which is continuous, there exists a collection of open intervals $P$ that contains all the points where $w(x)>0$. Similarly, there exists $M$ which captures the negative portions of $w$.
$$P:=\{(a,b)\subset [0,1]~|~f(x)>0~\forall x\in(a,b)\}$$
$$M:=\{(a,b)\subset [0,1]~|~f(x)<0~\forall x\in(a,b)\}$$

$\textit{Lemma Proof:}$

Let $x\in[0,1]$ and suppose $f(x)>0$. Let $\epsilon=|f(x)|$. Then by continuity there exists $\delta>0$ such that if $y\in B_{\delta}(x)$ then $f(y)\in B_\epsilon(f(x))$. Thus for every $x\in[0,1]$, there is an associated open interval $B_\delta(x)$ such that $f(B_\delta(x)) \subset B_\epsilon(f(x)) >0$. Let $P$ be the collection of all such open intervals, and define $M$ in a similar way.

This completes the proof of the lemma.

$\textit{Proof:}$

Let $P,M$ be defined as above for $w$, and let $v\in V$. Then
\begin{align}
\int_0^1wv\,dx &=\int_Pwv\,dx+\int_Mwv\,dx \\
&=\int_Pwv\,dx-\int_M|wv|\,dx
\end{align}
By assumption, the same is true for $-v\in V$.
\begin{align}
\int_0^1wv\,dx &=-\int_Pwv\,dx-\int_M|wv|\,dx \\
\end{align}
Subtracting the two equations above gives
$$2\int_Pwv\,dx=0$$
which implies that
$$\int_Mwv\,dx=0$$

Best Answer

You still have not shown $P=M=\emptyset$. Also (but this is a minor issue since such functions are sufficient for the proof) your proof requires that $v\ge 0$ or $v\le 0$ to work (otherwise $wv$ changes sign in $P$ or $M$).

The standard proof is by contradiction: choose $x_0$ with $w(x_0)\neq 0$, find an interval $(x_0-\delta,x_0+\delta)$ where $|w(x)-w(x_0)|<\frac{|w(x_0|}{2}$ and then construct a function $v$ that is positive only in $(x_0-\delta,x_0+\delta)$ such that $\int wv\, dx \neq 0$.