# Partial function

﻿
Partial function  An example of a partial function that is not a total function.  An example of a partial function that is also a total function.

In mathematics, a partial function from X to Y is a function ƒ: X' → Y, where X' is a subset of X. It generalizes the concept of a function by not forcing f to map every element of X to an element of Y (only some subset X' of X). If X' = X, then ƒ is called a total function and is equivalent to a function. Partial functions are often used when the exact domain, X' , is not known (e.g. many functions in computability theory).

Specifically, we will say that for any x ∈ X, either:

• ƒ(x) = y ∈ Y (it is defined as a single element in Y) or
• ƒ(x) is undefined.

For example we can consider the square root function restricted to the integers $g\colon \mathbb{Z} \to \mathbb{Z}$ $g(n) = \sqrt{n}$

Thus g(n) is only defined for n that are perfect squares (i.e. 0, 1, 4, 9, 16, ...). So, g(25) = 5, but g(26) is undefined.

## Domain of a partial function

There are two distinct meanings in current mathematical usage for the notion of the domain of a partial function. Most mathematicians, including recursion theorists, use the term "domain of f" for the set of all values x such that f(x) is defined ( X' above). But some, particularly category theorists, consider the domain of a partial function f:XY to be X, and refer to X' as the domain of definition.

Occasionally, a partial function with domain X and codomain Y is written as f: XY, using an arrow with vertical stroke.

A partial function is said to be injective or surjective when the total function given by the restriction of the partial function to its domain of definition is. A partial function may be both injective and surjective, but the term bijection generally only applies to total functions.

An injective partial function may be inverted to an injective partial function, and a partial function which is both injective and surjective has an injective function as inverse.

## Discussion and examples

The first diagram above represents a partial function that is not a total function since the element 1 in the left-hand set is not associated with anything in the right-hand set.

### Natural logarithm

Consider the natural logarithm function mapping the real numbers to themselves. The logarithm of a non-positive real is not a real number, so the natural logarithm function doesn't associate any real number in the codomain with any non-positive real number in the domain. Therefore, the natural logarithm function is not a total function when viewed as a function from the reals to themselves, but it is a partial function. If the domain is restricted to only include the positive reals (that is, if the natural logarithm function is viewed as a function from the positive reals to the reals), then the natural logarithm is a total function.

### Subtraction of natural numbers

Subtraction of natural numbers (non-negative integers) can be viewed as a partial function: $f: \mathbb{N} \times \mathbb{N} \to \mathbb{N}$
f(x,y) = xy

It is only defined when $x \ge y$.

### Bottom type

In some automated theorem proving systems a partial function is considered as returning the bottom type when it is undefined. The Curry-Howard correspondence uses this to map proofs and computer programs to each other.

In computer science a partial function corresponds to a subroutine that raises an exception or loops forever. The IEEE floating point standard defines a Not-a-number value which is returned when a floating point operation is undefined and exceptions are suppressed, e.g. when the square root of a negative number is requested.

In a programming language where function parameters are statically typed, a function may be defined as a partial function because the language's type system cannot express the exact domain of the function, so the programmer instead gives it the smallest domain which is expressible as a type and contains the true domain.

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• partial function — noun A function whose domain is a subset of some set …   Wiktionary

• Partial — may refer to:*partial derivative, in mathematics *partial function, in mathematics *partial algorithm, in computer science *part score, in contract bridge *partial wave, in acoustics …   Wikipedia

• Function (mathematics) — f(x) redirects here. For the band, see f(x) (band). Graph of example function, In mathematics, a function associates one quantity, the a …   Wikipedia

• Partial equivalence relation — In mathematics, a partial equivalence relation (often abbreviated as PER) R on a set X is a relation which is symmetric and transitive . In other words, it holds for all a, b and c in X that:# (Symmetry) if a R b then b R a # (Transitivity) if a… …   Wikipedia

• Partial word — A partial word is a string that may contain a number of do not know or do not care symbols. More formally, it is a partial function u: { 0, ldots, n 1 } ightarrow A where A is some finite alphabet. If i in { 0, ldots, n 1 } but u(i) is not… …   Wikipedia

• Partial androgen insensitivity syndrome — Classification and external resources AIS results when the function of the androgen receptor (AR) is impaired. The AR protein (pictured) mediates the effects of androgens in the human body. ICD 10 …   Wikipedia

• partial — par tial (p[aum]r shal), a. [F., fr. LL. partials, fr. L. pars, gen. partis, a part; cf. (for sense 1) F. partiel. See {Part}, n.] 1. Of, pertaining to, or affecting, a part only; not general or universal; not total or entire; as, a partial… …   The Collaborative International Dictionary of English

• Partial differential coefficients — partial par tial (p[aum]r shal), a. [F., fr. LL. partials, fr. L. pars, gen. partis, a part; cf. (for sense 1) F. partiel. See {Part}, n.] 1. Of, pertaining to, or affecting, a part only; not general or universal; not total or entire; as, a… …   The Collaborative International Dictionary of English

• Partial differentials — partial par tial (p[aum]r shal), a. [F., fr. LL. partials, fr. L. pars, gen. partis, a part; cf. (for sense 1) F. partiel. See {Part}, n.] 1. Of, pertaining to, or affecting, a part only; not general or universal; not total or entire; as, a… …   The Collaborative International Dictionary of English

• Partial differentiation — partial par tial (p[aum]r shal), a. [F., fr. LL. partials, fr. L. pars, gen. partis, a part; cf. (for sense 1) F. partiel. See {Part}, n.] 1. Of, pertaining to, or affecting, a part only; not general or universal; not total or entire; as, a… …   The Collaborative International Dictionary of English