Prove that $\int_0^1 \big(1-x^2\big) \big(f'(x)\big)^2\,dx \ge 24 \left(\int_0^1 xf(x)\,dx\right)^{\!2}$

Prove that if $f:[0,1] \to \mathbb{R}$ is a continuously differentiable function with $\int_0^1 f(x)\,dx=0$, then $$\int_0^1 \big(1-x^2\big) \big(f'(x)\big)^2\,dx \ge 24 \left(\int_0^1 xf(x)\,dx\right)^{\!2}.$$

I think that I should somehow use the Cauchy-Schwarz inequality, but I wasn't succesful in doing this. I know that $$\left(\int_0^1 xf(x)\,dx\right)^2\le \int_0^1 x^2\,dx \cdot \int _0^1 f^2(x)\,dx=\frac{1}{3}\int _0^1 f^2(x)\,dx,$$ but this is clearly not enough.


(The following is inspired by Integral inequality with a function twice differentiable: Integrating by parts transforms the integral with $f$ to an integral with $f'$. The condition $\int_0^1 f(x) \, dx = 0$ is used to add a term to the first integral so that the $u(b)v(b)-u(a)v(a)$ term vanishes. Cauchy-Schwarz then helps to estimate the integral containing $f'$ by an integral containing $f'^2$.)

Integrating by parts we get $$ \int_0^1 xf(x) \, dx = \frac 12 \int_0^1 (2x-1)f(x) \, dx = \frac 12 \int_0^1 x(1-x) f'(x) \,dx \\ = \frac 12 \int_0^1 \frac{x \sqrt{1-x}}{\sqrt{1+x}} \sqrt{1-x^2} f'(x) \, dx \, . $$ Now apply Cauchy-Schwarz: $$ \left( \int_0^1 xf(x) \, dx \right)^2 \le \frac 14 \int_0^1 \frac{x^2(1-x)}{1+x} \, dx \int_0^1 (1-x^2) (f'(x))^2 \, dx \\ \le \frac 14 \int_0^1 x^2(1-x) \, dx \int_0^1 (1-x^2) (f'(x))^2 \, dx \\ = \frac{1}{48 }\int_0^1 (1-x^2) (f'(x))^2 \, dx $$ which is better than the desired estimate by a factor of $2$.


Using the exact value $\int_0^1 \frac{x^2(1-x)}{1+x}\, dx = 2 \ln(2) - 4/3$ we get the sharp estimate $$ \int_0^1 (1-x^2) (f'(x))^2 \, dx \ge C \left( \int_0^1 xf(x) \, dx \right)^2 $$ with $$ C = \frac{2}{\ln(2)-2/3} \approx 75.53 \, . $$ Equality holds if equality holds in the Cauchy-Schwarz inequality, and that is if $$ f'(x) = \text{const} \cdot \frac{x}{x+1} $$ so that the integrands are linearly dependent. Together with the condition $\int_0^1 f(x) \, dx = 0$ this gives (up to a multiplicative constant) $$ f(x) = x - \ln(x) + 2 \ln(2) - \frac 23 \, . $$


I would like to add another way (which may seem more natural) to obtain the sharp estimate that Martin R got.
Consider some arbitrary constants $a, b \in \mathbb{R^{*}}$. From the Cauchy-Schwarz inequality in integral form we know that $$\int_0^1 \left(\frac{ax^2+bx}{\sqrt{1-x^2}}\right)^2 dx \cdot \int_0^1 \left(\sqrt{1-x^2}f'(x)\right)^2 dx\ge \left(\int_0^1 (ax^2+bx)f'(x)dx\right)^2=\left( (ax^2+bx)f(x) \bigg |_0^1 -\int_0^1 (2ax+b)f(x)dx \right)^2=\left((a+b)f(1)-2a\int_0^1 xf(x)dx \right)^2.$$ Since we don't know anything about $f(1)$, it is convenient to set $a+b=0$(we may do this, since they are just some arbitrary real constants).
We now have the inequality $$\int_0^1 \frac{(ax^2-ax)^2}{1-x^2}dx\cdot \int_0^1 (1-x^2)(f'(x))^2 dx \ge 4a^2 \left(\int_0^1 xf(x)dx\right)^2$$ $$\iff \int_0^1 \frac{(x^2-x)^2}{1-x^2}dx\cdot \int_0^1 (1-x^2)(f'(x))^2 dx \ge 4\left(\int_0^1 xf(x)dx\right)^2,$$which yields precisely the same inequality.
This may seem a bit more intuitive since we start with some arbitrary constants and then we just set them to be something that works for us (let's note that, in fact, the $a$ just cancelled itself out in the end, so we didn't need to assign it another value).