Calculating value of function at middle of interval, given integrals of the function on the interval.

Solution 1:

Compute $t \in \mathbb R$ such that

$$\int_0^1(f(x)-tx)^2 dx=0.$$

Since $f$ is continuous, we get $f(x)=tx.$