# trace of product of a diagonal and a matrix

I would like to know if anything can be said about the trace of a product of two matrices, where one matrix is a diagonal matrix, i.e., $$\text{trace}(DA)=...$$ Are there some bounds in terms of $\text{trace}(D)$ and $\text{trace}(A)$ ?

-
There is no bound in terms of $\text{tr}(D)$ and $\text{tr}(A)$. Consider, for example, $D = A = \left[ \begin{array}{cc} r & 0 \\ 0 & - r \end{array} \right]$ and let $r \to \infty$. –  Qiaochu Yuan Jul 1 at 21:46

Note that, when $D$ is diagonal:

$$(DA)_{ii} = D_{ii} A_{ii}$$

So $tr(DA) = \sum_{i=1}^n D_{ii} A_{ii}$. About the best bound you can do for this is the Cauchy-Schwarz inequality, i.e.

$$|tr(DA)| \leq \left ( \sum_{i=1}^n D_{ii}^2 \right )^{1/2} \left ( \sum_{i=1}^n A_{ii}^2 \right )^{1/2}$$

If you want a result in terms of traces, you can use the fact that $\| x \|_2 \leq \| x \|_1$ to get

$$|tr(DA)| \leq tr(|D|) tr(|A|)$$

where $(|D|)_{ij} = |D_{ij}|$ and similar for $|A|$. The first bound is attained when the diagonals of $D$ and $A$ are proportional to each other. The second is attained when these diagonals only have one nonzero entry. So for example you could have $D=A=\begin{pmatrix} 1 & 0 \\ 0 & 0 \\ \end{pmatrix}$, then $|tr(DA)|=1=1 \cdot 1 = tr(|D|) tr(|A|)$.

Note that when $D$ and $A$ both have nonnegative diagonal entries, we get the nice result

$$tr(DA) \leq tr(D) tr(A)$$

which is probably more like what you were looking for.

-
This is exactly what I was looking for. Thanks. –  pisoir Jul 2 at 7:28

Well.. $$\mathrm{tr}(DA) = \sum_{l = 1}^n \sum_{k = 1}^n d_{lk}a_{kl}$$ But, if $l \neq k$, $d_{lk} = 0$, then $$\mathrm{tr}(DA) = \sum_{l = 0}^n d_{ll}a_{ll}$$

It is easy to compute.

E.g.: $$D = \begin{pmatrix} 3 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & -1 \end{pmatrix} \qquad A = \begin{pmatrix} 4 & 2 & 10 \\ -1 & 2 & -5 \\ 3 & -1 & -1 \end{pmatrix} \qquad \mathrm{tr}(DA) = 3 \cdot 4 + 2 \cdot 2+ (-1) \cdot (-1) = 17$$ You can think of it as the dot product between the vectors formed by the diagonal entries of the matrices. Or even think of $D$'s entries as weights for the sum.

-