This specific question has arisen out of my attempts to do a wider exercise (link).
Context
We say two functions, $f$ and $g$, are equal if all three of the following conditions are met:
- (i) they have the same domain
- (ii) they have the same codomain
- (iii) they map the same elements of the domain to the same elements of the codomain
Note 1: Textbook definitions (eg Tao Analysis I) say codomain for the second requirement, and not range. The range is the set of actual values mapped to by the function, and the codomain can be equal to the range, or a superset.
Note 2: The third condition can be stated as $f(x) = g(x)$ for all $x$ in the domain.
Question
The exercise I'm doing states that functions represented as n-tuples must be surjective. I asked why in that question, and that led me to what I think is the root cause of my misunderstanding.
The following example was given by a contributor (link):
Think about the functions :ℝ→ℝ and :ℝ→[0,+∞) where, for all ∈ℝ, ()=():=$^2$. Using the three-step definition of equality for functions, ≠ since codomains don't match: ℝ≠[0,+∞). You cannot deduce from "()=() everywhere" what were the codomains of or . Unless, of course, we demanded that the functions were surjective. But here was not surjective.
In my mind, if we know that the range of two functions is the same, then that is sufficient to say the second requirement (ii) for function equality. Is this wrong? Why?
Discussion
I am aware that the domain is the full set of values that can be input to a function, but that the codomain can be a superset of the range, the actual values mapped to by the function.
Consider a very simple example of two functions:
$$f(1) = a, f(2) = b$$ $$g(1) = a, g(2) = b$$
If we are given that the domain is $\{1,2\}$, we can say the two functions have the same domain. This is requirement (i) for function equality.
We can also see the two function map the same input to the same output, that is, $f(x)=g(x)$ for all $x$ in the domain. This is requirement (iii) for function equality.
In this simple example, we know there is no other value mapped to by $f$ or $g$ outside the range $\{a,b\}$.
For requirement (ii), I contend that we are given the range $\{a,b\}$ and this is sufficient to satisfy the requirements for function equality, given (i) and (iii) are also met.
In summary, we don't always know the range, but if we do, I suggest it is sufficient for condition (ii).
Going back to the example given using $f(x)=g(x)=x^2$. We know:
- (i) the domains are the same, $\mathbb{R}$
- (iii) the two functions map the same inputs to the same outputs
- (ii) the range of the two functions is the same, $[0,+\infty]$
We know $f$ and $g$ can't take values outside this range $[0,+\infty]$, so a codomain of $\mathbb{R}$ isn't more useful or informative than $[0,+\infty]$. In fact it is less informative than the actual range.
So again, in my mind, the two functions are equal.
Why am I wrong?
Update:
In terence Tao's Anlsysis I 4th edition, he states the codomains must be the same. However in the 3rd edition he states the ranges must be the same. Curiouser and curioser ...