To find the number of possible continuous function What are the number of possible continuous functions $f(x)$ defined on $[0,1]$ for which
$$ I_1 = \int_0^1 f(x)dx=1,\\
I_2 =\int_0^1 xf(x)dx =a,\\
I_3 = \int_0^1 x^2f(x)dx=a^2.$$
I have no idea how to to solve it.
Can anyone help me?
 A: Without a condition on the sign of the function, you can find a continuous $f$ satisfying all conditions.
Namely, it is enough to choose
$$
f(x) = \alpha x^2 + \beta x + \gamma
$$
and to find $\alpha, \beta, \gamma$ by solving the (uniquely solvable) linear system obtained imposing the three conditions.
(The solution should be $\alpha = (6a^2-6a+1)/30$, $\beta = -180 a^2 +192 a -36$, $\gamma = 30 a^2 - 36 a + 9$.)
On the other hand, there are no continuous functions satisfying $f\geq 0$ or $f\leq 0$ and the three given conditions.
Indeed, one has
$$
\int_0^1 (x-a)^2 f(x) \, dx = \int_0^1 x^2 f(x)\, dx - 2a \int_0^1 x f(x)\, dx
+ a^2 \int_0^1 f(x) \, dx = 0,
$$
but the unique continuous function $f\geq 0$ (or $f\leq 0$) satisfying this condition is $f\equiv 0$, that clearly does not satisfy the first requirement.
A: One may exploit the fact that shifted Legendre polynomials provide an orthogonal base of $L^2(0,1)$ with respect to the standard inner product. The given constraints lead to
$$ \int_{0}^{1}f(x)P_0(2x-1)\,dx = 1,\quad \int_{0}^{1}P_1(2x-1)\,dx=2a-1$$
$$\int_{0}^{1}f(x)P_2(2x-1)\,dx=6a^2-6a+1 $$
hence any function of the form
$$ 1+(6a-3)P_1(2x-1)+(30a^2-30a+5)P_2(2x-1)+\sum_{m\geq 3}c_m P_m(2x-1) $$
does the job. However, if we assume $a\geq 0$ and further impose $f(x)\geq 0$ on $[0,1]$ we get the unique solution $f(x)\equiv 0$ associated to $a=0$, since the constraints ensure we are in the equality case of the Cauchy-Schwarz inequality
$$ \left(\int_{0}^{1} x f(x)\,dx\right)^2\leq \int_{0}^{1}f(x)\,dx \int_{0}^{1}x^2 f(x)\,dx.$$
