Edit(Edit: I add belowmy original answer was perhaps not clear enough, let me try to improve it).
First some notation: for a proof ofmatrix $x$, let me denote by $E(x)$ the existencediagonal matrix with the same diagonal as $x$: if $x=(x_{i,j})_{i,j\leq n}$, $E(x) = (x_{i,j}\delta_{i,j})_{i,j \leq n}$. Equivalently, $E$ is the orthogonal projection on the diagonal matrices when you consider the usual euclidean structure on $M_n$. If will also write $x>0$ to mean $x$ is symmetric positive definite.
I start withYou are asking whether the proof ofmap $f:x \mapsto x^{-1} - E(x^{-1})$ is a bijection from its domain $D=\{x \in M_n(\mathbb R), x>0\textrm{ and }E(x)=1\}$ to its image $I=\{x \in M_n, x=x^*\textrm{ and }E(x)=0\}$. And the unicityanswer is yes. I prove first that $f$ is injective, and then that it is surjective.
f is injective
In fact let me prove the following fact, which is equivalent to the unicity partinjectivity of your question:$f$.
Unless I miss something, the existence** f is surjective **
The surjectivity is true just for topological reasons. More precisely, let me denote by $E: A \in M_n\mapsto (\delta_{i,j} A_{i,j})$ the conditional expectation on the algebra of diagonal matrices, and by $f$ the map from $D=\{x \in M_n(\mathbb R), x>0\textrm{ and }E(x)=1\}$ to $I=\{x \in M_n, x=x^*\textrm{ and }E(x)=0\}$ defined by $f(x) = x^{-1} - E(x^{-1})$. You are asking whether $f$ is a bijection. And the answer is yes. I already provedprove that $f$ is injective. To prove that it is surjective, it is enough to prove that it is continuous, open and proper (because this would imply that the image is an open and closed subset of $I$, and hence everything since $I$ is connected). The continuity is obvious. $f$ is even differentiable, and the differential is explicitely computable and easily seen to be invertible at every point, so that $f$ is indeed open. It remains to check that it is proper.
The proof I have is not completely obvious, maybe I am missing something. Let me only sketch it. Take a sequence $x_k \in D$ that escapes every compact subset of $D$. Since $\|x\|\leq n$ for all $x \in D$, we have that $u_k=\|x_k^{-1}\|\to \infty$ (I consider the operator norm, and the inequality $\|x\|\leq n= Tr(x)$ is because the norm of $x>0$ is its largest eigenvalue, whereas its trace is the sum of its eigenvalues). We want to prove that $\|f(x_k)\|\to \infty$. Assume for contradiction that this is not the case, and that $\|f(x_k)\|\leq C$ for all $k$. We will get a contradiction through a careful study of the spectral decomposition of $x_k$.
Let $\xi_k$ be a sequence of unit vectors ineigenvectors of $\mathbb R^n$ such that$x_k$ relative to the smallest eigenvalue of $x_k$, i.e. $x_k \xi_k = 1/u_k \xi_k$. Now the key observation: the assumption that $\|f(x_k)\|\leq C$ implies that, for all diagonal matrix $d$ with $1$ or $-1$ on the diagonal, the distance from $d \xi_k$ to the space $E_k$$F_k$ spanned by the eigenvectors of $x_k^{-1}$ relative to the eigenvalues in an interval $[u_k-O(1),u_k]$$[u_k/2,u_k]$ goes to zero. ThisFor a proof, consider the random diagonal matrix $d$ in which the diagonal entries are iid random variables uniform in $\{-1,1\}$, so that $E(x) = \mathbb E (d x d)$ (hoping there will be no confusion between $E$ and $\mathbb E$). Then $\langle f(x_k) \xi_k,\xi_k\rangle = \mathbb E ( u_k - \langle x_k d \xi_k, d \xi_k\rangle)$. The lhs of this equality is by assumption smaller than $C$. On the rhs, $u_k - \langle x_k d \xi_k, d \xi_k\rangle \geq 0$ because $E(x)$$d \xi_k$ is a unit vector. This implies that $u_k - \langle x_k d \xi_k, d \xi_k\rangle \leq 2^n C$ for any diagonal matrix with $\pm 1$ on the averagediagonal. But now use the fact that, for $x>0$ in $M_n$, if a unit vector $\xi$ in $\mathbb R^n$ satisfies $\langle x \xi,\xi\rangle \geq \|x\|-\delta$, then $\xi$ is at distance less than $\sqrt{2\delta/\|x\|}$ from the space spanned by the eigenvectors of $dxd$ over all such$x$ relative to eigenvalues in the interval $[\|x\|/2,\|x\|]$ (hint for a proof: consider the decompostion of $\xi$ in an orthonormal basis of eigenvectors of $x$). Here if $\epsilon_k = \sqrt{2^{n+1} C/ u_k}$, we have indeed proved that $d \xi_k$ is at distance less than $\epsilon_k$ from $E_k$ for any diagonal matricesmatrix with $\pm 1$ on the diagonal. This implies
I now claim that there is a vector $\eta_k$ in the canonical basis of $\mathbb R^n$ at distance less than $o(1)$$\sqrt n \epsilon_k$ from $E_k$. This will conclude the proof since it will in particular imply that (if$\langle x_k \eta_k,\eta_k\rangle \to 0$, whereas the assumption $\xi_k(i)$ is$E(x_k)=1$ implies that $\langle x_k \eta_k,\eta_k\rangle = 1$, a contradiction. To prove the claim, let $i$ be such that the $i$-th coordinate of $\xi_k$, then is larger than $\xi_k(i) \eta_k$$1/\sqrt n$ in absolute value. Observe that $\xi_k(i) e_i$ is the averageexpected value of $d\xi_k$ over all diagonal$d \xi$, where $d$'s with $i$-th term on is the diagonalsame random matrix as above, but conditionned to $1$ and$d_i = 1$. This implies that $+-1$ on$\xi_k(i) e_i$ is at distance at most $\epsilon_k$ from $E_k$, which proves the other entries)claim.
A remark I do not like this proof, since it really relies on finite-dimensional techniques. In particular, it does not extend to general von Neumann algebras $\|x_k \eta_k\|\to 0$(whereas the injectivity part does). But this isI would prefer a contradiction with the fact that since $E(x_k)=1$, $\langle x_k \eta_k, \eta_k\rangle = 1$more direct proof.