# Residual (numerical analysis)

Loosely speaking, a residual is the error in a result. To be precise, suppose we want to find x such that

${\displaystyle f(x)=b.\,}$

Given an approximation x0 of x, the residual is

${\displaystyle b-f(x_{0})\,}$

whereas the error is

${\displaystyle x-x_{0}\,}$

If the exact value of x is not known, the residual can be computed, whereas the error cannot.

## Residual of the approximation of a function

Similar terminology is used dealing with differential, integral and functional equations. For the approximation ${\displaystyle ~f_{\rm {a}}~}$ of the solution ${\displaystyle ~f~}$ of the equation

${\displaystyle T(f)(x)=g(x)}$ ,

the residual can either be the function

${\displaystyle ~g(x)~-~T(f_{\rm {a}})(x)}$

or can be said to be the maximum of the norm of this difference

${\displaystyle \max _{x\in {\mathcal {X}}}|g(x)-T(f_{\rm {a}})(x)|}$

over the domain ${\displaystyle {\mathcal {X}}}$, where the function ${\displaystyle ~f_{\rm {a}}~}$ is expected to approximate the solution ${\displaystyle ~f~}$, or some integral of a function of the difference, for example:

${\displaystyle ~\int _{\mathcal {X}}|g(x)-T(f_{\rm {a}})(x)|^{2}~{\rm {d}}x.}$

In many cases, the smallness of the residual means that the approximation is close to the solution, i.e.,

${\displaystyle ~\left|{\frac {f_{\rm {a}}(x)-f(x)}{f(x)}}\right|\ll 1.~}$

In these cases, the initial equation is considered as well-posed; and the residual can be considered as a measure of deviation of the approximation from the exact solution.

## Use of residuals

While one does not know the exact solution, one may look for the approximation with small residual.

Residuals appear in many areas in mathematics, including iterative solvers such as the generalized minimal residual method, which seeks solutions to equations by systematically minimizing the residual.