$|f(x)|\leq \sqrt{\frac{\pi}{3}\int_0^\pi f'^2}$

Without Fourier series: we have $((t-a)f(t))'=(t-a)f'(t)+f(t)$. Hence $$ \int_0^t\tau f'(\tau)d\tau=tf(t)-\int_0^tf(\tau)d\tau,\qquad \int_t^\pi(\tau-\pi)f'(\tau)d\tau=(\pi-t)f(t)-\int_t^\pi f(\tau)d\tau. $$ By adding these, we obtain $$ \pi f(t)=\int_0^\pi g(\tau)f'(\tau)d\tau,\qquad g(\tau)=\begin{cases}\tau,&\tau<t,\\\tau-\pi,&\tau>t.\end{cases} $$ Now, by Cauchy-Schwarz, $$ \pi |f(t)|\le \sqrt{\int_0^\pi |f'(\tau)|^2d\tau}\sqrt{\frac{t^3}3+\frac{(\pi-t)^3}3}\le \sqrt{\int_0^\pi |f'(\tau)|^2d\tau}\sqrt{\frac{\pi^3}{3}} $$ Dividing by $\pi$, we obtain the desired result. QED


How to guess this proof? It is easy enough: $\frac13$ can only come from $\int t^2 dt$ in this context, so (having in mind Cauchy--Schwarz) we need to estimate $f$ somehow via the integral of $tf'(t)$.


Here's an sketch of a proof using Fourier series. Let $f(x) = \sum_{n=1}^\infty a_n \cos(n x)$, then

$$ \int_0^\pi f'(t)^2dt = \frac{\pi}{2}\sum_{n=1}^\infty \left(n a_n\right)^2 $$ With this in mind, we apply Cauchy-Schwarz as follows: $$ \begin{aligned} |f(x)|^2 &=\left( \sum_{n=1}^\infty \left(n a_n\right)\left(\frac{\cos(n x)}{n}\right) \right)^2\\ &\le \left( \sum_{n=1}^\infty \left(n a_n\right)^2 \right) \left(\sum_{n=1}^\infty\left(\frac{\cos(n x)}{n}\right)^2 \right) \\ &\le \left( \sum_{n=1}^\infty \left(n a_n\right)^2 \right) \left(\sum_{n=1}^\infty\frac{1}{n^2} \right)\\ &= \left( \frac{2}{\pi}\int_0^\pi f'(t)^2dt \right) \left(\frac{\pi^2}{6} \right) \end{aligned} $$