How can I solve , where
and
and
in the least squares sense in matlab?
So I'd like to have the minimizing as output.
How can I solve , where
and
and
in the least squares sense in matlab?
So I'd like to have the minimizing as output.
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
: