# Is there a formula to calculate the euclidean distance of two matrices?

Wiki gives this formula

{\displaystyle {\begin{aligned}d(\mathbf {p} ,\mathbf {q} )=d(\mathbf {q} ,\mathbf {p} )&={\sqrt {(q_{1}-p_{1})^{2}+(q_{2}-p_{2})^{2}+\cdots +(q_{n}-p_{n})^{2}}}\\[8pt]&={\sqrt {\sum _{i=1}^{n}(q_{i}-p_{i})^{2}}}.\end{aligned}}}

to calculate the euclidean distance of two vectors.

Is there a similar formula to calculate the euclidean distance of two matrices?

• Yes. It is precisely the same. Sum over all the entries in the matrices similar to how here you sum over all the entries in the vectors. Aug 21, 2019 at 10:09

There are many different forms of distance measures between two matrices.

• Frobenius Norm: $$\|A-B\|_F = \sum _{i=1}^{N}\sum _{j=1}^{N}|(a-b)_{ij}|^{2}$$

• Matrix 2-norm: $$\| A - B\|_2 = \sqrt{\lambda_{max}(A-B)^{H}(A-B)}$$

• Matrix $$\infty$$ norm: $$\|A-B\|_{infty} =\max _{1\leq i\leq m}\sum _{j=1}^{n}|(a-b)_{ij}|$$

Essentially because matrices can exist in so many different ways, there are many ways to measure the distance between two matrices.

Think of like multiplying matrices. There are so many different ways to multiply matrices together. There are even at least two ways to multiple Euclidean vectors together (dot product / cross product)

https://en.wikipedia.org/wiki/Matrix_norm

• Thank you so much. What does $\lambda_{max}$ mean? What does $(A-B)^{H}$ mean? Aug 21, 2019 at 10:46
• Raise to the power of H means the Hermitian, i.e. conjugate transpose. lambda_max means the largest eigenvalue. Look at the link I gave and let me know if you have more Qs. If you are happy with my answer please upvote and accept it please :) Aug 21, 2019 at 10:48