In mathematics a rational function is a ratio of polynomials. For a single variable x a typical rational function is therefore P(x)/Q(x) where P and Q are polynomials, and Q isn't the zero polynomial. Any non-zero polynomial Q is acceptable; but the possibility that a given value a assigned to x could make Q(a) = 0 means that rational functions, unlike polynomials, do not always have an obvious function domain of definition. In fact if we take 1/(x2 + 1), this function is everywhere defined for real numbers x, but not for complex numbers where the denominator is 0 at x = i and x = -i.

From a mathematical point of view, a polynomial is firstly a formal expression, and only secondly a function (on some given domain). Despite the name, the same is equally true of rational functions. In abstract algebra a definition of rational function is given as element of the fraction field of a polynomial ring. For this definition to succeed, we must start with an integral domain R (for example, a field). Then R[X,Y,..., T], the ring of polynomials in some indeterminates X, ... , T, will also be an integral domain; and we can properly take a fraction field. (In greater generality for commutative rings the construction will be a localization of a polynomial ring.)