# Trace of $(K+ vv^T)^{-1} (K+uu^T)$

Let $$K$$ be a $$n \times n$$ symmetric real positive definite matrix. Let $$u$$ and $$v$$ be non-zero $$n\times 1$$ vectors taking values of $$0$$'s and $$1$$'s. Assume that the values in $$u$$ and $$v$$ are sorted so that the first $$m_u$$ or ($$m_v$$) entries are zeros and the remaining $$n-m_u$$ or ($$n-m_v$$) entries are ones. Is the following statement true? If not, what kind of conditions could I impose so that it is true?

$$trace\bigg[ (K+ vv^T)^{-1} (K+uu^T)\bigg]=n$$ if and only if $$v=u$$

Obviously, $$(\impliedby)$$ is true, but I wonder if the other direction holds under some restrictions.

This is not true. E.g. the trace condition is satisfied when $$n=2$$ and $$K=\pmatrix{2&1\\ 1&1},\ u=\pmatrix{1\\ 1},\ v=\pmatrix{0\\ 1}.$$ In general, as $$(K+vv^T)^{-1}=K^{-1}-\frac{K^{-1}vv^TK^{-1}}{1+v^TK^{-1}v}$$. If you put $$P=K^{-1}$$, using the tracial property, the trace condition can be rewritten as $$0=-\frac{v^TPv}{1+v^TPv} +u^TPu-\frac{(u^TPv)^2}{1+v^TPv}$$ or equivalently, $$(u^TPu)(1+v^TPv)-v^TPv-(u^TPv)^2=0.\tag{1}$$ When $$m_u\le m_v$$, you may partition $$P$$ as $$\pmatrix{\ast&\ast&\ast\\ \ast&B&Z\\ \ast&Z^T&C}$$ where $$B$$ is $$(m_v-m_u)\times(m_v-m_u)$$ and $$C$$ is $$(n-m_v)\times(n-m_v)$$. Let the sum of all entries in $$B$$ be $$b$$ and define $$c$$ and $$z$$ analogously for $$C$$ and $$Z$$. Condition $$(1)$$ can then be rewritten as \begin{align} &(b+c+2z)(1+c)-c-(c+z)^2=0\\ \Leftrightarrow\ &b(c+1)=z(z-2).\tag{2} \end{align} In the counterexample above, we have $$P=K^{-1}=\pmatrix{1&-1\\ -1&2}$$, so that $$b=1,c=2$$ and $$z=-1$$.
When $$m_u>m_v$$, you can partition $$P$$ analogously, but this time, $$B$$ is $$(m_u-m_v)\times(m_u-m_v)$$ and $$C$$ is $$(n-m_u)\times(n-m_u)$$. The trace condition in this case becomes \begin{align} &c(1+b+c+2z)-(b+c+2z)-(c+z)^2=0\\ \Leftrightarrow\ &b(c-1)=z(z+2).\tag{3} \end{align} So, even when $$u\ne v$$, it can happen that $$(2)$$ or $$(3)$$ hold when the values of $$b,c,z$$ are appropriate.