# Sum of squares for datasets valued in $\mathbb{R}^{m \times m}$ or $\mathbb{C}^{m\times m}$

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 "naturally" 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 "error function" 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?

• What are your $M$s? Are these matrices, or vectors? Over the complex numbers, the Euclidean norm is defined as the norm of the underlying two-dimensional real plane, or $\sqrt{z\overline{z}}$. – Stephan Kolassa Feb 11 at 9:00
• Matrices. Real or complex. – Marion Feb 11 at 9:09
• I'm a bit unclear on what you are trying to do, but you may want to look at matrix norms. Over the complex numbers, they would use the complex norm as per my previous comment. – Stephan Kolassa Feb 11 at 9:52
• Of course. So, real question is what are ways to define error functions for matrix valued data that can be real or complex. – Marion Feb 11 at 10:23
• Well, errors come down to a notion of distance. So you are looking for ways of endowing your matrix spaces with a metric. Any norm will define a metric via $d(X,Y)=||X-Y||$, so matrix norms would be a logical start. Alternatively, there are metrics that are not defined by norms, like using the rank of $X-Y$ - but these may not be useful to you. Which metric or norm is most useful will depend on what underlying problem you are working on. – Stephan Kolassa Feb 11 at 10:28