Show there is $C$ independent of $u$ s.t. $\|u-\bar u\|_{L^p(B_1)}\leq C\|\nabla u\|_{L^p(B_1)}$.

Let $B_1\subset \mathbb R^d$ the unit ball. We denote $$\bar u=\frac{1}{|B_1|}\int_{B_1}u.$$

I want to show that $$\exists C>0: \forall u\in W^{1,p}(B_1), \|u-\bar u\|_{L^p(B_1)}\leq C\|\nabla u\|_{L^p(B_1)}.$$

I suppose by contradiction that it's not the case, i.e. $$\forall n\in\mathbb N^*, \exists u_n\in W^{1,p}(B_1): \|u_n-\bar u_n\|_{L^p(B_1)}>n\|\nabla u_n\|_{L^p(B_1)}.$$

Despite of considering $v_n=\frac{u_n}{\|u_n-\bar u_n\|_{L^p(B_1)}}$, I can suppose that $\|u_n-\bar u_n\|_{L^p(B_1)}=1$.

So we have that $$\|u_n-\bar u_n\|_{L^p(B_1)}=1\quad \text{and}\quad \|\nabla u_n\|_{L^p(B_1)}\to 0.$$

In particular, $(u_n-\bar u_n)$ is bounded in $W^{1,p}(B_1)$, and thus, there is a subsequence (that we still denote $(u_n-\bar u_n)$) that converge weakly to a function $g\in W^{1,p}(B_1)$. By Reilleich-Kondrachov, $(u_n-\bar u)$ converge strongly to $g$ in $L^p(B_1)$. Since $$\nabla u_n\to 0\ \text{in }L^p(B_1),$$ we have that $\nabla g=0$ and thus $g$ is constant a.e. Moreover, $$|1-\|g\|_{L^p(B_1)}|=|\|u_n-\bar u_n\|_{L^p(B_1)}-\|g\|_{L^p(B_1)}|\leq \|(u_n-\bar u_n)-g\|_{L^p(B_1)}\to 0,$$ and thus $$\|g\|_{L^p(B_1)}=1.$$

Question : I don't get a contradiction... I suppose that I must have $g=0$, but how ?

Pass to the limit in the zero-average condition. For each $n$ you know that $$0 = \int_{B_1} (u_n - \bar{u}_n),$$ and you know that $u_n - \bar{u}_n \to g$ in $L^p(B_1)$. Since $B_1$ has finite measure this in particular implies that $u_n -\bar{u}_n \to g$ in $L^1(B_1)$ as well. Thus $$0 = \lim_{n \to \infty} \int_{B_1} (u_n - \bar{u}_n) = \int_{B_1} g = C |B_1|$$ where $g(x) = C$ for $x \in B_1$ since $g$ is constant. Thus $C=0$, but this contradicts the fact that $\Vert g\Vert_{L^p} = 1$.