= (trace of transpose of a matrix = trace of the matrix)
Tr{Xaa'X'} - 2 Tr{ba'X'} + Tr{bb'}
where ' denotes the transpose operator (because all matrices involved are real, transpose and conjugate transpose are the same).
Now, if you refer to section 2.5 of the Matrix Cookbook, you'll find that
the derivative of Tr{Xaa'X'} is 2Xaa' (see equation 111),
the derivative of Tr{ba'X'} is ba' (see equation 104),
the derivative of Tr{bb'} is 0 (because this expression doesn't depend on X).
(Differentiation is performed with respect to matrix X).
Therefore, the matrix that minimises the quantity of interest satisfies
2Xaa' = 2ba'
Xaa' = ba'
Therefore, you can use MATLAB's matrix right-division operator, /, to compute X:
Rewrite the quantity to minimise as
||Xa - b||^2
=
(definition of the Frobenius norm)Tr{(Xa - b) (Xa - b)'}
=
(expand matrix-product expression)Tr{Xaa'X' - ba'X' - Xab' + bb'}
=
(linearity of the trace operator)Tr{Xaa'X'} - Tr{ba'X'} - Tr{Xab'} + Tr{bb'}
=
(trace of transpose of a matrix = trace of the matrix)Tr{Xaa'X'} - 2 Tr{ba'X'} + Tr{bb'}
where
'
denotes the transpose operator (because all matrices involved are real, transpose and conjugate transpose are the same). Now, if you refer to section 2.5 of the Matrix Cookbook, you'll find thatTr{Xaa'X'}
is2Xaa'
(see equation 111),Tr{ba'X'}
isba'
(see equation 104),Tr{bb'}
is0
(because this expression doesn't depend onX
).(Differentiation is performed with respect to matrix
X
).Therefore, the matrix that minimises the quantity of interest satisfies
Therefore, you can use MATLAB's matrix right-division operator,
/
, to computeX
: