Matrix trace based formulation of least-squares

774 Views Asked by At

How can the following function be represented in a matrix form using matrix trace?

$||y-X\beta||^2 + \lambda \beta^T S \beta$

Note that $y, \beta$ are real vectors and $\lambda$ is a real scalar while $X$ is a rectangular matrix and $S$ is a square matrix with both matrices again having real entries.

1

There are 1 best solutions below

0
On BEST ANSWER

If you want to make the trace appear, you can use the following formula: $$ y^Tz=\mbox{Tr} (yz^T). $$ Then $$ \|y-X\beta\|^2+\lambda \beta^TS\beta=(y-X\beta)^T(y-X\beta)+\lambda \beta^TS\beta $$ $$ =\mbox{Tr}((y-X\beta)(y-X\beta)^T)+\lambda \mbox{Tr}(\beta \beta^TS^T) $$ $$ =\mbox{Tr}((y-X\beta)(y-X\beta)^T+\lambda \beta \beta^TS^T)) $$