The meaning of a well-defined function

In this article, we are going to understand the meaning of a well-defined function in Mathematics.  First we describe what makes a function well-defined and give examples of functions that are well-defined and mappings that are not well-defined. Finally we describe the instances when to check that the function is actually well-defined.

Definition of Well-Defined Function

A mapping is well-defined when given any element of the domain, it is mapped to the same element in the codomain irrespective of its representation.

For example consider a well-defined function f which maps 0.75 into 2 (i.e. f(0.75)=2). Since the function is well-defined then f(75%)= 2 and f(\frac{3}{4})=2 and f(\frac{6}{8})=2. This is because since the function is well-defined, and 75%,\frac{3}{4},\frac{6}{8} are different representations for 0.75, they must all be mapped into the same element 2

On the other hand, if we have a mapping g which maps 0.75 into 4 (i.e. g(0.75)=4) and 75% into 6 (i.e. g(75\%)=6), then g is not well-defined because 0.75 and 75% are different representations of the same element but are mapped into distinct elements, namely, 4 and 6.

Is a function always well-defined?

Yes, a function is always well-defined. Hence a mapping must be well-defined in order for it to be a function.

In fact consider the mapping g with g(0.75)=4) and g(75\%)=6 results into a one-to-many mapping which is not a function.

So, strictly speaking, we cannot write or say “a function is not well-defined” because the mapping is not a function in the first place if it is not well-defined! Similarly it does not make complete sense to write “a function is well-defined”, because a function is always well-defined!

An example of a mapping that is not well-defined

Let h: \mathbb{Q}\rightarrow\mathbb{Z} such that g(\frac{m}{n})=n. This mean that the function takes a fraction as its input and output its denominator. Note \mathbb{Q} denotes the set of all real numbers that can be expressed as a fraction, and \mathbb{Z} denotes the set of all integers (i.e. real numbers).

In particular, we have h(\frac{3}{4})=4 and h(\frac{6}{8})=8. Since \frac{3}{4} and \frac{6}{8} are different representations of the same number and are mapped to a distinct element, then h is not well-defined.

When to check whether a mapping is well-defined

One must check for well-definition in a mapping, that possibly could also be a function, when there are different representations of some (or all) elements in the domain.

For example in number theory and set theory, 3\mathbb{Z}+2 is the set obtained by taking any integer multiply it by 3 and adding 2. It results that 3\mathbb{Z}+2=\lbrace \cdots ,-7,-4,-1,2,5,8,\cdots\rbrace.

Similarly the set 3\mathbb{Z}+5 is obtained by taking any integer multiply it by 3 and adding 5. It results
that 3\mathbb{Z}+5=\lbrace \cdots ,-7,-4,-1,2,5,8,\cdots\rbrace, which is in fact the same as 3\mathbb{Z}+2.

It follows that:

3\mathbb{Z}+0=\lbrace \cdots,-6,-3,0,3,6,\cdots\rbrace=3\mathbb{Z}+3=3\mathbb{Z}+6=\cdots

3\mathbb{Z}+1=\lbrace \cdots,-5,-2,1,4,7,\cdots\rbrace=3\mathbb{Z}+4=3\mathbb{Z}+7=\cdots

3\mathbb{Z}+2=\lbrace \cdots,-7,-4,-1,2,5,8,\cdots\rbrace=3\mathbb{Z}+5=3\mathbb{Z}+8=\cdots

Let k be a mapping defined by k(3\mathbb{Z}+m)= m for all m\in \mathbb{Z}. Here since the elements of the domain (which are sets themselves) have different representations, it makes sense to check about the well-definition property.

In this case, since k(3\mathbb{Z}+1)= 1 and k(3\mathbb{Z}+4)= 1, and 3\mathbb{Z}+1=3\mathbb{Z}+4, then k is not well-defined.