When researching a way to evaluate if two square matrices are equal or (very close to being equal) for a computer vision localization problem, I came across this Math Exchange post

Minimize the Frobenius norm of the difference of two matrices with respect to matrix: $\underset{B} {\mathrm{argmin}} \left\| A- B \right\|_F$

Following the accepted answer in that post, is it "mathematically" sound to conclude that $A \approx B$ if $\left | A - B \right |^2_F$ is a very small scalar number?

With best

  • 3
    $\begingroup$ How do you define $A \approx B$? What does that mean? $\endgroup$
    – Daniel P
    Jan 2 at 1:05
  • $\begingroup$ @DanielP, consider $A$ is a 4x4 Transformation matrix and $B$ is also another 4x4 Transformation matrix that defines the "pose" of a 3d object with respect to world coordinate frame at times $t_0$ and $t_1$ respectively. Say at time $t_1$, the camera has physically return to a position where previously, it recorded its pose as $A$. So by $A \approx B$ I was asking the question, whether the pose at $t_1$ is exactly (or very close to) "same" as that of the pose from time $t_0$ $\endgroup$ Jan 2 at 17:39

1 Answer 1


This depends on what properties of the matrices are under consideration. E.g. invertibility is not stable under the Frobenius norm. Set $$ A=\begin{bmatrix} \varepsilon &0\\0&\varepsilon \end{bmatrix}\text{ and }B=\begin{bmatrix} 0&0\\0&0 \end{bmatrix} $$ then $$ |A-B|_F=\sqrt{\sum_{i=1}^n\sum_{j=1}^n |a_{ij}|^2}=\sqrt{2}\,\varepsilon . $$ The matrices are close by that measure for positive and small $\varepsilon $ but have fundamentally different properties; one is regular, and the other one eliminates all. If you are depending on algebraic properties as invertibility, then matrix norms aren't suited to measure a distance. However, they represent a good measure in case you are interested in whether $A$ and $B$ are topologically, or geometrically close.

  • $\begingroup$ Thank u for the detailed answer. Could u refer to a reference from which I can look this up in more details? $\endgroup$ Jan 2 at 16:08
  • $\begingroup$ @AzmyinMd.Kamal What do you mean by "this"? You could imagine the situation as follows: The set of invertible matrices forms a three-dimensional sphere and your norm is a ruler. So whatever you change along the ruler will leave the sphere and you lose invertibility. But it is still close to the sphere. This is only a heuristic, the actual situation is a bit more complicated mainly for dimensional reasons. So what is "this"? Algorithmic stability in linear algebra? It all depends on the role your matrices have! If invertibility isn't an issue, then you might be fine. $\endgroup$ Jan 2 at 17:06
  • $\begingroup$ @Mauris S.L, thank you very much for the detailed follow up response. Apologies for the confusion. By "this" I was referring to the formula for $|A - B|_F$ that you presented. But I got the jist of the heuristic method shown and will try it out in my algorithm. $\endgroup$ Jan 2 at 17:42
  • $\begingroup$ I simply looked up the formula on Wikipedia. The main issue here is: matrices (and their usual norms) form something like our three-dimensional space. We have no problems measuring our rooms or adding distances. Now, if we demand that a certain property of matrices is preserved, then this property comes into focus. I have chosen invertibility as an example. Invertibility is not linear, will say $A^{-1}+B^{-1}\neq (A+B)^{-1}.$ Hence, addition is destroyed. But if your property is linear, i.e. respects addition and stretching then probably can use norms to define "close to". $\endgroup$ Jan 2 at 17:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .