Let $0\leq aLet $0\leq a<b$ be real numbers. Prove that there is no continuous function $f:[a,b]\rightarrow\mathbb{R}$ such that $\int\limits_{a}^{b}f(x)x^{2n}dx>0$ and $\int\limits_{a}^{b}f(x)x^{2n+1}dx<0$ for all integer $n\geq0$.
I am trying to use weierstrss approximation theorem. But I am not getting. Please give some idea
 A: Recall the following Müntz-Szász theorem:

Let $0=\lambda_0<\lambda_1<\lambda_2<\ldots$ be a strictly increasing sequence satisfying $$\lim_{n\to\infty}\lambda_n=+\infty.$$ Then, the space $$\mathrm{span}_{\mathbf R}\left\{t^{\lambda_n};~n\in\mathbf N\right\}$$ is dense in $C[a,b]$ if and only if $$\sum_{n\geq1}\frac1\lambda_n=+\infty.$$

With above consequence, it is almost clear to get an answer to your question. Suppose there is a function $f\in C[a,b]$ satisfying above assumptions. Then, for any $n\in\mathbf N,$ there exists a sequence $\{\mu_n\}$ such that $n<\mu_n<n+1$ and $$\int_a^bt^{\mu_n}f(t)dt=0.$$ Set $\lambda_{n-1}=\mu_n-\mu_1$ for any $n\in\mathbf N_+.$ Then, $$\int_a^bt^{\lambda_n}g(t)dt=0$$ for any $n\in\mathbf N,$ where $g(t)=t^{\mu_1}f(t).$ Note that $$\sum_{n\geq1}\frac{1}{\lambda_n}=+\infty.$$ Then, Müntz-Szász theorem gives that $g\equiv0$ on $[a,b],$ and so $f\equiv0$ on $[a,b],$ which is a contradiction.
A: We can give an elementary proof as follows: the change of variables $y=qx$ gives $\int\limits_{a}^{b}f(x)x^{n}dx=\frac{1}{q^{n+1}}\int\limits_{qa}^{qb}f(y/q)y^{n}dy$ so with $g(y)=f(y/q)$ one has that $\int\limits_{qa}^{qb}g(y)y^{n}dy$ has the same sign as $\int\limits_{a}^{b}f(x)x^{n}dx$ so if we choose $qb \le 1$ one can assume $b \le 1$
Let $0<c<1$ and consider the polynomial $P(x)=1+\eta-(x+\epsilon)(x-c)^2=(1+\eta-\epsilon c^2)-(c^2-2c\epsilon)x+(2c-\epsilon)x^2-x^3$ and note that for $\epsilon, \eta>0$ small enough we have that $P(c)=1+\eta,0<P(x)<1, 0<x<1, x \notin [c-\delta, c+\delta]$ for $\delta \to 0$ as $\eta, \epsilon \to 0$ and its coefficients alternate so $P(x)=a_0-a_1x+a_2x^2-a_3x^3, a_0,..a_3 >0$
Now it is easy to see by induction that $P(x)^k$ has the same properties as $P$ regarding its coefficients being alternating as the product of two polynomials with alternating coefficients has alternating coefficients
Now coming back to our problem, assume $f \ne 0$ so there is $0<c<1$ for which $f(c)=-d<0$; in particular there exists a small $\delta>0$ st $f(x)<-d/2, x \in (c-\delta, c+\delta)$ Choose $\eta, \epsilon>0$ st for the above polynomial one has  $P \ge 1$ on $[c-\delta/2, c+\delta/2]$ and $0<P<1$ outside $[c-\delta, c+\delta]$
However $\int_a^bf(x)P^k(x)>0$ is positive for all $k \ge 0$ since $P^k$ has alternating coefficients
But $|(\int_a^{c-\delta}+\int_{c+\delta}^b)f(x)P^k(x)dx| \to 0, k \to \infty$ while $\int_{c-\delta}^{c+\delta}f(x)P^k(x)<-\delta d /2$ so we get our contradiction for large $k$ and we are done!
