# What are well-defined functions?

What exactly makes a function well-defined? I have seen some proofs but they are too hand-wavy and I couldn't understand exactly what a well-defined function is.

-
Usually we say that a function defined on a set of equivalence classes is well-defined if the value of the function is independent of the choice of an element in the class. – Amateur May 5 '14 at 13:00
I am not sure if I understand. If the value is independent of the element, by which the image is independent of the pre-image, then wouldn't it counter the definition of a function? Or do you mean value as in the codomain? – Artemisia May 5 '14 at 13:05
Useful: Why aren't all functions well-defined? by Tim Gowers. – MJD May 5 '14 at 13:06
Technically, "well-defined function" is a redundant phrase. If the rule you set up isn't well-defined, it's saying that your rule doesn't make a function at all. So there isn't really such a thing as a "not well defined function" unless you are using a very relaxed definition of what a function is. – rschwieb May 5 '14 at 14:37
@rschwieb ah yes I think that is what tripped me up in the first place. – Artemisia May 5 '14 at 14:38

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 the smallest integer $n$ with $a\le nb$, we find that $g\left(\frac 12\right) = 1, g\left(\frac 24\right) = 1,$ and $g\left(\frac{10}{20}\right)=1$, and indeed, one can show that for any $a$ and $b$ with $\frac ab=\frac 12$, we always have $g\left(\frac ab\right) = 1$. 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. (The $g$ function is simply the result of rounding $\frac ab$ up to the nearest integer.) 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 , 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.

-
This is a fantastic answer. Thank you so much :) – Artemisia May 5 '14 at 14:35
I'm glad I could help. – MJD May 5 '14 at 14:40
What happens "exactly when $H$ is normal"? Normality isn't required to be able to define functions of cosets! Normality is only required when you want to define the group operation on cosets, and you weren't talking about that particular function in your answer. – Dan Shved May 5 '14 at 14:54
Thanks! I was just coming back to correct that. – MJD May 5 '14 at 14:55
To be somewhat nitpicky, $g(-1/-2)=?$ – ronno May 5 '14 at 16:14

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$.

-
Oh ok I understand now. The proofs I saw made me feel like it is too trivial but now I understand :) Thank you so much :) – Artemisia May 5 '14 at 14:37
@Artemisia Several times I've had a student try to reason "suppose $a=a'$. Then $f(a)=f(a')$, right? it's the same input! How could it be different?" For students like this, who have a very strong sense of what a function is and essentially have forgotten that they haven't checked $f$ yet, they sometimes don't realize this isn't always true, depending on the rule you set up :) the "fraction" example MJD gave usually cures the problem. – rschwieb May 5 '14 at 14:40
Haha yeah I understood that now :) I had that sort of idea about functions which is what tripped me up in the first place :) Thank you :) – Artemisia May 5 '14 at 14:53

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.

-
Thank you so much :) I wish I could accept all answers haha since each one has its own merits. – Artemisia May 5 '14 at 14:36

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!

-
Yes it is. Finally haha. Thank you so much :) – Artemisia May 5 '14 at 14:37