Constructing a polynomial bump function 
Proposition: Suppose $f$ is continuous and $\int_a^bf(x)x^ndx = 0$ for all $n$. Then $f$ is zero on $[a,b]$.

This can be proven by uniformly approximating $f$ with polynomials via the Weierstrass theorem. Before I heard this answer, I was trying to prove it by constructing a sort of polynomial bump function that would peak where $f(x)$ was nonzero, and be small outside that region. 
Suppose $f \neq 0$ on $[a,b]$ and suppose WLOG that $f(y)>0$. Choose $(c,d)$ such that $|f(x)|>|f(y)|/2$ on $(c,d)$ and choose $(\gamma,\delta)\supseteq (c,d)$ such that $f(x)>0$ on $(\gamma, \delta)$.
I want a polynomial that is $\geq 1$ on $(c,d)$ and uniformly small on $[a,b]\setminus (\gamma, \delta)$. Is such possible? How could I construct it?
 A: Another possibility,
not original by me,
 is
$f_n(x)
=x^n(1-x)^n
$
for large enough $n$,
scaled and shifted
so its peak is where you want.
$f'(x)
= -nx^n(1-x)^{n-1}
+ nx^{n-1}(1-x)^{n}
= nx^{n-1}(1-x)^{n-1}
((1-x)-x)
= nx^{n-1}(1-x)^{n-1}
(1-2x)
$
so that
$f$ is maximum
at
$x = \frac12$
and
$f(\frac12)
=(\frac12)^{2n}
$.
By looking at
$f(\frac12 \pm c)$,
you can show that
the bump at $\frac12$
is much larger than
the values of $f$
away from $\frac12$
as $n$ gets large.
That's all for me now.
A: For simplicity, move and scale the interval so that $(c,d)=(-1,1)$. Consider $f_k(x)=\exp(-x^{2k})$ where $k$ is large. As $k\to\infty$, these functions converge  to $1$ uniformly on  $(-1+\epsilon,1-\epsilon)$ and to $0$ uniformly on  $\mathbb R\setminus (-1-\epsilon,1+\epsilon)$, for every $\epsilon>0$.  In between they make  the transition from $1$ to $0$ without doing anything weird.
For every fixed $k$ the function $f_k$, being represented by its Taylor series on the entire line, is a uniform limit of its Taylor polynomials $T_{k,n}$ on each bounded interval.  
Therefore, picking large $k$ and then large $n$ does what you want. 
A: This is more of a note than an answer, but not exactly a comment either.  If we expand on @marty cohen's post.  Let $X$ be a convenient space and define the $C^1(X,\mathbb{R})$ bump function as:
$$
f_c(x)\triangleq (\|x\|^2-c)^2(\|x\|^2+c)^2 I_{\|x\|^2<c};
$$
for some $0<c<\infty$.  Then $f_c$ has the added benefit of taking values in $(0,1]$ and being supported in $Ball(x,c)$.  In particular, when $X=\mathbb{R}^d$ then $f_c$ is compactly-supported.
