# Are Trace of product of matrices- distributive/associative?

Is $\operatorname{Tr}(X^TAX)-\operatorname{Tr}(X^TBX)$ equal to $\operatorname{Tr}(X^TCX)$, where $C=A-B$ and $A$, $B$, $X$ have real entries and also $A$ and $B$ are p.s.d.

-

Yes, as $$X^t(A-B)X=X^t(AX-BX)=X^tAX-X^tBX,$$ using associativity and distributivity of product with respect to the addition. The fact that the matrices $A$ and $B$ are p.s.d. is not needed here.
Well, we know that for square matrices $A$ and $B$, $\mathrm{tr}(A)+\mathrm{tr}(B)=\mathrm{tr}(A+B)$. Thus, in your case, what is left to check is whether $X^{T}CX=X^{T}AX-X^{T}BX$. We have:
$$X^{T}CX=X^{T}(A-B)X=(X^{T}A-X^{T}B)X=X^{T}AX-X^{T}BX.$$