# Invalid quadratic form (Matrix multiplications)

I have a matrix multiplication of the form (K’RKT). I have read a lot of answers on the forum where the K’RK can be converted to scalar form. But if there is an extra T matrix at the end, is there a way to put it in solvable form?
The function to be minimized is trace(K’RKT).
P.S: neither R nor T are positive definite.

Any help/advice/ suggestions are most welcome.

This is not convex in general.

I leave it to you to prove that this expression is convex using your particular values of `R` and`T`. Unless and until you have done so, I will presume this is non-convex.

Yes you are right. I should have been specific. R is a diagonal matrix with a single value. So that can easily be taken out as a constant. T is a sum of two quadratic terms as given by:
T=A’PA+D’D.
While giving this reply, I realize that the best way to do this is to write all the terms, expand and take individual traces.
Could you confirm that this method would be correct?

I’m not sure what you are saying, but it is true that
`trace(A'*(B+C)*A) = trace(A'*B*A) + trace(A'*C*A)`
because matrix multiplication is distributive with respect to addition.

And of course you are free to use the fact that trace is invariant to cyclic permutations https://en.wikipedia.org/wiki/Trace_(linear_algebra)#Cyclic_property