What are well-defined functions? [duplicate]

Let's consider the rational numbers, which I expect you are familiar with. A rational number is usually represented as a pair of integers, written in the form $$\frac ab$$ where $b$ is not zero. But this is only a representation, and it's not unique, because many such pairs represent the same rational number. For example, $\frac12, \frac24, $ and $\frac{10}{20}$ all represent the same rational number. The general rule is that $\frac ab$ and $\frac cd$ represent the same rational number if $ad = bc$; you can check this condition with the examples I just gave and see that it does hold for those examples.

Now let's say we would like to define a function on rational numbers. How can we do that? All we have to work with is the representation $\frac ab$, so we have to define $f$ in terms of $a$ and $b$.

Consider the definition that says $f\left(\frac ab\right) = a+b$. There is a serious problem with this definition: it is not a well-defined function of rational numbers, because it says at once that $f\left(\frac 12\right) = 3, $ that $f\left(\frac 24\right)=6$, and that $f\left(\frac {10}{20}\right) = 30$ But $\frac12, \frac24, $ and $\frac{10}{20}$ are the same rational number, and so we seem to have said that $f$ has several different values at this one rational number. This is not a well-defined function because it depends not on the argument itself, but on how we happened to choose to write it.

In contrast, if we define $g\left(\frac ab\right) $ to be $${a+\gcd(a,b)\over b+\gcd(a,b)},$$ we find that $g\left(\frac 12\right) = \frac23, g\left(\frac 24\right) = \frac46=\frac23,$ and $g\left(\frac{10}{20}\right)=\frac{20}{30}=\frac23$, and indeed, one can show that for any $a$ and $b$ with $\frac ab=\frac 12$, we always have $g\left(\frac ab\right) = \frac23$. And we can also show that $g\left(\frac ab\right)$ depends only on the rational value of $\frac ab$, not not the particular $a$ and $b$ that are chosen to represent it. This is a well-defined function of rational numbers.

The issue here is that we don't have a direct definition of rational numbers; instead, we define them as classes of pairs of integers $a$ and $b$. If we want to define a function of a rational number, in terms of the pair of integers that represents it, our definition must give the same value for any equivalent pair of integers $a$ and $b$—for any pair in the same class of pairs. Otherwise it may be a perfectly good function of pairs of integers, but it is not a function of rational numbers.

The same issue arises whenever we define anything in terms of equivalence classes. Your question is tagged abstract-algebra, so I'll give the most important example from abstract algebra. If $\langle G, \ast \rangle$ is a group and $H$ a subgroup of $G$, we can construct the classes $gH$ of left cosets of $H$. Then we would like to define an operation $h(aH, bH)$ on these cosets; typically that $h(aH, bH) = (a\ast b)H$.

But notice that this depends on choosing representatives $a$ and $b$ from the cosets $aH$ and $bH$. For we might have $aH = a'H$ and $bH=b'H$ even when $a\ne a'$ and $b\ne b'$. In such a case, we had better have $(a\ast b)H = (a'\ast b')H$, or else our definition of $h(aH, bH)$ won't make sense, in the same way that $f$ doesn't make sense: it gives us more than one possible value for a particular choice of arguments.

It transpires that such definitions make sense exactly when $H$ is a normal subgroup of $G$, and this is the reason for the importance of normal subgroups.


A function $f:A\to B$ is, by (the ordinary) definition, a relation $f\subseteq A\times B$ with two properties:

  1. For all $a\in A$, there exists a $b\in B$ such that $f(a)=b$
  2. For all $a,a'\in A$, if $a=a'$, then $f(a)=f(a')$.

The second axiom is what makes a function "well-defined." There is no proof needed to show that "functions are well-defined," (they are well-defined by definition!) BUT quite often we have a rule we invented making a relation, and we need to prove "this relation has properties 1 and 2, so it is a well-defined function."

When defining a function on the set of equivalence classes $E$ from an equivalence relation on a set $X$, it is natural to define functions only in terms of elements of $X$ and then ask if they are still functions on $E$. This isn't automatic, however, and my favorite example showing why it's not automatic has already been given by MJD above.

Quite simply, one can't just assume every relation we come up with in terms of $X$ makes a function on equivalence classes of an equivalence on $X$.


Given an equivalence relation on a set $A$ and function $f:A \rightarrow B$, saying that $f$ is well-defined, means that $f^{\sim} : A/ \sim \rightarrow B$, $f^{\sim}([x])=f(x)$, define a function.This happen if, $ x\sim y$ imply $f(x)=f(y)$ ($f$ pass to the quotient).

Condsider this situation: Let $f:A \rightarrow B$, where $A=\{1,2,3,4\}$ and $B=\{1,2\}$,with $f(1)=2$,$f(2)=1$,$f(3)=1$, $f(4)=1$.Now, consider the partition of $A$, given by: $A_{1}=\{1,2\}$, $A_{2}=\{3,4\}$. Define an equivalence relation as: $x\sim y$ iff they belong to the same $A_{i}$, with $i=1,2$. Consider the quotient set $A/ \sim$; now, in this situation, we can say that $f$ is not well-defined (On the quotient set), because $f(1)\neq f(2)$, so putting $f^{\sim}([x])=f(x)$ does not define a function. Otherwise, if i consider the partition $A_{1}=\{1\}$, $A_{2}=\{2,3,4\}$,them putting $f^{\sim}([x])=f(x)$ define a function.

I hope it is clear!


In mathematics many time we define functions by giving the properties that these functions should satisfy (you can think of it as a sort of axiomatic definition).

For such kind of definition to be good does mean that these definition does actually define a function: defining an object as the function such that $P(f)$ holds doesn't actually define $f$ unless we prove that such $f$ exists and it's unique.

Examples of definition of this sort are the following:

  • the determinant is function $\det \colon \mathcal M_n(\mathbb K) \to \mathbb K$ which is multilinear and alternating in the columns and with $\det I_n = 1$;
  • for every pair $a,b \in \mathbb Z$ the sum of the residue classes $[a]$ and $[b]$ in $\mathbb Z/n \mathbb Z$ is given by $[a]+[b]=[a+b]$;
  • ...

In all these example we have defined these functions by saying which properties they should satisfy, but if there wasn't any function satisfying such properties these definition wouldn't be good, because they would be defining nothing.

Hope this helps clarifying.