What is the rank of $Q+Q^T-Q\circ I$ if $Q = qq^T$ I have a question about the rank of $$Q+Q^T-Q\circ I,$$ where

*

*$Q = qq^T$, $q\in \mathbb{R}^n$. Suppose $q^Tq=1$.

*$A\circ B:$ Hadmard (elementwise) product

*$Q\circ I$ just takes the diagonal entries of $Q$.

I know

*

*$Q$ is rank $1$, positive-semidefinite.

*$Q+Q^T$ is still rank $1$.

However, when considering the last term, what the rank will be?   full rank?
Thanks!
 A: First, let's assume all the entries of $q \in \mathbb{R}^n$ are non-zero. It is easy to check that $Q+Q^T = 2qq^T$ and $Q \circ I = D$ where $D$ is a diagonal matrix with entries $D_{n,n} = q_n^2$.
Hence, $Q+Q^T+Q\circ I = D+2qq^T$ where $D$ is an invertible matrix (since it is diagonal with non-zero diagonal entries). So by the Sherman-Morrison formula, we have that $Q+Q^T+Q\circ I = D+2qq^T$ is invertible iff $1+2q^TD^{-1}q \neq 0$. But this holds trivially since$$1+2q^TD^{-1}q = 1+2\sum_{k = 1}^{n}q_k \cdot (D^{-1})_{k,k} \cdot q_k = 1+2\sum_{k = 1}^{n}q_k \cdot q_k^{-2} \cdot q_k = 1+2\sum_{k = 1}^{n}1 = 2n+1 \neq 0.$$
Thus, if all the entries of $q$ are non-zero, then $Q+Q^T+Q\circ I = D+2qq^T$ is invertible, and thus, has rank-$n$.
Now, suppose $q$ has exactly $r$ entries which are non-zero. You can check that $$(Q+Q^T+Q \circ I)_{i,j} = (D+2qq^T)_{i,j} = \begin{cases} 2q_iq_j & \text{if} \ j \neq i \\ 3q_i^2 & \text{if} \ j = i\end{cases}.$$ Hence, $Q+Q^T+Q\circ I$ will have $n-r$ rows and columns which are all zero. If you look at the $r \times r$ submatrix of $Q+Q^T+Q\circ I$ formed by deleting all the zero rows/columns, you can use the same Sherman-Morrison formula based argument to show that this $r \times r$ submatrix is invertible, and thus, full rank. This is enough to conclude that $Q+Q^T+Q \circ I$ has rank-$r$.
Therefore, the rank of $Q+Q^T+Q \circ I$ will be exactly the number of non-zero entries in $q$.
