Partial function
In mathematics, a partial function from X to Y (sometimes written as f : X ↛ Y, f: X ⇸ Y, or f: X ↪ Y) is a function f: X′ → Y, for some subset X′ of X. It generalizes the concept of a function f : X → Y 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 f is called a total function for emphasizing that its domain is not a proper subset of X. Partial functions are often used when the exact domain, X, is not known (for example, in computability theory, general recursive functions are partial functions from the integers to the integers, and there cannot be any algorithm for deciding whether such a function is total). In real and complex analysis, a partial function is generally called simply a function.
Function  

x ↦ f (x)  
Examples by domain and codomain  


Classes/properties  
Constant · Identity · Linear · Polynomial · Rational · Algebraic · Analytic · Smooth · Continuous · Measurable · Injective · Surjective · Bijective  
Constructions  
Restriction · Composition · λ · Inverse  
Generalizations  
Partial · Multivalued · Implicit  
Specifically, we will say that for any x ∈ X, either:
 f(x) = y ∈ Y (it is defined as a single element in Y) or
 f(x) is undefined.
A partial function is a univalent relation, a particular type of binary relation from X to Y.
For example, we can consider the square root function restricted to the integers
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.
Basic concepts
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:X → Y to be X, and refer to X' as the domain of definition. Similarly, the term range can refer to either the codomain or the image of a function.
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 injective or surjective respectively. A partial function may be both injective and surjective (and thus bijective).
Because a function is trivially surjective when restricted to its image, the term partial bijection denotes a partial function which is injective.[1]
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. Furthermore, a total function which is injective may be inverted to an injective partial function.
The notion of transformation can be generalized to partial functions as well. A partial transformation is a function f: A ⇸ B, where both A and B are subsets of some set X.[1]
Total function
Total function is a synonym for function. The use of the adjective "total" is to suggest that it is a special case of a partial function (specifically, a total function with domain X is a special case of a partial function over X). The adjective will typically be used for clarity in contexts where partial functions are common, for example in computability theory.
Function spaces
The set of all partial functions f: X ⇸ Y from a set X to a set Y, denoted by [X ⇸ Y], is the union of all total functions defined on subsets of X with same codomain Y:
the latter also written as . In finite case, its cardinality is
because any partial function can be extended to a total function by any fixed value c not contained in Y, so that the codomain is Y ∪ {c}, an operation which is injective (unique and invertible by restriction).
Discussion and examples
The first diagram at the top of the article represents a partial function that is not a total function since the element 1 in the lefthand set is not associated with anything in the righthand set. Whereas, the second diagram represents a total function since every element on the lefthand set is associated with exactly one element in the right hand set.
Natural logarithm
Consider the natural logarithm function mapping the real numbers to themselves. The logarithm of a nonpositive real is not a real number, so the natural logarithm function doesn't associate any real number in the codomain with any nonpositive 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 (nonnegative integers) can be viewed as a partial function:
It is defined only when .
Bottom element
In denotational semantics a partial function is considered as returning the bottom element when it is undefined.
In computer science a partial function corresponds to a subroutine that raises an exception or loops forever. The IEEE floating point standard defines a notanumber 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.
In category theory
In category theory, when considering the operation of morphism composition in concrete categories, the composition operation is a total function if and only if has one element. The reason for this is that two morphisms and can only be composed as if , that is, the codomain of must equal the domain of .
The category of sets and partial functions is equivalent to but not isomorphic with the category of pointed sets and pointpreserving maps.[2] One textbook notes that "This formal completion of sets and partial maps by adding “improper,” “infinite” elements was reinvented many times, in particular, in topology (onepoint compactification) and in theoretical computer science."[3]
The category of sets and partial bijections is equivalent to its dual.[4] It is the prototypical inverse category.[5]
In abstract algebra
Partial algebra generalizes the notion of universal algebra to partial operations. An example would be a field, in which the multiplicative inversion is the only proper partial operation (because division by zero is not defined).[6]
The set of all partial functions (partial transformations) on a given base set, X, forms a regular semigroup called the semigroup of all partial transformations (or the partial transformation semigroup on X), typically denoted by .[7][8][9] The set of all partial bijections on X forms the symmetric inverse semigroup.[7][8]
Charts and atlases for manifolds and fiber bundles
Charts in the atlases which specify the structure of manifolds and fiber bundles are partial functions. In the case of manifolds, the domain is the point set of the manifold. In the case of fiber bundles, the domain is the total space of the fiber bundle. In these applications, the most important construction is the transition map, which is the composite of one chart with the inverse of another. The initial classification of manifolds and fiber bundles is largely expressed in terms of constraints on these transition maps.
The reason for the use of partial functions instead of total functions is to permit general global topologies to be represented by stitching together local patches to describe the global structure. The "patches" are the domains where the charts are defined.
See also
References
Wikimedia Commons has media related to Partial mappings. 
 Christopher Hollings (2014). Mathematics across the Iron Curtain: A History of the Algebraic Theory of Semigroups. American Mathematical Society. p. 251. ISBN 9781470414931.
 Lutz Schröder (2001). "Categories: a free tour". In Jürgen Koslowski and Austin Melton (ed.). Categorical Perspectives. Springer Science & Business Media. p. 10. ISBN 9780817641863.
 Neal Koblitz; B. Zilber; Yu. I. Manin (2009). A Course in Mathematical Logic for Mathematicians. Springer Science & Business Media. p. 290. ISBN 9781441906151.
 Francis Borceux (1994). Handbook of Categorical Algebra: Volume 2, Categories and Structures. Cambridge University Press. p. 289. ISBN 9780521441797.
 Marco Grandis (2012). Homological Algebra: The Interplay of Homology with Distributive Lattices and Orthodox Semigroups. World Scientific. p. 55. ISBN 9789814407069.
 Peter Burmeister (1993). "Partial algebras – an introductory survey". In Ivo G. Rosenberg and Gert Sabidussi (eds.). Algebras and Orders. Springer Science & Business Media. ISBN 9780792321439.CS1 maint: uses editors parameter (link)
 Alfred Hoblitzelle Clifford; G. B. Preston (1967). The Algebraic Theory of Semigroups. Volume II. American Mathematical Soc. p. xii. ISBN 9780821802724.
 Peter M. Higgins (1992). Techniques of semigroup theory. Oxford University Press, Incorporated. p. 4. ISBN 9780198535775.
 Olexandr Ganyushkin; Volodymyr Mazorchuk (2008). Classical Finite Transformation Semigroups: An Introduction. Springer Science & Business Media. pp. 16 and 24. ISBN 9781848002814.
 Martin Davis (1958), Computability and Unsolvability, McGraw–Hill Book Company, Inc, New York. Republished by Dover in 1982. ISBN 0486614719.
 Stephen Kleene (1952), Introduction to MetaMathematics, NorthHolland Publishing Company, Amsterdam, Netherlands, 10th printing with corrections added on 7th printing (1974). ISBN 0720421039.
 Harold S. Stone (1972), Introduction to Computer Organization and Data Structures, McGraw–Hill Book Company, New York.