# Why do we usually consider domains/codomains instead of preimages/images?

As I understand it, a domain of a function can be any superset of its preimage set (terminology is explained in answers to this question). For example, a function $f: \mathbb R \rightarrow \mathbb R, f(x) = x^2$ may be described as any of the following:

• $f: \mathbb C \rightarrow \mathbb C$ (as $\mathbb R$ can be considered a subfield of $\mathbb C$)
• $f: U \rightarrow U$ ($f$ is a function in a given universe)
• As a function in any other superset of $\mathbb R$

However, if we talk about preimages and images, there is only one way to precisely describe these sets: $$f: \mathbb R \rightarrow \mathbb R_{>=0}$$ $$f(x) = x^2$$

Is it correct that we consider domains/codomains only when the properties of these algebras are more important than the properties of preimage/image algebras? But I almost never see the functions described in terms of their preimages/images, as in my example, and clearly the properties of $\mathbb R_{>=0}$ are not the same with field $\mathbb R$ (e.g. $\mathbb R_{>=0}$ is not closed under subtraction).

• The domain and codomain are datum that are part of a function's definition. The functions $f:\mathbb{R} \to \mathbb{R}$ and $f:\mathbb{C} \to \mathbb{C}$ you described are different functions. It's not clear what you mean by $f(x) = x^2$ being defined on a "universe" or superset of $\mathbb{R}$. Finally, what do you mean by "the" preimage of a function? A function has as many preimages as there are subsets in its codomain. – Alex Provost Aug 13 '16 at 12:38
• The domain of a function is a subset (not superset) of the preimage of the range of the function. What do you mean by "precisely describe these sets"? (The preimage depends on the subset of the codomain of which you are taking the preimage, while the image depends on the subset of the domain of which you are taking the image.) There are many different functions you could define with the formula $x^2$. The function you have defined $f:\mathbb{R}\to\mathbb{R}^+$ is not one-to-one and so has no inverse. We might wish to instead have the one-to-one function $g:\mathbb{R}^+\to\mathbb{R}^+$. – smcc Aug 13 '16 at 12:39
• @AlexProvost By "the preimage" I mean the set of all values for which the function is defined; by "the image" a mean the set of all values that are actually mapped onto. I think $f : \mathbb R \rightarrow \mathbb R$ and $f : \mathbb C \rightarrow \mathbb C$ can be considered equivalent if $f$ only maps from and to $\mathbb C$ with imaginary part $= 0$. – interphx Aug 13 '16 at 12:43
• The domain of a function is unique; the real function $x^2$ cannot automatically be considered as a function with domain $\Bbb{C}$, although it can be considered to have codomain $\Bbb{C}$. – florence Aug 13 '16 at 12:44
• @smcc What I am asking about is why we often write $f : \mathbb R \rightarrow \mathbb R$ when we can write more precisely $\mathbb R \rightarrow \mathbb R^+$ (considering \$f(x) = x^2. Also, if I understand correctly, the image set of a function is the set of all values for which a function is defined, and thus by definition cannot be a superset of domain (otherwise the function could be defined for valus outside its domain). – interphx Aug 13 '16 at 12:48