$f:[a,b] \to R$ is continuous and $\int_a^b{f(x)g(x)dx}=0$ for every continuous function $g:[a,b]\to R$ $f:[a,b] \to R$ is continuous and $\int_a^b{f(x)g(x)dx}=0$ for every continuous function $g:[a,b]\to R$ with $g(a)=g(b)=0$. Must $f$ vanish identically?

Using integration by parts I got the form:
$\int_a^bg(x)f(x)-g'(x)F(x)=0$. Where $F'(x)=f(x)$.
 A: In particular, putting $g(x)=(x-a)(b-x)f(x)$, we have $\int_a^b{(x-a)(b-x)f(x)^2dx}=0$. The integrand is non-negative in $[a,b]$, so $f = 0$ almost everywhere. As $f$ is continuous, $f$ must be identically zero.
A: Suppose $f(x_0)>0$ for some $x_0\in(a,b)$. Then there exists $\delta>0$ such that, for $|x-x_0|<\delta$, $f(x)>k>0$ (take $k=f(x_0)/2$, for instance), with $(x_0-\delta,x_0+\delta)\subseteq(a,b)$.
Now build a function $g$ by decreeing that
$$
g(x)=\begin{cases}
0 & \text{if $a\le x< x_0-\delta$}\\[3px]
? & \text{if $x_0-\delta\le x<x_0-\delta/2$}\\[3px]
1 & \text{if $x_0-\delta/2\le x\le x_0+\delta/2$}\\[3px]
? & \text{if $x_0+\delta/2<x\le x_0+\delta$}\\[3px]
0 & \text{if $x_0+\delta<x\le b$}
\end{cases}
$$
where $?$ stands for the values of the segment that makes the function continue in the two intervals (you can easily compute the formula).
Then $f(x)g(x)=0$ outside of $(x_0-\delta,x_0+\delta)$, non negative in this interval and strictly positive on $[x_0-\delta/2,x_0+\delta/2]$, so
$$
\int_{a}^b f(x)g(x)\,dx>0
$$
A: Suppose that there exists $x_0$ that $f(x_0)=\varepsilon \neq 0$, we can assume that $\varepsilon>0$ without loosing of generality. $f$ is continuous, so there exists $\delta$ such that for $x_1 \in (x_0-\delta,x_0+\delta) \subset (a,b)$ we have $f(x_1) > \frac{\varepsilon}{2}$. Now you can find such a function $g$, that $g(x_2)>1$ for $x_2 \in (x_0-\frac{\delta}{2},x_0+\frac{\delta}{2})$  and $g(x) \geq 0$ (for example piecewise linear), then you have:
$$\int_{a}^{b}f(x)g(x)dx \geq \int_{x_0-\frac{\delta}{2}}^{x_0+\frac{\delta}{2}}f(x)g(x)dx \geq 1 \cdot 2\delta \cdot \frac{\varepsilon}{2}=\delta \varepsilon>0$$
A: By the Stone Weierstrass Theorem, we can show that if $f$ is a continuous function on $[a,b]$ and $$\forall n \in \Bbb N:\ \int_a^b f(x)x^ndx=0$$
then $f=0$
Since we're only allowed to use functions that vanish in $a$ and $b$, then we have $$\forall n \in \Bbb N:\ \int_a^b f(x)(x-a)(b-x)x^ndx=0$$
So $x\rightarrow f(x)(x-a)(b-x) = 0$
So for $x\neq a,b$ $f(x)=0$
By continuity, $f=0$
A: Assume that for some $x_0\in(a,b)$ we have $f(x_0)>0$. Since $f$ is assumed to be continuous, this means that there is an $\epsilon>0$ such that $f(x)>0$ in $(x_0-\epsilon,x_0+\epsilon)$. Now let
$$g(x)=\begin{cases}
0 & x\notin(x_0-\epsilon,x_0+\epsilon)\\
x-x_0+\epsilon & x_0-\epsilon \le x \le x_0\\
x_0-x+\epsilon & x_0 < x \le x_0+\epsilon
\end{cases}$$
It is easy to see that $g(x)$ is continuous. Now $f(x)g(x)>0$ for $x_0-\epsilon < x < x_0+\epsilon$ and $=0$ otherwise. Therefore clearly $\int_a^b f(x)g(x)\,\mathrm dx > 0$, in contradiction to the claim that this integral vanishes for every continuous $g(x)$.
With an analogous argument we also get that $f(x_0)<0$ is not possible.
Thus we have proven that $f(x)=0$ for every $x\in (a,b)$. However since $x$ is continuous, it follows that also $f(a)=f(b)=0$.
A: The answer is yes. To prove it, define for $n$ big enough
$$g_n:\left[ a+\frac{1}{n} , b-\frac{1}{n}\right] \longrightarrow \Bbb{R} \quad \quad g_n(x)=f(x)$$
and then define $f_n:[a,b]\longrightarrow \Bbb{R}$ extending $g_n$ in a suitable way that $f_n(a)=0=f_n(b)$ and $f_n$ are uniformly bounded.
Then $$0=\int_a^bf(x)f_n(x) dx \to \int_a^bf(x)f(x) dx$$
so that $\int f^2 =0$ implies that $f$ is $0$.
