I have the following expression
$$T = \operatorname{Trace}(AMA')$$
where $M$ is a square $n\times n$ matrix, and $A$ is a $m \times n$ matrix, both full-rank. The goal I want to achieve is that I do not want any of the off-diagonal elements of $M$ to enter into the equation for $T$. Therefore I am looking for the necessary condition on $A$ such that this is the case. I already know that a sufficient condition is the fact that $A$ is diagonal - in this case, none of the off-diagonal elements of $M$ will enter into the formula for the trace. However, I am hoping that there is a more general condition on $A$ such that this is true.
For example, lets say that \begin{equation} {\bf A} = \begin{bmatrix} a&b\\c&d\\e&f \end{bmatrix}. \end{equation}
and
\begin{equation} {\bf M} = \begin{bmatrix} g&h\\i&j \end{bmatrix}. \end{equation}
Clearly $\operatorname{Trace} (M)$ is a function of $g$ and $j$ only. So I am looking for the necessary conditions on the matrix $A$ such that $\operatorname{Trace} (AMA')$ is also a function of $g,j$, and the entries of $A$, but not a function of $i$ and $h$.
Any help or hints would be greatly appreciated!
Thank you,
Paul
Thanks to the help of some commenters, A is a matrix with orthogonal columns. Just to give some background on why I was asking this question in case anyone is interested:
I was trying to solve a multidimensional HJB equation, which involved as one of its terms
Trace(AHA'), where H is the hessian matrix. In my case I had the freedom to pick the matrix A freely as long as it was full-rank. The reason I didn't want the off-diagonal elements of H to affect the trace is that would mean I wouldn't have to deal with cross-derivatives in my PDE system. Therefore picking the correct A means that I have a decoupled system of PDEs which is easier to solve.
-Paul