# Accuracy between ill-conditioned matrix-free vs. matrix-based operators

As far as I know, precision errors become larger as the condition number of a matrix increases.

Consider a matrix-based operator:

$$A = \nabla \bullet k \nabla$$

And a matrix-free operator:

$$\tilde{A} = B_{1} + B_{2} + B_{3}, \qquad B_{i} = \partial_{x_i} k \partial_{x_i}$$

One difference between the matrix-free operator and matrix-based operator is that the diagonal of $A$ combines derivatives along all 3 directions, whereas the matrix-free operator must add the diagonal for all 3 directions each time.

I tried comparing these two approaches numerically, and I see a difference between them on the order of machine accuracy. It seems that the difference between the operators also increases where $k$ is large.

Here are my questions:

1) Am I just visualizing the local condition number where $k$ is large?

2) Is one of these methods superior being that the difference becomes larger? Or is this just lack of precision becoming more apparent from the increasing condition number?

3) Am I just completely wrong? (this should not happen)

When solving a linear system $Ax=b$, you suffer from two sources of error:

• Round-off error
• The ill-conditionedness of the matrix.

The condition number of a computational representation of a matrix is, for all practical purposes equal to the condition number of the exact matrix (which you can't represent computationally), so it does not matter whether you represent it as a split, matrix-free form, or not.

Likewise, whether you add the three matrices together or not does not make any difference for the difference between your computational representation of the matrix and the "exact" matrix. That is, because for all practical purposes, the addition of 3 terms is as accurate as the computation of each of these terms -- 3 times round off is, in practice, equal to round off, namely very small.

In other words, there will be no practical difference between the two representations of your matrix, unless your condition number is on the order of one over the level of round-off. That is hopefully not the case.

Your "two approaches" are actually the same thing. You know already that they are mathematically the same. But they are also computationally the same thing, except for a possible change in the order of operations. A change in the order of operations will give an error of order of machine epsilon.

You're right of the condition number, in the following sense. As $k$ increases, the effect of roundoff error is amplified proportionately. So if $k$ is much larger than the quantity your operator is applied to, you'll notice more roundoff error.