Partial function
In mathematics, a partial function f from a set X to a set Y is a function from a subset S of X (possibly X itself) to Y. The subset S, that is, the domain of f viewed as a function, is called the domain of definition of f. If S equals X, that is, if f is defined on every element in X, then f is said to be total.
More technically, a partial function is a binary relation over two sets that associates every element of the first set to at most one element of the second set; it is thus a functional binary relation. It generalizes the concept of a (total) function by not requiring every element of the first set to be associated to exactly one element of the second set.
A partial function is often used when its exact domain of definition is not known or difficult to specify. This is the case in calculus, where, for example, the quotient of two functions is a partial function whose domain of definition cannot contain the zeros of the denominator. For this reason, in calculus, and more generally in mathematical analysis, a partial function is generally called simply a function. In computability theory, a general recursive function is a partial function from the integers to the integers; for many of them no algorithm can exist for deciding whether they are in fact total.
When arrow notation is used for functions, a partial function [math]\displaystyle{ f }[/math] from [math]\displaystyle{ X }[/math] to [math]\displaystyle{ Y }[/math] is sometimes written as [math]\displaystyle{ f : X \rightharpoonup Y, }[/math] [math]\displaystyle{ f : X \nrightarrow Y, }[/math] or [math]\displaystyle{ f : X \hookrightarrow Y. }[/math] However, there is no general convention, and the latter notation is more commonly used for inclusion maps or embeddings.
Specifically, for a partial function [math]\displaystyle{ f : X \rightharpoonup Y, }[/math] and any [math]\displaystyle{ x \in X, }[/math] one has either:
 [math]\displaystyle{ f(x) = y \in Y }[/math] (it is a single element in Y), or
 [math]\displaystyle{ f(x) }[/math] is undefined.
For example, if [math]\displaystyle{ f }[/math] is the square root function restricted to the integers
 [math]\displaystyle{ f : \Z \to \N, }[/math] defined by:
 [math]\displaystyle{ f(n) = m }[/math] if, and only if, [math]\displaystyle{ m^2 = n, }[/math] [math]\displaystyle{ m \in \N, n \in \Z, }[/math]
then [math]\displaystyle{ f(n) }[/math] is only defined if [math]\displaystyle{ n }[/math] is a perfect square (that is, [math]\displaystyle{ 0, 1, 4, 9, 16, \ldots }[/math]). So [math]\displaystyle{ f(25) = 5 }[/math] but [math]\displaystyle{ f(26) }[/math] is undefined.
Basic concepts
A partial function arises from the consideration of maps between two sets X and Y that may not be defined on the entire set X. A common example is the square root operation on the real numbers [math]\displaystyle{ \mathbb{R} }[/math]: because negative real numbers do not have real square roots, the operation can be viewed as a partial function from [math]\displaystyle{ \mathbb{R} }[/math] to [math]\displaystyle{ \mathbb{R}. }[/math] The domain of definition of a partial function is the subset S of X on which the partial function is defined; in this case, the partial function may also be viewed as a function from S to Y. In the example of the square root operation, the set S consists of the nonnegative real numbers [math]\displaystyle{ [0, +\infty). }[/math]
The notion of partial function is particularly convenient when the exact domain of definition is unknown or even unknowable. For a computerscience example of the latter, see Halting problem.
In case the domain of definition S is equal to the whole set X, the partial function is said to be total. Thus, total partial functions from X to Y coincide with functions from X to Y.
Many properties of functions can be extended in an appropriate sense of partial functions. A partial function is said to be injective, surjective, or bijective when the function given by the restriction of the partial function to its domain of definition is injective, surjective, bijective respectively.
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 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 [math]\displaystyle{ f : A \rightharpoonup B, }[/math] where both [math]\displaystyle{ A }[/math] and [math]\displaystyle{ B }[/math] are subsets of some set [math]\displaystyle{ X. }[/math]^{[1]}
Function spaces
The set of all partial functions [math]\displaystyle{ f : X \rightharpoonup Y }[/math] from a set [math]\displaystyle{ X }[/math] to a set [math]\displaystyle{ Y, }[/math] denoted by [math]\displaystyle{ [X \rightharpoonup Y], }[/math] is the union of all functions defined on subsets of [math]\displaystyle{ X }[/math] with same codomain [math]\displaystyle{ Y }[/math]:
 [math]\displaystyle{ [X \rightharpoonup Y] = \bigcup_{D \subseteq{X}} [D \to Y], }[/math]
