Suppose $A$ and $B$ are known matrices, and we are to find matrix $X$ that minimizes the following function,
Taking the relevant derivative w.r.t $X$ gives us, $$ X +(X^TAX-B)(A+A^T)X$$
I couldn't reduce the derivative further as $A$ is not necessarily a square matrix; so, $(A+A^T)$ would be invalid. I am using the formula in slide 17, Matrix Calculus to differentiate $X^TAX$ to $(A+A^T)X$
Is there a way to circumvent this issue?