# Is this a reasonable method of numerically comparing two matrix functions?

I am currently trying to compare two matrices with elements which are too complicated for me to algebraically show that they are equal element wise and I decided to try the following approach:

Suppose I have two matrix functions $A(t)$ and $B(t)$ whose entries are somewhat complicated, but "nice" differentiable functions.

If I use a computer algebra system such as MATLAB and evaluate

$$\det(A(t)-B(t))$$

at a thousand points between $t = [0,10]$. If the maximum of the determinant over that interval is $4*10^{-31}$, is that enough for me to be reasonably sure $A(t) = B(t)$ on $[0,10]$? I tried searching and I couldn't find examples of using the determinant as a measurement for error.

Edit: I should point out that these matrices are never upper, or lower triangular such as this:

$$A(t)= \begin{bmatrix} 0&t\\ 0&0 \end{bmatrix}, B(t) = \begin{bmatrix} 0&2t\\ 0&0 \end{bmatrix}$$ but even if they were, is there any reasonable way to fix this method without simply comparing the matrices element wise?

If $\det(M)=0$, then we can only say that $M$ is singular, but $M$ itself could be very much non-zero.
However, if the norm of the matrix $M=A-B$ is zero, then $M=0$. So perhaps look at $\mathrm{tr}(M^\top M)$, assuming that $M$ is real (otherwise use conjugate transpose).
• @JessicaK The point is that $\mathrm{tr}(M^TM)$ is the square of a norm, in particular the Frobenius norm of $A-B$. Any suitable norm can be used to measure the distance between $A$ and $B$, see help norm in MATLAB. Determinants don't tell you anything here: consider $A=\begin{bmatrix}1 & 0 \\ 0 & 1\end{bmatrix}$ and $B=\begin{bmatrix}1 & \text{something huge} \\ 0 & 1\end{bmatrix}$. Oct 31 '14 at 11:31