If $f \in H^1(0,\pi)$, I want to show $$ \int_0^\pi f^2 dx \le \int_0^\pi (f')^2 dx + \left ( \int_0^\pi f dx\right )^2. $$
I'm sure there's some trick where I have to integrate a specific function and then apply an inequality like Holder's. The only Sobolev inequality I have at my disposal is Morrey's though, as $2>1$, and that doesn't help bounding by the derivative. Any hints?
This is an easy form of Poincare inequality. There's no trick here, just fundamental theorem of calculus. \begin{align*} \int_0^1 \bigg| f(x) - \int_0^1 f(y) dy \bigg|^2 dx & \le \int_0^1 \int_0^1 |f(x)-f(y)|^2 dx dy \\ & = \int_0^1 \int_0^1 \bigg| \int_{[x,y]} f'(t) dt \bigg|^2 dx dy \\ & \le \int_0^1 \int_0^1 \int_0^1 |f'(t)|^2 dt dx dy \\ & = \int_0^1 |f'(t)|^2 dt \end{align*} Taking into account @copper.hat's remark, this yields your inequality for $[0,1]$ instead of $[0,\pi]$. To change it, you can always rescale the function (i.e. apply the above for $g(x)=f(\pi x)$).