We were asked to find a symmetric idempotent matrix $H$ with rank $n-1$ such that if $X$ is a column vector with $n$ observations, then ${1\over n}X^THX$ is the variance of observations in $X$.
I found the matrix (for $n$ obs) to be $H_n=I_n-{1\over n}A_n$ where $I_n$ is identity matrix of dimension $n\times n$, $A_n$ is again $n\times n$ with all observations being $1$ and $H_n$ is the required matrix.
It was easy to show this is symmetric and idempotent but I'm facing difficulty with showing its rank is $n-1$.
However, it is easy to see $R_1+R_2+\dots+R_n=0$ where $R_i$ is the $i^{th}$ row. So its rank is strictly less than $n$.
I also noticed $R_1+R_2+\dots+R_n-R_i\ne0$ for any $i$.
How should I proceed?