Real Mathematical Analysis Prelim problem 4.60 I am stuck on the following problem from Pugh's book:
Does there exist a continuous function $$f: [0,1] \rightarrow \mathbb{R}$$ such that $$\int_0^1 xf(x)\,dx  = 1$$ and $$\int_0^1 x^n f(x)\,dx  = 0$$ for $$n = 0,2,3,\ldots$$
The progress I made so far is that, for any polynomial $p$, we must have $p'(0) = \int_0^1 p(x)f(x)\,dx$. Also from Cauchy-Schwarz we can deduce that $\int_0^1 f^2(x) \, dx \geq 3$. We also know that the polynomials are dense in the space of continuous functions, but I don't know how to use this fact to solve the problem.
Thank you
 A: Presume such a function $f$ existed. Then the function $g(x)=x^2f(x)$ would be another continuous function on $[0,1]$ such that $\int_0^1 x^n g(x)dx=0$ for all $n=0,1,2\ldots$. Now, that would imply that $\int_0^1p(x)g(x)dx=0$ for every real polynomial $p$, and so, due to density of all polynomials, you would have $g(x)=0$. Thus, $f(x)=\frac{g(x)}{x^2}=0$ for $x\ne 0$. Continuity gives us $f(x)=0$ for all $x\in[0,1]$ - which is impossible, because $\int_0^1xf(x)dx=1\ne 0$.
A: Let $q_n\in\mathbb{R}[X]$ such that $\|f-q_n\|_{\infty}\rightarrow 0$ and let $p_n=q_n+\frac{(1-x)^{m_n}}{m_n}q_n'(0)$ where $m_n=\lfloor|q_n'(0)|+1\rfloor^2+n+1$, then $p_n'(0)=0$ for all $n$ so that $\int_0^1 p_n(x)f(x)dx=0$ for all $n$. Moreover, $\|f-p_n\|_{\infty}\leqslant\|f-q_n\|_{\infty}+\frac{|q_n'(0)|}{m_n}\rightarrow 0$ thus, $$ \int_0^1 f(x)p_n(x)dx\rightarrow\int_0^1 f(x)^2dx $$
and therefore $\int_0^1 f(x)^2dx=0$ which means that $f=0$, $f$ being continuous. This contradicts the fact that $\int_0^1 xf(x)dx=1$.
