TITLE: Trace of an integral
QUESTION [11 upvotes]: Given appropriate matrices $A$ and $B_x$, is $\,\,tr\left(\int A B_x dx\right) = \int tr\left(A B_x\right) dx\,\,?$
If so, is it true by the argument that it transfers from (discrete) sums?

REPLY [7 votes]: Suppose $A$ is $n \times m$ and $B$ is $m\times n$. Then
$$\text{tr}\left(\int A B_x dx\right) = \sum_{i=1}^n\left(\int A B_x dx\right)_{ii} = \sum_{i=1}^n\left(\int \sum_{j=1}^nA_{ij}(B_x)_{ji} dx\right) $$
$$=\int \sum_{i=1}^n\sum_{j=1}^nA_{ij}(B_x)_{ji} dx = \int \sum_{i=1}^n (AB_x)_{ii}dx = \int \text{tr}(AB_x) dx,$$
where the only step which is not a definition is the commutation of the integral and the finite sum.