TITLE: True or False?: There are infinitely many continuous functions $f$ for which $\int_0^1f(x)(1-f(x))dx=\frac{1}{4}$
QUESTION [15 upvotes]: I was going through CMI 2019 paper; I stumbled upon the statement:
For $f:R\rightarrow R$, there are infinitely many continuous functions $f$ for which $\int_0^1f(x)(1-f(x))dx=\frac{1}{4}$.
My approach is, we can write $f(x)(1-f(x))=\frac{1}{4}-(f(x)-\frac{1}{2})^2$.
Now, we can write $\int_0^1f(x)(1-f(x))dx=\frac{1}{4}-\int_0^1(f(x)-\frac{1}{2})^2dx$
$\Rightarrow \int_0^1(f(x)-\frac{1}{2})^2dx=0 \Rightarrow f(x)=\frac{1}{2}$.
So, there must be only one function satisfying the condition. However, the official answer says the statement is true. Am I missing something?

REPLY [7 votes]: Here's an example based off of @Mike_Hawk's answer. Let
$$f(x)=\left\{\begin{matrix}
\frac{1}{2} && \text{ for }x\leq 1\\
\left(\frac{1}{2}-b\right)x+b && \text{ for }x>1
\end{matrix}\right.$$
It is clear that $f(x)$ is continuous on $\mathbb{R}\to\mathbb{R}$ but that
$$\int_0^1 f(x)(1-f(x))dx=\frac{1}{4}$$
Since $b$ is a free variable, there are infinitely many continuous functions which satisfy your condition.