The question asks for the idempotency of \begin{align*} H-\frac{1}{n}J \end{align*} where $H$ is the hat matrix for multilinear regression, $H = X(X'X)^{-1}X'$, and $J$ is the matrix of all 1's.
I proceeded by definition, i.e., wanting to show that $(H-\frac{1}{n}J)(H-\frac{1}{n}J)= H-\frac{1}{n}J$, expanding it I got: \begin{align*} H-\frac{1}{n}(HJ+JH)+\frac{1}{n}J \end{align*} where we can find that $HJ=JH$, knowing that any element of the i-th row of $HJ$ is the sum of i-th row of $H$; any element of j-th column of $JH$ is the sum of j-th column of $H$, combining with the fact that $H$ is symmetric.
How can I proceed from up here? It seems necessary that $HJ=J$, but how do we prove it?
In order to have $JH = HJ = J$ we need to have that $\mathbf{1}$ be an eigenvector of $H$ since $R(J) = \operatorname{span}(\mathbf{1})$, where $\mathbf{1}$ is a vector of all ones and $H$ is a projector (has eigenvalues $1$ or $0$). Since $H$ is an orthogonal projector onto $R(X)$, i.e. $R(X) = R(H)$, it follows that your data must contain a column of ones. In that case, since $H$ is a projector, it follows that $HX = X \implies H\mathbf{1}=\mathbf{1}$, thus $HJ = JH = J$.