\(f(x)\) and \((x-\alpha)^2\) are both positive so this is only possible if one of them if always zero.

But \((x-\alpha)^2\) is only zero when \(x=\alpha\) and \(\int_0^1 f(x) dx=1\) so \(f(x)\) cannot always be zero. Therefore no such function exists.

Extension

Find all continuous positive functions, \(f\) on \([0,1]\) such that: