A problem with indefinite integrals I saw this problem somewhere online yesterday.
Let $f$ and $g$ be real valued functions defined on $[0, 1]$ and $$\int_{0}^{1} x^n f (x)\, dx = \int_{0}^{1} x^n g (x)\, dx$$ for any natural number $n$. Prove that $f \equiv g$.
Here's my attempt.
Let, by Taylor Series expansion at $x = 0$, $$f(x) = \sum_{k = 0}^{\infty} a_k x^k \qquad \text {and} \qquad g (x) = \sum_{k = 0}^{\infty} b_k x^k,$$ where $a_k = f^{(k)} (0)/k!$ and $b_k = g^{(k)} (0)/k!$. By the original equation, we have $$\sum_{k = 0}^{\infty} \int_{0}^{1} a_k x^{k + n}\, dx = \sum_{k = 0}^{\infty} \int_{0}^{1} b_k x^{k + n}\, dx,$$ which yields $$\sum_{k = 0}^{\infty} \frac {a_k} {k + n + 1} x^{k + n + 1} = \sum_{k = 0}^{\infty} \frac {b_k} {k + n + 1} x^{k + n + 1}. \tag {*}$$
It suffices to prove that $a_k = b_k$ for every $k \geqslant 0$. I tried supposing $a_k > b_k$ and arriving at a contradiction by $(*)$, but I failed. What do you suggest I do? Or, what different approach would you try?
 A: You can't suppose than $f$, $g$ are analytical. Alternative solution: if $f$, $g$ are continuous, take a sequence of polynomials $P_n\to(f-g)$ uniformly in $[0,1]$ (why such sequence exists?) and consider
$$\int_0^1 P_n(f-g).$$
A: Hint. An idea is the following:
(1) As integration is linear, from the assumption conclude that 
$$ \int_0^1 f(x)p(x)\, dx = \int_0^1 g(x)p(x)\, dx $$
for every polynomial $p$. 
If $f,g$ are assumed to be continuous, do the following:
(2) As the polynomials are $\|\cdot \|_\infty$-dense in the continuous functions on $[0,1]$, by an approximation argument, show that 
$$ \int_0^1 f(x)c(x)\, dx = \int_0^1 g(x)c(x)\, dx $$
for every continuous $c \colon [a,b] \to \mathbf R$. 
Now let $c = f-g$ and conclude.
If $f,g$ are only assumed to be $L^1$-functions, recall that continuous functions (and hence polynomials) are $L^1$-dense: 
(2') By an approximation argument, show that 
$$ \int_0^1 f(x)c(x)\, dx = \int_0^1 g(x)c(x)\, dx $$
for every integrable $c \colon [a,b] \to \mathbf R$. 
Now let $c = f-g$ and conclude that $f = g$ (almost everywhere).
