Can a function be defined as the union of two other functions?

2.1k Views Asked by At

So I read from various sources that a function can be defined as a binary relation. Then is it valid to say, for example, $f = \{ (1, 2), (2, 3) \}$?

And suppose I have another function $g = \{ (4, 5) \}$. Does it then make sense to write $(f \cup g)(2) = 3$?

3

There are 3 best solutions below

1
On BEST ANSWER

In the language of set theory, using the standard representation of function as sets of pairs, you are exactly right. Your $f$ and $g$ are both functions, as is $f \cup g$, and $(f \cup g)(2)=f(2) = 3$.

In general, the union of any two functions $f$ and $g$ is a function provided they agree on the intersection of their domains: i.e., provided that for any $x$, $y$ and $z$, if $(x, y) \in f$ and $(x, z) \in g$, then $y = z$.

9
On

What you're doing is ok only if the functions have disjoint domains (or they happen to be equal on any domain overlap). This is not a very typical situation. In practice, any two functions you might want to combine would instead either have overlapping (possibly identical) domains, or structurally completely different domains.

Example of the former, $$\begin{align} f &: \mathbb{R} \to \mathbb{R}, & f(x) &= x^2 \\ g &: \mathbb{R}\setminus\{0\} \to \mathbb{R}, & g(x) &= \tfrac1x \end{align}$$ then $f\cup g$ is not a function, because it contains e.g. both $(2,4)$ and $(2,\tfrac12)$.

Example of the latter, $$\begin{align} h &: \{0,1,2,3\} \to \mathbb{Q}, & h(x) &= \begin{cases} 1 & \text{for $x=0$} \\\tfrac12 & \text{for $x=1$} \\\tfrac25 & \text{for $x=2$} \\\tfrac37 & \text{for $x=3$} \end{cases} \\ i &: \mathbb{R}^2 \to \mathbb{R}^2, & i(x,y) &= (-y,x) \end{align}$$ In this case $h\cup i$ is a function, but it is a complete oddball with a composite domain that makes it hard to work with and codomain that makes it even harder to do anything useful with.

For these reasons, the operation "union of two functions" isn't really a thing anybody does in practice.

What's far more reasonable is the disjoint union. This is actually the coproduct in the rig category $\mathsf{Set}$. For example, $$\begin{align} f\sqcup g &: \mathbb{R}\sqcup(\mathbb{R}\setminus\{0\}) \to \mathbb{R}\sqcup\mathbb{R} \\ (f\sqcup g)(x,0) &= (f(x),0) = (x^2,0) \\ (f\sqcup g)(x,1) &= (g(x),1) = (\tfrac1x,1) \end{align}$$

0
On

Defining the union of 2 functions in that way is an oversimplification.

Given 2 sets $X$ and $Y$, you can define a function $f:X\to Y$ as a relation $\mathcal{R}$ between $X$ and $Y$ verifying:

$$\forall (x, y, z) \in X\times Y\times Y, x\mathcal{R}y \wedge x\mathcal{R}z \implies y = z$$

But AFAIK, even if a relation between two sets is fully defined by its graph, i.e. the subset of $X\times Y$ consisting of the elements of X related to the elements of Y, I have never seen unions nor intersections of relations.

Furthermore, when you use functions, you must ensure the unicity of the image of any element from the starting set. And the union of the graphs offers no guarantee over that point.

What is common on the other hand is to define a function on subsets: if $X_1 \subset X$ and $X2 \subset X$ and you have 2 functions

$$\begin{aligned}f_1:&X_1\to Y &f_2:&X_2\to Y\\ &x\mapsto f_1(x)&&x\mapsto f_2(x) \end{aligned}$$

you can define: $$\begin{aligned}f:&X_1\cup X_2&\to &Y\\ &x&\mapsto&f(x)\end{aligned}$$

by $f(x) = f_1(x)$ if $x \in X_1$ and $f(x)=f_2(x)$ if $x\in X_2$,

provided $X_1\cap X_2 = \phi$ or at least $\forall x \in X1\cap X_2, f_1(x) = f_2(x)$