# What's the difference between "relation", "mapping", and "function"?

I think that a mapping and function are the same; there's only a difference between a mapping and relation. But I'm confused. What's the difference between a relation and a mapping and a function?

• I think you're right. I don't know any difference between mapping and function. Jan 14, 2019 at 10:28
• This depends on the text. Sometimes a mapping is a continuous function, sometimes it's any function at all. Jan 14, 2019 at 11:37
• @MarkS.: often, the books that assume that mappings are continuous mention it somewhere near the beginner, but it is easy to miss. Jan 14, 2019 at 15:53
• Analysts often consider "function" to specifically refer to a mapping into either $\Bbb R$ or $\Bbb C$ (depending on whether one is doing real or complex analysis). However for most everybody else, "function" and "mapping" are synonomous. Jan 14, 2019 at 20:58
• You can think of a relation as a function from pairs of values to 0, if the relation does not hold, and 1 if it does hold; does that help clarify things? Jan 14, 2019 at 21:17

Mathematically speaking, a mapping and a function are the same. We called the relation $$f=\{(x,y)\in X\times Y : \text{For all x there exists a unique y such that (x,y)\in f} \}$$ a function from $$X$$ to $$Y$$, denoted by $$f:X\to Y$$. A mapping is just another word for a function, i.e. a relation that pairs exactly one element of $$Y$$ to each element of $$X$$.

In practice, sometime one word is preferred over another, depending on the context.

The word mapping is usually used when we want to view $$f:X\to Y$$ as a transformation of one object to another. For instance, a linear mapping $$T:V \to W$$ signifies that we want to view $$T$$ as a transformation of $$v\in V$$ to the vector $$Tv\in W$$. Another example is a conformal map, which transforms a domain in $$\Bbb C$$ to another domain.

The word function is used more often and in various contexts. For example, when we want to view $$f:X\to Y$$ as a graph in $$X\times Y$$.

• It looks like you're defining a set $f$ in terms of itself; I don't think that this is what you intended. (I agree, though, that "mapping" is synonymous with "function".) Jan 14, 2019 at 17:49
• @mathmandan It's just my lazy way of writing "For any $(x,y_1)$ and $(x,y_2)$ in $f$ we must have $y_1=y_2$". Strictly speaking, writing the condition like that is probably not the best way but it can be made rigorous if one wants. Jan 14, 2019 at 17:54
• Yes...I guess I am saying that I would prefer the sentence you just wrote in your comment, to the "set-builder" notation that appears at the beginning of your answer. (Along with another condition, which is that every $x\in X$ must appear in a pair $(x,y)\in f$. This is the "left-total" part of Wuestenfux's answer.) Jan 14, 2019 at 18:03
• I didn't try to be precise with the set theoretic notations, sorry for that. Jan 14, 2019 at 18:06

There is basically no difference between mapping and function. In algebra, one uses the notion of operation which is the same as mapping or function. The notion of relation is more general. Functions are specific relations (those which are left-total and right-unique).

In Mathspeak:

The words 'function' and 'mapping' are synonymous in most contexts. Formally, the definition of a function $$f$$ requires that for each value $$x$$ in the domain, there exists one and only one value $$y$$ in the codomain such that $$y=f(x)$$*.

A relation is any assignment of values in one set to values in another, regardless of whether or not the assignment is unique. For example, if $$(X,Y,R)$$ is the relation from a domain $$X\subseteq\mathbb{R}$$ to a range $$Y\subseteq\mathbb{R}$$ such that $$xRy\iff x=y^2$$, then the set of all points $$\left\{(x,y)\in\mathbb{R}^2\mid x=y^2\right\}$$ is a relation, but not a function, because there are two values $$y\in Y$$ such that $$y^2=x$$ for each $$x\in X$$.

It is worth pointing out that while every function is a relation, not every relation is a function. As stated by Wuestenfux, a function is the special case of a relation which is both left-total and right-unique.

In English:

A function is a relation where each input corresponds to a single output. A relation with more than one output for each input is still a relation, but it is not a funciton. For example, $$y=\pm\sqrt{x}$$ is a relation, because it relates $$x$$ to $$y$$, but not a function, because there are two values ($$\sqrt{x}$$ and $$-\sqrt{x}$$) for each input $$x$$.

I believe that what user2662833 is trying to say is that while not every relation is a function, a relation over $$n$$ variables which is not a function, contains the inputs to a function of $$n$$ variables for which that function is constant. In the example given the points $$(x,y)$$ specified by the equation $$x^2+y^2=4$$ are the points for which $$f(x,y)=x^2+y^2-4$$ is $$0$$, and $$g(x,y)=x^2+y^2$$ is 4.

With an additional restriction, this could be restated as "every relation of $$n$$ variables contains all zeros of a function of $$n$$ variables". This should still be the case outside the real numbers.

*In complex analysis, specifically, this is not always required as some authors prefer to regard certain complex 'multivalued functions' as functions.

• Yes, this is what I meant of course :P I thought it would be useful to give the op some intuition about what the differences are. Precision was not my intent. Jan 16, 2019 at 3:35
• Please don't relate (...) Mathspeak to Newspeak. It would scare even more people away from our beloved field. May 14, 2023 at 10:49

Good question. I can give you a simple example.

You can generally think of relations as functions in a higher dimensional space, intersected with a zero plane.

So for example, lets take a parabola and a circle to demonstrate this. Imagine the parabola

$$f(x) = x^2 + 3x$$

This is clearly a function of x, because if you give me an x value, I can give you the corresponding value of f(x) - a mapping is really just another name for a function. If we want to graph it, we can let the y value equal the output of $$f$$, so we would get this graph:

On the other hand, if we graph a circle, like:

$$x^2+y^2=4$$

Its graph is given by:

Now this is fundamentally different to the function. If you wanted the y value at x = 0, I can't point to a unique value, I'd have to say y = 2 or y = -2. A function can only have one output. So we have to call this a relation.

# Higher Dimensions

However, we can use a clever trick for this circle. We can rewrite it as:

$$x^2 + y^2 - 4 = 0$$

Which is obviously the same thing, but on the left hand side, notice that we now have a function of (x,y), so we can think of this like:

$$g(x, y) = 0$$

In a higher dimension, this would be the intersection between the shapes:

$$z = g(x, y)$$

and

$$z = 0$$

Which I've shown below:

Notice that same circle hiding in plain sight.

Key takeaway (tl;dr)

Relations are functions in a higher dimension, intersected with a zero plane in the higher dimension.

# (Edit) More Precisely

I agree that I could have been more precise with the things I've written above. So hopefully I can be more clear by what I meant here. The usual definition is:

A relation is a pairing between elements of two sets, which are not necessarily unique. A function forces each member of the domain to have only one "partner" in the output set (or codomain).

So for example, here are two example sets. On the left we have a relation that is a function, and on the right we have a relation that is not a function.

However, under a particular circumstance (that I will discuss below), we can actually turn that relation into a function. First, we can take the cartesian product between the two sets X and Y on the right portion of the image above as shown, this will produce every possible pair of tuples (x, y):

Now under the assumption that there exists another function to map these tuples to another set z, (which is the role of z = g(x, y) and z = 0 = 0(x, y) (using zero as a function name), the relation can be viewed as a function that maps all of these tuples into the same point as I've shown below:

Now of course, the reason I bothered to subtract everything to have zero on the other side, was so that the element on the output set that I was mapping to was 0 in the set of real numbers.

However, I am assuming that there exists a function $$g(x, y)$$, to map from $$X \times Y$$ to $$Z$$, which at least for a function of real numbers to real numbers; should always be true.