Sum of squares for matrix valued data over $\mathbb{R}$ and $\mathbb{C}$ Let us assume we have $k \times k$ matrix valued data and assume this is organized (possibly as time series):
$$ M_1, M_2, \ldots, M_n $$
Now, assume we are interested in writing down an error function that mimics sums of squares. This can naively be written as
$$ \sum_{i=1}^n (M_i - \hat M_i)^2 $$
where $\hat M_i$ is the $i$-th estimation. The question is, what is actually the proper way to write this function explicitly? For vectors, the Euclidean norm is &quot;naturally&quot; picked. What about this case?
One option is to multiply out these matrices and treat each of the resulting matrix's elements on its own. For example the element at position 11 would have its own &quot;error function&quot; that looks like:
$$
\sum_i (a_{11}^2 +a_{12}a_{21})
$$
and similarly for the other three elements. Here $M-\hat M \equiv A = (a)_{ij}$. Does this even make sense?
Furthermore, how to treat the same example having complex valued matrices?
Essentially you want to pick a function that will give you the &quot;size&quot; of a matrix. The most obvious way I can think of is by choosing a matrix norm, which is a map $\lVert \cdot \rVert \colon \mathbb{R}^{k, k} \to [0, \infty)$ (or you could generalise to a complex $k \times k$ matrix if you wished).
Your suggestion seems similar to computing
$$S = \sum_i (M_i - \hat M_i)^2$$
then using the Frobenius norm $\lVert S \rVert_F$ to turn this into a real number. The Frobenius norm essentially means &quot;squash $S$ into a vector of dimension $k \times k$, then compute the Euclidean norm&quot;.
There are plenty of other norms you could consider, such as the operator norms. Interestingly enough it can be proved that any two matrix norms are equivalent up to a constant scaling factor, so your choice of norm isn't particularly important, and minimising the &quot;sum of squares&quot; under any norm should be more or less the same.