If $\int_0^1f(x)g(x)dx=0$ for all $g$ such that $g(0)=g(1)=0$ then $f=0$. Suppose that $f:[0,1]\to\Bbb R$ is a continuous function such that
$$\int_0^1f(x)g(x)dx=0$$
for all continuous functions $g:[0,1]\to\Bbb R$ such that $g(0)=g(1)=0$. I need to show that $f(x)=0$ for all $x\in[0,1]$.
My try: I am not sure how to do this. I know how to do it when we consider every functions from $[0,1]$ to $\Bbb R$, because in that case we can take $g(x)=f(x)$ and then $\int_0^1f(x)^2dx=0$ implies that $f(x)^2=0$ for all $x$ since $f(x)^2$ is continuous and non-negative. Thus, $f(x)=0$ for all $x$. But now if $f$ is not zero at $t=0$ and $t=1$ what can we do?
 A: Take $g\left(x\right)=f\left(x\right)\left(x-x^{2}\right)
 $. Then $$\int_{0}^{1}f^{2}\left(x\right)\left(x-x^{2}\right)dx=0
 $$ now for the mean value theorem for integrals we have that exists some $c\in\left(0,1\right)
 $ such that $$\left(c-c^{2}\right)\int_{0}^{1}f^{2}\left(x\right)dx=0
 $$ and so $f\equiv0$.
A: Take a sequence of continuous functions $g_n:[0,1]\to\Bbb R$ such that $g_n=f$ on the interval $[1/n,1-1/n]$ and $g_n(0)=g_n(1)=0$. For example, you can obtain this by taking a line from $(0,0)$ to $(1/n,f(1/n))$, then take $f$, and then take a line from $(1-1/n,f(1-1/n))$ to $(1,0)$. Then, 
$$\int_0^1f(x)g_n(x)dx=0,\quad\forall n\in\Bbb N$$
by assumption. Hence,
$$\int_0^1f(x)^2dx=\int_0^{1/n}f(x)^2dx+\int_{1-1/n}^nf(x)^2dx-\int_0^{1/n}f(x)g_n(x)dx-\int_{1-1/n}^nf(x)g_n(x)dx\tag{1}$$
for all $n$. We want to show that the limit as $n\to\infty$ of the right hand side goes to zero.
Since $f$ is continuous on $[0,1]$, it is bounded by some number $M>0$. Moreover, by our construction of $g_n$, we also have $|g_n(x)|\leq M$ for all $x$. Thus,
$$\left|\int_0^{1/n}f(x)g_n(x)dx\right|\leq\int_0^{1/n}|f(x)||g_n(x)|dx\leq \int_0^{1/n}M^2dx=\frac{M^2}{n}\to 0,$$
as $n\to\infty$. A similar calculation works for every term on the right hand side of $(1)$. Thus, by taking the limit as $n\to\infty$ we get
$$\int_0^1f(x)^2dx=0,$$
and as you said, this implies that $f(x)=0$ for all $x\in[0,1]$.
