TITLE: Trace of a nonlinear matrix equation
QUESTION [5 upvotes]: Let $X_0$ be a trace-one positive definite matrix, i.e. $X_0>0$, $\mathrm{tr}(X_0)=1$. Let $A>0$ and consider the following iteration
$$
X_{k+1} = X_k^{1/2}AX_k^{1/2},\quad k\geq 0,\quad (\star)
$$
where $X_k^{1/2}$ denotes the (principal) square root of $X_k$.
My question: Is it true that the above iteration is trace-preserving starting from all $X_0$'s as above, i.e. $\mathrm{tr}(X_{k+1})=\mathrm{tr}(X_{k})=1$ for all $k\geq 0$, (if and) only if $A=I$?
N.B. After a discussion with Nawaf Bou-Rabee, I decided to restore the original formulation of my question and accept his answer. However, I opened a new OP where you can find the edited version, which is still open.

REPLY [5 votes]: If $A=I$, then it follows from the iteration rule that $\mathrm{tr}(X_{k})=1$ for all natural number $k \ge 0$.  
If $\mathrm{tr}(X_{1})=\mathrm{tr}(X_{0})$, then the given iteration rule implies that: $$
\mathrm{tr}((A  - I) X) = 0 \quad \forall X : X > 0 ~\&~ \mathrm{tr}(X) = 1 \;. \tag{$\star$}
$$ If $X$ was allowed to be an arbitrary matrix, it would immediately follow that $A=I$.  Still, as we will see, there is enough slack in the constraints on $X$ to still obtain $A=I$.  To see this, let $\{ e_i \}$ be the standard basis on $\mathbb{R}^n$ and for any $i \in \{1, \cdots, n \}$ define 
$$
X_{ii} = (1-\epsilon (n-1)) e_i e_i^T + \sum_{j \ne i} \epsilon e_j e_j^T
$$ where $\epsilon>0$ is a small parameter.  Note that the sum of the eigenvalues of the matrix $X_{ii}$ is one, and if $\epsilon$ is sufficiently small, then $X_{ii}>0$. More importantly, letting $X=X_{ii}$ in ($\star$) gives
$$
\mathrm{tr}((A  - I) X_{ii}) = (1-\epsilon (n-1) ) (A_{ii}-1) + \epsilon \sum_{j \ne i} (A_{jj}-1) =0
$$ which implies that: 
$$
A_{ii} = 1 - \frac{\epsilon}{1-\epsilon (n-1)} \sum_{j \ne i} (A_{jj}-1)
$$  Since $\epsilon$ can be made arbitrarily small, it follows that the diagonal entries of $A$ are all equal to one. 
One can similarly treat the off-diagonal terms by, e.g., defining
\begin{align*}
X_{ij} &= \frac{1}{2} (1-\epsilon (n-1) ) \left( e_i e_j^T + e_j e_i^T \right) \\
&+ (1-\epsilon (n-1) ) e_i e_i^T + (1-\epsilon (n-1) ) e_j e_j^T   
+ \sum_{k \ne \{i,j\}} \epsilon e_k e_k^T
\end{align*} which has unit trace and is a symmetric strictly diagonally dominant matrix, and hence, positive definite. Then setting $X=X_{ij}$ in ($\star$) isolates the $A_{ij}$ term for $i \ne j$.