the latter also written as [math]\displaystyle{ \bigcup_{D\subseteq{X}} Y^D. }[/math] In finite case, its cardinality is
 [math]\displaystyle{ [X \rightharpoonup Y] = (Y + 1)^{X}, }[/math]
because any partial function can be extended to a function by any fixed value [math]\displaystyle{ c }[/math] not contained in [math]\displaystyle{ Y, }[/math] so that the codomain is [math]\displaystyle{ Y \cup \{ c \}, }[/math] 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 function since the element 1 in the lefthand set is not associated with anything in the righthand set. Whereas, the second diagram represents a 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 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 function.
Subtraction of natural numbers
Subtraction of natural numbers (nonnegative integers) can be viewed as a partial function:
 [math]\displaystyle{ f : \N \times \N \rightharpoonup \N }[/math]
 [math]\displaystyle{ f(x,y) = x  y. }[/math]
It is defined only when [math]\displaystyle{ x \geq y. }[/math]
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 domain of definition of the function.
In category theory
In category theory, when considering the operation of morphism composition in concrete categories, the composition operation [math]\displaystyle{ \circ \;:\; \hom(C) \times \hom(C) \to \hom(C) }[/math] is a function if and only if [math]\displaystyle{ \operatorname{ob}(C) }[/math] has one element. The reason for this is that two morphisms [math]\displaystyle{ f : X \to Y }[/math] and [math]\displaystyle{ g : U \to V }[/math] can only be composed as [math]\displaystyle{ g \circ f }[/math] if [math]\displaystyle{ Y = U, }[/math] that is, the codomain of [math]\displaystyle{ f }[/math] must equal the domain of [math]\displaystyle{ g. }[/math]
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, [math]\displaystyle{ X, }[/math] forms a regular semigroup called the semigroup of all partial transformations (or the partial transformation semigroup on [math]\displaystyle{ X }[/math]), typically denoted by [math]\displaystyle{ \mathcal{PT}_X. }[/math]^{[7]}^{[8]}^{[9]} The set of all partial bijections on [math]\displaystyle{ X }[/math] 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 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 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
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  
 Analytic continuation – Extension of the domain of an analytic function (mathematics)
 Multivalued function – Generalization of a function that may produce several outputs for each input
 Densely defined operator – Function that is defined almost everywhere (mathematics)
References
 ↑ ^{1.0} ^{1.1} Christopher Hollings (2014). Mathematics across the Iron Curtain: A History of the Algebraic Theory of Semigroups. American Mathematical Society. p. 251. ISBN 9781470414931. https://books.google.com/books?id=O9wJBAAAQBAJ&pg=PA251.
 ↑ Lutz Schröder (2001). "Categories: a free tour". in Jürgen Koslowski and Austin Melton. 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. https://books.google.com/books?id=5i2v9q0m5XAC&pg=PA289.
 ↑ Marco Grandis (2012). Homological Algebra: The Interplay of Homology with Distributive Lattices and Orthodox Semigroups. World Scientific. p. 55. ISBN 9789814407069. https://books.google.com/books?id=TWqhelao4KsC&pg=PA55.
 ↑ Peter Burmeister (1993). "Partial algebras – an introductory survey". Algebras and Orders. Springer Science & Business Media. ISBN 9780792321439.
 ↑ ^{7.0} ^{7.1} Alfred Hoblitzelle Clifford; G. B. Preston (1967). The Algebraic Theory of Semigroups. Volume II. American Mathematical Soc.. p. xii. ISBN 9780821802724. https://books.google.com/books?id=756KAwAAQBAJ&pg=PR12.
 ↑ ^{8.0} ^{8.1} 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. https://archive.org/details/classicalfinitet00gany_719.
 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.
Original source: https://en.wikipedia.org/wiki/Partial function.
Read more 