# Domain of a function

A domain is part of a function f if f is defined as a triple (X, Y, G), where X is called the domain of f, Y its codomain, and G its graph.[4]

A domain is not part of a function f if f is defined as just a graph.[5][6] For example, it is sometimes convenient in set theory to permit the domain of a function to be a proper class X, in which case there is formally no such thing as a triple (X, Y, G). With such a definition, functions do not have a domain, although some authors still use it informally after introducing a function in the form f: X â†’ Y.[7]

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.

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.