7
$\begingroup$

One of my books say that two functions (say $f$ and $g$) are equal when they satisfy these two conditions..

  1. $\text{dom}(f)=\text{dom}(g)$
  2. $f(x)=g(x)$ for every $x$ in their common domain.

While the other book adds one more clause to these..

  1. $\text{codom}(f)=\text{codom}(g)$

Which one is correct? Does co-domain have any role in deciding whether two functions are equal or not?

$\endgroup$
1

4 Answers 4

10
$\begingroup$

This is purely a matter of details within the definition. In other words, it is a matter of choosing how to define what being "equal function" means. As there is no one universal definition, we just have to respect the two different definitions from the two different books.

According to the second definition, the function $f_1 : \{0,1\} \to \{0,1\}$ defined by $f_1(x) = x^2$ is different from the function $f_2 : \{0,1\} \to \{0,1,-1\}$ defined by $f_2(x) = x^2$. They effectively are the same function, but just not mathematically, definition-wise (according to the second definition).

$\endgroup$
4
  • $\begingroup$ In your example f1:{0,1}→{0,1} defined by f1(x)=x^2 is an onto function while the function f2:{0,1}→{0,1,−1} defined by f2(x)=x^2 is an into function now if the co-domain can decide whether a function is onto or into then why does it have no role in determining whether 2 functions are is equal or not ? $\endgroup$
    – ca_100
    Commented Jun 23 at 12:24
  • 2
    $\begingroup$ Being "onto" is again something that pertains to the mathematical definitions, and is not a part of what I decided the call "effectively". Any onto function's domain can be extended by 1 element and the onto condition can be perturbed. $\endgroup$
    – Euclid
    Commented Jun 23 at 12:46
  • $\begingroup$ Plus, the property onto is of significance mostly when the codomain is a larger set. For example, when $f : \mathbb R \to \mathbb R$, one would be interested in whether the range of $f$ spans all of $\mathbb R$. $\endgroup$
    – Euclid
    Commented Jun 23 at 12:48
  • $\begingroup$ @ca_100 If two functions can be the same with different codomains, then every function is onto, in the sense that $f: X \to Y$ and $f: X \to f(X)$ are the same function, and the latter is trivially onto. So, it's not really an interesting property in this context. $\endgroup$
    – Alex Jones
    Commented Jun 23 at 20:32
5
$\begingroup$

The other answers are good, but one other way to view this is as a difference between the set-theoretic and type-theoretic views of functions.

In set theory, a function $f$ is defined by the relation $f = \{(x, f(x)) : x \in \text{dom}(f)\}$ of pairs from the domain and codomain. To be a function, a relation $r$ must simply not have $y_1 \neq y_2$ for a given $x$ such that $(x, y_1) \in r$ and $(x, y_2) \in r$. In this view, we have $\text{dom}(f) = \{x : (x, y) \in f\}$ and $\text{range}(f) = \{y : (x, y) \in f\}$. As other answers have mentioned, the codomain doesn't really matter. If two functions represent the same set of pairs when considered as relations, they are equal.

But in type theory, we must first define the type of a function by writing something like $f : A \to B$, so informally $\text{dom}(f) = A$ and $\text{codom}(f) = B$. In this view, we can't even meaningfully ask the question of whether $f$ is equal to another function $g : A \to B'$ unless $B$ and $B'$ are the same, because otherwise $f$ and $g$ would not be the same type. It would be like asking whether the color blue is equal to the number $3$. They're different types, and equality is only well-defined for two objects of the same type.

The reason your two books seem to give different answers to these questions is that mathematicians typically don't strictly use either set theory or type theory, and instead intuitively use an amalgamation of both. This question of whether the codomain matters for function equality only really becomes more important when you start delving deeper into set theory and/or type theory per se.

$\endgroup$
1
$\begingroup$

The codomain of $f$ doesn't really matter. The codomain is more like a property we have to prove. If we have $f : A \to B$, then $f$ was defined to take values in $A$, and it can be proved that it outputs value in $B$. So if $f(A) \not\subset B$, that means we have proved someting false. We could write $f : A \to f(A)$, which would always be true, but it is not always elegant. For example for the zero function that would be $f : \mathbb R \to \{0\}$. It's true, but in general what we care about is the type of object we have as the output. By that I mean, we just want to know that $f$ does not output, say, matrices so sometimes we would rather write $f : \mathbb R \to \mathbb R$ and say $f$ is the zero function. That's, in general, what the codomain serves for.

If you have $g : A \to C$, and for all $x \in A$, $f(x) = g(x)$, it poses no problem to say they are equal, even if $C \neq B$, because you won't find any contradiction. But either way, you could define $g_0 : A \to B$, with $g_0$ doing the same as $g$ and then say $f = g$ because they they output the same values and write the same.

So in the end, it's just a matter of which convention you are most comfortable with.

$\endgroup$
0
1
$\begingroup$

A closely related question is "Does $\mathbb C$ have $\mathbb R$ as a subset, or does it have a subset isomorphic to $\mathbb R$?" If you take it to be the latter, then $f: \mathbb R \rightarrow \mathbb R$ and $g: \mathbb R \rightarrow \mathbb C$ absolutely are different functions, even if $\forall x f(x)=g(x)$ (where euality is taken to mean "is the corresponding element"). It might be tempting to say that there's no difference between the subset of $\mathbb C$ that is isomorphic to $\mathbb R$ and actual $\mathbb R$, but applying that sort of thinking universally does raise issues.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .