# What is the equality of two functions (or maps)?

Suppose there are two maps $f : A \to B$ and $g : A\to C$ such that $C$ and $B$ can be different sets, but $f(x)=g(x)$ for every $x$ in $A$. Thus, the image of $f$ and $g$ are both contained in the intersection of $B$ and $C$.

Then, can it be said that $f=g$? This seems like a trivial question, but really annoys and confuses me...

Here, the function $F$ is defined as $F : M \to N$ but also regarded as $F : M \to F(M)$ to be a homeomorphism. So it still leaves confusion...

• For two functions to be equal they should have same domain and they should be equal pointwise for every point in the domain. – user250285 Feb 25 '18 at 14:44
• I don't agree with that. You should also require them to have the same codomain. – lush Feb 25 '18 at 14:45
• Answers and comments here say both "yes" and "no" to your question. I think "no" is somewhat more common these days. But the controversy means you should be careful to say exactly what you mean if you're in a situation where the distinction matters. – Ethan Bolker Feb 25 '18 at 14:46

$f: \mathbb{N} \longrightarrow \mathbb{N}$ and $g: \mathbb{N} \longrightarrow \mathbb{N}\cup\lbrace \frac{1}{2} \rbrace$ defined by $f(x) = g(x) = x$ for all $x \in \mathbb{N}$. Note that $f$ is bijective but $g$ isn't.

$f:A \longrightarrow$ B and $g: C \longrightarrow D$ are equals when $A = C$, $B = D$ and $f(x) = g(x)$ for all $x \in A$ (by definition), otherwise, two equal functions may not have the same properties.

When you write $f:X \longrightarrow Y$ and $f: X \longrightarrow f(X)$ you are only considering the image, because the other elements of $Y$ are expendable. Writting in function of the image sometimes is convenient. In fact, they are two different things, for example:

$f: X \longrightarrow Y$ where $Y \subset \mathbb{N}$ and $f$ is injective. To show that $X$ is countable, we use that $f: X \longrightarrow f(X)$ is bijective and $f(X) \subset Y \subset \mathbb{N}$ is countable.

This is a abuse of notation, because $f: X \longrightarrow Y$ and $f: X \longrightarrow f(X)$ are two different things, but we keep the same name (makes the text more clear) because we only discard the elements that don't have any association.

• So, do you agree with lush? For the two maps to be equal, they must have the same domain and codomain? – Keith Feb 25 '18 at 14:49
• @Keith Yes, I agree! – Corrêa Feb 25 '18 at 14:54
• Could you answer me for the additional contents in my question too? How should I understand $F : M \to N$ and $F : M \to F(M)$? – Keith Feb 25 '18 at 15:28
• @Keith, I added to the answer. – Corrêa Feb 25 '18 at 16:57
• I see. So, what you mean seems that it is just an abuse of the notation to make the text more clear or (in my expression) more intuitive to understand. Thank you for your answer. – Keith Feb 25 '18 at 17:17

They are not equal. For two maps to be equal you also require them to have the same domain and codomain.

What you can do for example, is "corestrict" f and g to $B \cap C$. So it is true, that $f|^{B\cap C} = g|^{B \cap C}$.

• Oh, I see....The example of Lucas seems to give an example for your assertion. – Keith Feb 25 '18 at 14:49
• Could you answer me for the additional contents in my question too? How should I understand $F:M \to N$ and $F:M \to F(M)$? – Keith Feb 25 '18 at 15:29
• As others said: You can think of a map as an object that has three "components": A domain A, a codomain B and an assignment $A \to B$ that assigns to every element a of A a unique element b of B. Now usually you don't write explicitely "$1 \mapsto 2$, $2 \mapsto 3$, $3 \mapsto 4$, ... and so forth but instead give a "formular" on how to evaluate a function: $n \mapsto n+1$. But that formular may be "valid" with different domains and codomains used. So to define a well-defined map you need to tell which values it takes and which it will "return" once applied a valid input. – lush Feb 25 '18 at 16:00
• Now given a map $f : A \to B$ it is not always true, that for every $b \in B$ there is some $a \in A$ such that $b = f(a)$. Maps that have this property are called surjective. However, given say $im(f) \subseteq C \subseteq B$ one can define a new function $f|^{C} : A \to C$ which has the same rule of assigning values. So $f|^{C}(a) = f(a)$ for all $a \in A$. (Notice that I used $im(f)$ as a notation for the subset of B consisting of all elements $b \in B$ such that there is some $a \in A$ with $f(a) = b$. – lush Feb 25 '18 at 16:04
• You can do something similar with the domain of a map: If you start with $f : A \to B$ again and take any subset $C \subseteq A$ one can define $f|_{C} : C \to B$ via $C \ni c \mapsto f(c) \in B$ – lush Feb 25 '18 at 16:06

In order for two functions to be equal, their images being the same is not enough, their co-domains also have to be the same.

For example, let $f: \mathbb{Z} \to \mathbb{Z}$ and $g: \mathbb{Z} \to \mathbb{C}$ with $f(x) = x$ and $g(x) = x$. Then notice that $f$ is a bijection while $g$ is not even surjection, hence not a bijection. So even some of the characteristics of functions change when we change the co-domain so we can't say $f= g$.

• But one thing confuses me. Reading textbooks, authors use the same symbol for functions whose codomains are restricted . For example if there is a map $f :A->B$, then the author uses expressions like $f : A -> f(A)$. How should I interpret this? – Keith Feb 25 '18 at 14:56
• According to the majority's opinions here, $f : A -> B$ and $f : A -> f(A)$ are different, but denoted by the same symbol $f$. – Keith Feb 25 '18 at 14:57
• I will go with the same example. For the function $g$ in my example, take $A = \mathbb{Z}$ and $B = \mathbb{C}$. Then we have $g(A) = \mathbb{Z}$ so we can see that $A \to g(A)$ is not as same as $A \to B$ because $B \ne g(A)$ (Notice that I am not denoting them as $g: A \to B$). – ArsenBerk Feb 25 '18 at 14:58
• But it is the fact that most textbooks use the same symbol $f$ for the $f : A \to B$ and $f : A \to f(A)$. – Keith Feb 25 '18 at 15:02
• Well, in general concepts (like not specific concepts as in a question or example), they may not pay attention to names. But I have never seen a function defined recursively as $f: A \to f(A)$ before so I have no idea which books use that notation. All I see is $f: A \to f(A)$ guarantees that $f$ is a surjection, but I don't know why someone would want to guarantee that. – ArsenBerk Feb 25 '18 at 15:05

A function has three parts.

Domain, Codomain, and the assignment of $f:A\to B$.

Thus $f:A\to B$ and $g:C\to D$ are equal iff $A=C$ and $B=D$ and for every $x\in A,$ $f(x)=g(x).$