# Condition Number

Ill conditioning arises while solving linear equations of the type

$\mathbf{f} = \mathbf{Kx}$

for given loads $\mathbf{f}$ and stiffness $\mathbf{K}$ in (say) linear static analysis, approximations are introduced in the solution because all calculations are carried out in finite precision arithmetic. This becomes important when $\mathbf{K}$ is ill-conditioned because there is a possibility of these approximations leading to large errors in the displacements. The extent of these errors can be quantified by the 'condition number' of the stiffness matrix.

The condition number of a matrix (with respect to inversion) measures worst-case of changes in $\mathbf{x}$ corresponding to small changes in $\mathbf{K}$ or $\mathbf{f}$. It can be calculated using the product of norm of the matrix times the norm of its inverse.

$\kappa\left( \mathbf{K} \right) = \left\| \mathbf{K} \right\| \cdot \left\| \mathbf{K}^{-1} \right\|$

where $\left\lVert \right\rVert$ is a subordinate matrix norm.

If $\mathbf{K}$ is a symmetric matrix, the condition number $\kappa\left( \mathbf{K} \right)$ can be shown to the ratio of its maximum and minimum eigenvalues $\lambda_{\max}$ and $\lambda_{\min}$.

$\kappa\left( \mathbf{K} \right) = \left| \frac{\lambda_{\max}}{\lambda_{\min}} \right|$

The minimum value of $\kappa\left( \mathbf{K} \right)$ is 1 and the maximum value is infinity. If the condition number is small, the computed solution $\mathbf{x}$ is reliable (i.e. a reliable approximation to the true solution of $\mathbf{f} = \mathbf{Kx}$). If the condition number is large, (i.e. if the matrix is almost singular) the results cannot be trusted.

GSA computes a lower bound approximation to the 1-norm condition number of $\mathbf{K}$ and this is reported as part of the solver output. This can be used to evaluate the accuracy of the solution both qualitatively and quantitatively. The (qualitative) rule of thumb for accuracy is $n$ – the number of digits of accuracy in $\mathbf{x}$ is

$n = 16 - \log\kappa$

In general any stiffness matrix with condition number above 1015 can produce results with no accuracy at all. Any results produced from matrices with condition number greater than 1010 must be treated with caution.

Where a model is ill-conditioned, Model Stability analysis can help detect the causes of ill conditioning.

For a given condition number, we can also compute the maximum relative error in $\mathbf{x}$. The max. relative error in $\mathbf{x}$ is defined as the maximum ratio of norms of error in $\mathbf{x}$ to $\mathbf{x}$, i.e.

${e_{max} = \frac{\left| \Delta\mathbf{x} \right|}{\left| \mathbf{x} \right|}}$

Given a matrix $\mathbf{K}$ with condition number $\kappa$, the maximum relative error in $\mathbf{x}$ when solving $\mathbf{f} = \mathbf{Kx}$ is

$\frac{2\varepsilon\kappa}{1 - \varepsilon\kappa}$

where $\varepsilon$ is the constant 'unit-roundoff' and is equal to 1.11e-16 for double precision floating point numbers. The maximum relative error is computed and reported as part of solver output. Ideally, this should be small $( < < 1)$, since a small relative error indicates a reliable solution but as $\kappa \rightarrow \frac{1}{\varepsilon}$, the relative error grows rapidly.

GSA calculates the condition number using Higham and Tisseur's block 1-Norm condition number estimation algorithm.

These are reported in the Analysis Details output.