Is there any way to transform $C=\mathrm{Tr}\left(AX\right)$ to $C=KX$ or $C=KXM$, $K$ and $M$ can be some arbitrary matrices? I mean I want to get rid of the trace operator and keep the matrix $X$.

  • 1
    $\begingroup$ No, not really. Can you be more specific about why you want such an expression? $\endgroup$
    – Alex Zorn
    Commented Aug 8, 2015 at 18:40
  • $\begingroup$ What is $X$? ... $\endgroup$ Commented Aug 8, 2015 at 18:52
  • 1
    $\begingroup$ sorry X is a matrix too, which is inside the trace operator, I have just edited my question $\endgroup$
    – vegeta
    Commented Aug 8, 2015 at 18:57

2 Answers 2


Let $\mathbb{K}$ be a commutative ring, $n,m\in\mathbb{N}\setminus\{0\}$, $A=\left(a_{ij}\right)\in\mathrm{M}_{nm}\left(\mathbb{K}\right)$ and $B=\left(b_{ij}\right)\in\mathrm{M}_{mn}\left(\mathbb{K}\right)$ (as the trace is defined for square matrices, the size of $A$ and $B$ must agree). We have $$\left(AB\right)_{ij}=\sum_{k=1}^{m}a_{ik}b_{kj}\quad\quad\quad 1\leq i,j\leq n$$ and then $$\mathrm{Tr}\left(AB\right)=\sum_{i=1}^{n}\sum_{j=1}^{m}a_{ij}b_{ji}.$$ You can get this element of $\mathbb{K}$ with the matrix product $XY$, where $$X= \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1m} & a_{21} & \cdots & a_{2m} & \cdots & a_{n1} & \cdots & a_{nm} \end{pmatrix} $$ and $$Y= \begin{pmatrix}b_{11} & b_{21} & \cdots & b_{m1} & b_{12} & \cdots & b_{1n} & \cdots & b_{1n} & \cdots & b_{mn}\end{pmatrix}^{T}.$$ Not sure if it answers the question.


For example, for two $2\times 2$ matrices, we have $$\mathrm{{Tr}}\left(\begin{pmatrix}a_{11} & a_{12}\\ a_{21} & a_{22} \end{pmatrix}\begin{pmatrix}b_{11} & b_{12}\\ b_{21} & b_{22} \end{pmatrix}\right)=\mathrm{{Tr}}\begin{pmatrix}a_{11}b_{11}+a_{12}b_{21} & a_{11}b_{12}+a_{12}b_{22}\\ a_{21}b_{11}+a_{22}b_{21} & a_{21}b_{12}+a_{22}b_{22} \end{pmatrix}$$

$$=a_{11}b_{11}+a_{12}b_{21}+a_{21}b_{12}+a_{22}b_{22}=\begin{pmatrix}a_{11} & a_{12} & a_{21} & a_{22}\end{pmatrix}\begin{pmatrix}b_{11}\\ b_{21}\\ b_{12}\\ b_{22} \end{pmatrix}.$$

But the original question has been edited, so I'm not sure that this is an answer anymore.

  • $\begingroup$ Could you do a concrete example (just small 2x2 matrices)? I have trouble seeing it. $\endgroup$ Commented Aug 8, 2015 at 22:29
  • $\begingroup$ @YoTengoUnLCD I have edited my post. $\endgroup$
    – Nicolas
    Commented Aug 9, 2015 at 9:06

It's possible if $A$ is a rank 1 matrix. In that case we can write $A=uv^T$, where $u$ and $v$ are column vectors.

$$ \mathrm{Tr}(AX)=\mathrm{Tr}(uv^TX)=\mathrm{Tr}(v^TXu)=v^TXu $$

This is in fact only possible if $A$ is rank 1. After all, the trace operator maps onto a scalar, so the only way the expression $\mathrm{Tr}\left(AX\right) = KXM$ makes any sense is if $K$ is a $1 \times n$ and $M$ is $n \times 1$ (and $X$ is $n \times n$).

However, general matrices can be expressed it a sum of rank-1 matrices, so sometimes it may be helpful to write this:

$$ A = \sum_{i=1}^k u_i v_i^T \ \Leftrightarrow \ \mathrm{Tr}(AX)=\sum_{i=1}^k v_i^TXu_i, \ \forall X \in \mathbb{R}^{n \times n} $$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .