Prove that if $\frac{\mbox{Tr}(AB)}{\mbox{Tr}(B)} = 1$ for every positive semidefinite matrix $B$, then $A$ is the identity.
A professor of mine recently used this property in lecture to show that a given matrix is the identity, but this property is not obvious to me. Could someone show me a proof of this?
The best I could come up with (shared below) is that if $A$ is not the identity, there exists a vector $v$ of unit length such that $v^*Av\neq 1$, so we can define $B = vv^*$, so that $\operatorname{Tr}(B) = 1$ and $\operatorname{Tr}(AB)/Tr(B) = v^*Av \neq 1$, and this proves the statement by proving the contrapositive.
Does this proof require $A$ to be Hermitian? Are there any counterexamples where $A$ is not Hermitian? I would be grateful if anyone could offer a more rigorous proof.
I am assuming here that $A$ is Hermitian. Then, one can write $A-I=\sum_i\lambda_iu_iu_i^*$, where the $\lambda_i$'s are the eigenvalues and $u_i$'s are the (orthogonal) eigenvectors.
Then we have that
$$\mathrm{trace}((A-I)B)=\sum_i\lambda_iu_i^*Bu_i=0$$
If we assume that $A=I$, then we have that all the $\lambda_i$'s are zero, and the above expression holds for all $B$'s.
To prove the necessity, pick $B=u_ku_k^*$, $k=1,\ldots$. This yields
$$\mathrm{trace}((A-I)B)=\lambda_k=0$$
where we have used the fact that the eigenvectors or orthogonal. This implies that the above expression holds if and only if $\lambda_k=0$. Repeating for all $k$'s then implies that all the eigenvalues $\lambda_i$ must be zero and that $A$ must be the identity matrix.
Update. In fact, a similar argument can be applied when $A$ is not Hermitian by using the singular value decomposition
$$A-I=\sum_i\sigma_iu_iv_i^*$$
where the matrices $U=[u_1\ \ldots\ u_n]$ and $V=[v_1\ \ldots\ v_n]$ are unitary (i.e. $U^*U=V^*V=I$). This yields
$$\mathrm{trace}((A-I)B)=\sum_i\sigma_iv_i^*Bu_i=0.$$
The rest of the proof follows from the same lines (using now the test matrices $B=v_ku_k^*$ or $B=u_ku_k^*$ for the symmetric PSD case with the extra assumption that $u_k^*v_k\ne0$.) and using the fact that if all the singular values of a matrix are zero, then this matrix must be the zero matrix.