In mathematics, the domain or set of departure of a function is the set into which all of the input of the function is constrained to fall. It is the set in the notation , and is alternatively denoted as $\backslash operatorname(f)$. Since a (total) function is defined on its entire domain, its domain coincides with its domain of definition. However, this coincidence is no longer true for a partial function, since the domain of definition of a partial function can be a proper subset of the domain.
A domain is part of a function if is defined as a triple , where is called the ''domain'' of , its ''codomain'', and its ''graph''.
A domain is not part of a function if is defined as just a graph. For example, it is sometimes convenient in set theory to permit the domain of a function to be a proper class , in which case there is formally no such thing as a triple . With such a definition, functions do not have a domain, although some authors still use it informally after introducing a function in the form .
For instance, the domain of cosine is the set of all real numbers, while the domain of the square root consists only of numbers greater than or equal to 0 (ignoring complex numbers in both cases).
If the domain of a function is a subset of the real numbers and the function is represented in a Cartesian coordinate system, then the domain is represented on the ''x''-axis.

** Examples **

A well-defined function must map every element of its domain to an element of its codomain. For example, the function $f$ defined by
: $f(x)=\backslash frac$
has no value for $f(0)$. Thus the set of all real numbers, $\backslash mathbb$, cannot be its domain. In cases like this, the function is either defined on $\backslash mathbb\; \backslash setminus\; \backslash $, or the "gap is plugged" by defining $f(0)$ explicitly.
For example. if one extends the definition of $f$ to the piecewise function
: $f(x)\; =\; \backslash begin\; 1/x\&x\backslash not=0\backslash \backslash \; 0\&x=0\; \backslash end$
then ''$f$'' is defined for all real numbers, and its domain is $\backslash mathbb$.
Any function can be restricted to a subset of its domain. The restriction of $g\; \backslash colon\; A\; \backslash to\; B$ to $S$, where $S\; \backslash subseteq\; A$, is written as $\backslash left.\; g\; \backslash right|\_\; \backslash colon\; S\; \backslash to\; B$.

** Natural domain **

The natural domain of a function (sometimes shortened as domain) is the maximum set of values for which the function is defined, typically within the reals but sometimes among the integers or complex numbers as well. For instance, the natural domain of square root is the non-negative reals when considered as a real number function. When considering a natural domain, the set of possible values of the function is typically called its range.

** Category theory **

Category theory deals with morphisms instead of functions. Morphisms are arrows from one object to another. The domain of any morphism is the object from which an arrow starts. In this context, many set theoretic ideas about domains must be abandonedâ€”or at least formulated more abstractly. For example, the notion of restricting a morphism to a subset of its domain must be modified. For more, see subobject.

** Other uses **

The word "domain" is used with other related meanings in some areas of mathematics. In topology, a domain is a connected open set. In real and complex analysis, a domain is an open connected subset of a real or complex vector space. In the study of partial differential equations, a domain is the open connected subset of the Euclidean space $\backslash mathbb^$ where a problem is posed (i.e., where the unknown function(s) are defined).

** More common examples **

As a partial function from the real numbers to the real numbers, the function $x\backslash mapsto\; \backslash sqrt$ has domain $x\; \backslash geq\; 0$. However, if one defines the square root of a negative number ''x'' as the complex number ''z'' with positive imaginary part such that ''z''^{2} = ''x'', then the function $x\backslash mapsto\; \backslash sqrt$ has the entire real line as its domain (but now with a larger codomain).
The domain of the trigonometric function $\backslash tan\; x\; =\; \backslash tfrac$ is the set of all (real or complex) numbers, that are not of the form $\backslash tfrac\; +\; k\; \backslash pi,\; k\; =\; 0,\; \backslash pm\; 1,\; \backslash pm\; 2,\; \backslash ldots$.

** See also **

* Attribute domain
* Bijection, injection and surjection
* Codomain
* Domain decomposition
* Effective domain
* Image (mathematics)
* Lipschitz domain
* Naive set theory
* Support (mathematics)

** Notes **

** References **

*
{{Mathematical logic
Category:Functions and mappings
Category:Basic concepts in set theory