Continuous functions satisfying $f(x) \left( f(x) - \frac1x \int_0^x f(t) dt \right) \geq (f(x) - 1)^2$ Find all continuous functions $f: [0, \infty) \to \mathbb{R}$ such that, for all positive $x$
\begin{equation}
f(x) \left( f(x) - \frac1x \int_0^x f(t) dt \right) \geq (f(x) - 1)^2
\end{equation}
From the inequality, one can deduce $f(0) = 1$, but from there it's not clear how to proceed. Some hints would be greatly appreciated!
 A: By taking the limit of both sides as $x\to 0^+$ we have $f(0)=1$. Let $g(x)=\frac{1}{x}\int_{0}^{x}f(t)\,dt$, such that $g(0)=1$ and $f(x)=\frac{d}{dx}(x g(x))=g(x)+xg'(x)$. The inequality can be written as
$$ ( g(x)+xg'(x) )xg'(x) \geq (g(x)+xg'(x)-1)^2$$
or, by letting $g(x)=h(x)+1$,
$$ ( h(x)+1+xh'(x) )xh'(x) \geq (h(x)+xh'(x))^2$$
$$  xh'(x)(1-h(x)) \geq h(x)^2 \tag{1}$$
with $h(0)=0$, such that $1-h(x)$ is positive in a right neighbourhood of the origin and there $h'(x)\geq \frac{h(x)^2}{x(1-h(x))}$. The differential equation
$$ h'(x) = \frac{h(x)^2}{x(1-h(x))} \tag{2}$$
has solutions given by $h(x)=-\frac{1}{W\left(-k x\right)}$ with $k>0$ and $W$ being Lambert's function. 
These positive solutions have two major issues: they are unbounded in a right neighbourhood of the origin and they have a finite lifespan, given by $\frac{1}{ek}$. It follows that the only global solution of $(1)$ with $h(0)=0$ is $h(x)\equiv 0$, and in conclusion the only continuous solution of your inequality is $f(x)\equiv 1$.
A: Here's a solution that doesn't require any differential equations or special functions:
Like I mentioned in my comment, first note that $f(x) = 0$ is impossible, so since $f(0) = 1$, $f$ must stay positive by continuity. Then just multiply out everything in the inequality and rearrange terms to get
$$\frac{1}{f(x)} + \frac{1}{x} \int_{0}^{x}f(t) \mathrm{d}t \leq 2$$
for all $x > 0$. This gets us
$$\frac{1}{f(x)} \leq 2 \implies f(x) \geq \frac12$$
for all $x$ and in general if $a_0 \in(0, 1)$ is a lower bound of $f$, then we get
$$\frac{1}{f(x)} \leq 2 - \frac{1}{x} \int_{0}^{x}f(t) \mathrm{d}t \leq 2 - a_0 \implies f(x) \geq \frac{1}{2-a_0}$$
for all $x$, with $\frac{1}{2-a_0} \in (0, 1).$ Thus we get a sequence $(a_n)$ of lower bounds satisfying $a_0 = \frac12$ and
$$a_{n+1} = \frac{1}{2-a_n}$$
for all $n$. This sequence is increasing and hence converging to $1$, the only solution of
$$a = \frac{1}{2-a},$$
so we know that $1$ is a lower bound of $f$.
Now we will show that $1$ is also an upper bound: Assume towards a contradiction that there is an $x_0 > 0$ such that $f(x_0) > 1$. By continuity this must also be true in a neighborhood of $x_0$, so we get
$$\frac{1}{x_0} \int_{0}^{x_0}f(t) \mathrm{d}t > 1.$$
Now note that since $f$ is positive, the inequality in its initial form implies
$$f(x) - \frac1x \int_0^x f(t) \mathrm{d}t \geq 0$$
for all $ x > 0$ and we conclude
$$\frac{\mathrm{d}}{\mathrm{d}x} \left(\frac1x \int_0^x f(t) \mathrm{d}t\right) = \frac{xf(x) - \int_0^x f(t) \mathrm{d}t}{x^2} = \frac{f(x) - \frac1x\int_0^x f(t) \mathrm{d}t}{x} \geq 0,$$
i.e. $x \mapsto \frac1x \int_0^x f(t) \mathrm{d}t$ is nondecreasing. Thus there exists a $b_0 \in (1, 2)$ such that
$$\frac1x \int_0^x f(t) \mathrm{d}t \geq b_0$$
for all $x \geq x_0$. For those $x$ we conclude
$$\frac{1}{f(x)} \leq 2 - \frac{1}{x} \int_{0}^{x}f(t) \mathrm{d}t \leq 2 - b_0 \implies f(x) \geq \frac{1}{2-b_0},$$
but now we don't quite get this as a lower bound for $\frac1x \int_0^x f(t) \mathrm{d}t$ because this is only true for $x \geq x_0$. Nevertheless we can get arbitrarily close to getting that lower bound for sufficiently large $x$, meaning we can pick any $c \in (0, 1)$ and then there is an $x_1 \geq x_0$ such that
$$\frac{1}{x} \int_{0}^{x}f(t) \mathrm{d}t \geq \frac{c}{2-b_0}$$
for $ x \geq x_1$. We would like to construct an increasing sequence of
lower bounds $(b_n)$, so we also need
$$\frac{c}{2-b_0} > b_0 \iff c > b_0(2 - b_0).$$
This suffices to get an increasing sequence because the map $x \mapsto x(2 - x)$ is decreasing on $(1, 2)$, so if we construct a $b_n \in (b_0, 2)$ then we also get
$$c > b_0(2 - b_0) > b_n(2 - b_n) \implies \frac{c}{2-b_n} > b_n.$$
Now we iterate again and this gives us an increasing sequence $(b_n)$ of lower bounds satisfying
$$b_{n+1} = \frac{c}{2-b_n}$$
and $ b_n \in (1, 2)$ for all $n$. (These are not global lower bounds, each of them is only valid on some interval $[x_n, \infty)$.) Since $(b_n)$ is increasing and bounded above by $2$ it must converge to a solution of
$$b = \frac{c}{2-b},$$
which are $1 - \sqrt{1-c}$ and $1 + \sqrt{1-c}$.
Since only the latter is larger than $1$ it must be the limit, but we know that
$$\frac{c}{2-x} < x$$
for all $x \in (1 - \sqrt{1-c}, 1 + \sqrt{1-c})$, contradicting the fact that $(b_n)$ converges to $1 + \sqrt{1-c}$ from below.
Thus $1$ must also be an upper bound for $f$, leaving us with $f \equiv 1$ as the only solution to the inequality.
