We know that the Frobenius inner product $A \cdot B = tr(A^\top B)$ between two $n\times n$ matrices $A$ and $B$ can be represented as $$ A \cdot B = \langle\vec A, \vec B\rangle = tr \vec A (\vec B)^\top$$ where on the right side $\langle \cdot, \rangle$ is the ordinary Euclidean scalar product and where $\vec X$ denotes the vectorization of $X$. I am curious about (and would have use of) a slightly more general case.

In particular, I have matrices $Q,A,B$ where I want to use positive definite matrix $Q$ to "skew" the inner product, i.e., I am interest in the rewriting the quantity $$ tr (Q A^\top B) $$ in terms of $\vec A$ and $\vec B$ as is possible when $Q=I$.

My question is thus: Can we write $$tr (QA^\top B) = \langle \vec A, \vec B \rangle_Q $$ where $\langle\cdot, \cdot \rangle_Q$ is a skewed euclidean inner product on $\mathbb{R} ^{n^2}$, depending on $Q$?

My guess would be that this is indeed possible and should look something like $$tr (QA^\top B) = tr \left( (I \otimes Q) (\vec A \otimes (\vec B)^\top))\right) $$ but I am certainly not sure and don't really know how to proceed.

I would very much appreciate help in finding a rewrite of the quantity $tr (QA^\top B)$which is similar to this.

Edit for clarity:

The question could be reformulated as: Is there a euclidean inner product $\langle , \rangle _Q$ weighted by some matrix (say $M=M(Q)$), such that $tr( QA^\top B) = \langle \vec A, \vec B\rangle_Q=\langle M(Q) \vec A,\vec B\rangle$? In the end what I am after is to express $tr QA^\top B$ in terms of the trace of the outer product of $\vec A$ and $\vec B$.

Progress Update:

I was able to find a reference ( https://www.ime.unicamp.br/~cnaber/Kronecker.pdf) online which states that

$$ tr (ABC ) = (\vec A^\top)^\top (I\otimes B) \vec C$$

which is more or less equivalent to what I am asking. However, as the reference does include a proof, I would still like this to be resolved.

  • 1
    $\begingroup$ How do you mean skew? As in a prescribed weight for position of each element? If so, then I think this won't work but you will need to work in vectorized space. But maybe you are happy to only be able to skew different rows differently? Then I think it will work. $\endgroup$ Oct 25, 2019 at 11:58
  • $\begingroup$ By skew I am referring to the premultplication by the matrix $Q$ in the trace. $\endgroup$ Oct 25, 2019 at 12:01
  • 1
    $\begingroup$ Ok, you can for sure get something more general with $vec(A)^T Q vec(B)$, where $Q$ is big diagonal matrix with one diagonal entry per matrix entry in each $A$ and $B$ but maybe you don't need it. Yes Kronecker product with identity matrix shall also help you get what you want. I think there is a good wikipedia on it. en.wikipedia.org/wiki/Kronecker_product#Matrix_equations $\endgroup$ Oct 25, 2019 at 13:29

1 Answer 1


For ease of typing, let's use $A:B$ instead of $A\cdot B$ to denote the Frobenius inner product,
and $a$ instead of $\vec A$ to denote vectorization, i.e. $$\eqalign{ A:B &= {\rm Tr}(A^TB) = &{\rm Tr}(B^TA) = B:A \\ A:B &= a:b &({\rm Frobenius\,product\,notation})\\ A:B &= a^Tb &({\rm Matrix\,product\,notation})\\ }$$ Using this we can develop various expressions for the following scalar quantity $$\eqalign{ {\rm Tr}(QA^TB) &= {\rm Tr}(A^TBQ) \\ &= A:BQ \\ &= {\rm vec}(A):{\rm vec}(IBQ) \\ &= a:(Q^T\otimes I)\,b \\ &= a^T(Q^T\otimes I)\,b \\ &= b^T(Q\otimes I)\,a \\ }$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.