On constants attainable by the expression $\int_0^1xf(x)dx$

Note that if $f$ and $g$ satisfy the given conditions, then so does any convex combination of $f$ and $g$. Thus the set of attainable values is a convex subset of the reals, i.e. an interval.

This means that if $S = \sup \int xf(x)$ and $I = \inf \int x f(x)$ both subject to the given conditions, then any value in $(I,S)$ can be attained.

Further, the infimum $I$ is clearly $0$, and a sequence approaching this infimum is $P_n := x^n$ for integer $n$. This also means that any value in $(I,S)$ can be attained non-uniquely as a convex combination of some function that gets a value close to $S$ and the various $x^n$ for sufficiently large $n$.

The question remains what $S$ is, and if it can be attained. I'll argue that $S = 1/2,$ and it cannot be attained. The latter claim is easy if $S = 1/2$: since $f$ is analytic, thus continous, and it is $0$ close to $0$, then $xf(x) < x/2$ for $x < \varepsilon$ for some small $\varepsilon > 0,$ giving $\int xf < \varepsilon/4 + (1-\varepsilon)/2 < 1/2.$

Next, we argue that $S = 1/2$. Note that $S \le 1/2$ trivially, since $f \le 1.$

@Dark Malthorp below points out a simple witness for $S \ge 1/2:$ consider $f_n := 1 - (1-x)^n.$ This is easily seen to satisfy the conditions required. Further, $$ \int x f_n(x) = \frac{1}{2} - \int_0^1 x(1-x)^n \ge \frac{1}{2} - \int_0^1 (1-x)^n = \frac{1}{2} - \frac{1}{n+1}. $$


EDIT: Turns out I made a careless mistake in my answer and didn't manage to prove the case of infinite solutions for $K\in(0,1/2)$, only $K\in(0,1/3)$. I'll leave my answer here for now, but feel free to reference or extend it to give a more complete solution.

There will be infinitely many $f$ for $K\in(0,1/2)$, while outside that range no such $f$ exists since $0=\int_0^10dx<\int_0^1 xf(x)dx<\int_0^1xdx=1/2$ (as pointed out by Ian in the comments)

To show the first statement, you can construct infinite families of solutions in many ways. Here's one that I got: given a $K\in(0,1/3)$, we can show that for all $n>1/K>3$, the infinite family of functions $f_n(x)=(1-a_n)x+a_nx^{n-2}$, where $a_n=\frac{1/3-K}{1/3-1/n}$, all satisfy the given conditions.

Clearly, $f_n(0)=0,f_n(1)=1$. If we perform the integral, we get $$ \int_0^1(1-a_n)x^2+a_nx^{n-1}dx =\frac13(1-a_n)+\frac{a_n}{n}=\frac{1}3\frac{K-1/n}{1/3-1/n}+\frac{1}n\frac{1/3-K}{1/3-1/n}\\=\frac{1}{1/3-1/n}\left(\frac13K-\frac1{3n}+\frac1{3n}-\frac1nK\right)=K $$ and finally, using the inequalities $\frac13>K>\frac1n$, we have $$ 0\le a_n=\frac{1/3-K}{1/3-1/n}\le1 $$ and therefore for all $x\in[0,1]$ $$ f'_n(x)=(1-a_n)+a_n(n-2)x^{n-3}\ge0 $$ which implies $f_n$ is monotonically increasing over this interval.


Consider $f(x)=\exp\big(\frac{\alpha}{\log(1-x)}\big),$ $x\ne0,1.$

$$ \int_0^1xf(x)~dx=K$$ where $K=2K_1(2)-\sqrt{2}K_1(2\sqrt{2})$ for $\alpha=1.$ Here $K_1$ is the modified Bessel function of the second kind.

$$\lim_{\alpha\to0}\int_0^1xf(x)~dx=1/2.$$