Show that $\int_0^\pi g^2\,dx \leq \int_0^\pi(g')^2\,dx +(\int_0^\pi g\,dx)^2$ Show that $\int_0^\pi g^2\,dx \leq \int_0^\pi (g')^2\,dx +(\int_0^\pi g\,dx)^2$, where $g \in H^1 (0,\pi)$ and $H$ means Sobolev space here. 
I want to apply Poincare inequality for ball here since I noticed that $\int_0^\pi[g^2 - \frac 1 \pi(\int_0^\pi g\,dx)^2]\,dx \leq \int_0^\pi (g')^2\,dx$,which looks like the Poincare inequality in  a ball, but still not quite.
Any hints would be appreciated.
 A: If we assume that
$$ h'(x) \stackrel{L^2(0,2\pi)}{=}\sum_{n\geq 1}\left(s_n\sin(nx)+c_n\cos(nx)\right) \tag{1}$$
and 
$$ h(x) \stackrel{L^2(0,2\pi)}{=} m +\sum_{n\geq 1}\left(\frac{s_n}{n}\cos(nx)-\frac{c_n}{n}\sin(nx)\right)\tag{2} $$
by Parseval's identity we get:
$$ \int_{0}^{2\pi}h(x)^2\,dx = 2\pi m^2+\pi\sum_{n\geq 1}\frac{s_n^2+c_n^2}{n^2}\tag{3} $$
$$ \int_{0}^{2\pi}h'(x)^2\,dx = \pi\sum_{n\geq 1}(s_n^2+c_n^2) \tag{4}$$
$$\left(\frac{1}{2\pi}\int_{0}^{2\pi}h(x)\,dx\right)^2 = m^2\tag{5}$$
so

$$ \int_{0}^{2\pi}h(x)^2\,dx \leq \int_{0}^{2\pi}h'(x)^2\,dx +\color{red}{2\pi}\left(\frac{1}{2\pi}\int_{0}^{2\pi}h(x)\,dx\right)^2. \tag{6} $$

Given some $g\in H^1(0,\pi)$, we may define $h(x)=g(x)$ for any $x\in(0,\pi)$ and $h(x)=g(2\pi-x)$ for any $x\in(\pi,2\pi)$. The previous Lemma applied to $h(x)$ leads to
$$ 2\int_{0}^{\pi}g(x)^2\,dx \leq 2\int_{0}^{\pi}g'(x)^2\,dx +2\pi\left(\frac{1}{\pi}\int_{0}^{\pi}g(x)\,dx\right)^2 \tag{7} $$
and finally to:

$$ \int_{0}^{\pi}g(x)^2\,dx \leq \int_{0}^{\pi}g'(x)^2\,dx +\color{red}{\frac{1}{\pi}}\left(\int_{0}^{\pi}g(x)\,dx\right)^2.\tag{8}$$

