1

I am wondering if there is any way to compute mathematically the similarity/distance between two square matrices as a single value?

2 Answers2

1

So, you are asking for a metric that takes two matrices, $A$ and $B$, and outputs a real number $d(A,B)$ obeying the principles one expects from a distance function : symmetry, reflexivity, the triangle equality. One way to view this is to view that space of $n \times n$ real matrices as the vector space $\mathbb{R}^{n^2}$. This comes with the standard euclidean norm/metric, that lets you tell how close or far two matrices are from each other in some sense, but I am not sure it is of any use.

It would basically treat each entry in the matrix as a coordinate, and see how far they are form each other. A matrix of all zeroes would be close to a matrix with nearly all zeroes, and a single entry equal to one.

You could always use the discrete metric: two matrices have a distance of 1 if they are different, and 0 if they are equal.

Harry Wilson
  • 1,084
0

Depends on what would you like the distance between for instance $I$ and $-I$ to be. Or even the distance between $I$ and null/zero matrix $0$.

But I expect that in most cases you should also take into account the vectors you want to multiply with.

In the general case, I don't expect such distance would exist as a single (real) value, however, there will be plenty of special cases that you'd have to handle separately.

Pieter21
  • 3,475