Let $A$ be a positive-definite and full rank matrix of size $n$. And let $H = I - n^{-1}1_n$ where $1_n$ is the square matrix of size $n$ full of $1$'s.
We then build the centered version of $A$ (in rows and columns) as $\tilde{A} = HAH$.
I would like to compute the rank of $\tilde{A}$. Since $\operatorname{Ker}(H) \subset \operatorname{Ker}(\tilde{A})$ and $\operatorname{Ker}(H)$ is the space of dimension 1 spanned by the vector full of $1$'s we have $\operatorname{ran}(\tilde{A}) \leq n-1$.
Furthermore, using the inequality $$ \operatorname {rank} (AH)+\operatorname {rank} (HA)\leq \operatorname {rank} (A)+\operatorname {rank} (HAH), $$ with the equalities $\operatorname {rank} (A)=n$, $\operatorname {rank} (AH) = \operatorname {rank} (AH) = n-1$ and $\operatorname {rank} (H) = \operatorname {rank} (H) = n-1$, we obtain $$ \operatorname {rank} (\tilde{A}) \geq n-2. $$ Therefore $\operatorname {rank} (\tilde{A}) \in \{n-2,n-1\}$, however for all examples I could come up with I got $\operatorname {rank} (\tilde{A}) = n-1$.
My question is the following: is it possible to come up with a full rank symmetric positive-definite matrix $A$ such that $\operatorname {rank} (\tilde{A}) = n-2$, and if not, how can I show that $\operatorname {rank} (\tilde{A})$ is always equal to $n-1$.
Notation: for a matrix $A \in \mathbb{R}^{n\times n},$ $\operatorname{ran}(A) = \{y \in \mathbb{R}^n \mid y = Ax, x \in \mathbb{R}^n \}$, and $\operatorname{ker}(A) = \{x \in \mathbb{R}^n \mid Ax=0 \}$.
I am answering my own question after some thinking but would appreciate 1) a confirmation that it is a valid proof 2) a more intuitive explanation of why when we center the rows and then the columns (or vice-versa) we can only loose 1 in rank and not 2.
Since $A$ is symmetric, positive, full rank there is a diagonal matrix $D$ with positive entries on the diagonal and an orthonormal matrix $U$ such that $A = UDU^{\top}$, therefore $$ \tilde{A} = HUDU^{\top}H = BB^{\top} $$ with $B = HU\sqrt{D}$. Using $\operatorname{rank}(BB^T) = \operatorname{rank}(B)$ and the fact that if $F$ is an $n \times k$ matrix of rank $n$ and $E$ is any matrix with $n$ columns, then $\operatorname {rank} (EF)=\operatorname {rank} (E)$, we obtain
$$ \operatorname {rank} (\tilde{A}) = \operatorname {rank} (B) = \operatorname {rank} (H) = n-1, $$ where we used that $U\sqrt{D}$ is full rank.