Difference between the two definitions about the equality of two functions From a long time I have found there are two definitions about the equality of two functions (or identity of two functions).  I quoted the two definitions in the following:
Zorich's definition (Zorich, Mathematical Analysis, Vol I, Page 12): Two functions $f_1$ and $f_2$ are considered identical or equal if the have the same domain $X$ and at each element $x\in X$ the values $f_1(x)$ and $f_2(x)$ are the same. In this case we write $f_1=f_2.$
Amann's definition (Herbert Amann, Analysis,Vol I, Page 16): Two functions $f: X\to Y$ and $g: U\to V$ are equal, in symbols $f=g,$ if $ X=U, Y=V$ and $f(x)=g(x),  x\in X.$ That is to say, two functions are considered equal if they have the same domains and the codomains, and furthermore, take the same value at each argument.
As you can see, the difference between the two definitions lies in the requirement of the equality of the codomains of the two functions under consideration.  Amann's definition requires that the two codomains are the same, while Zorich's definition dose not. 
Why are there two these definitions? Which one should I take for granted?  After some consideration, I found a partial explanation. That is, since there are injective functions and surjective functions, it is reasonable to require the equality of the codomain in the definition of the equality of two functions, that is to say, Amann's definition is OK in this respect.  But how about Zorich's definition?   Can anyone give me some more explanation or suggestions, or even references?
 A: 
Zorich's definition (Zorich, Mathematical Analysis, Vol I, Page 12): Two functions $f_1$ and $f_2$ are considered identical or equal if the have the same domain $X$ and at each element $x\in X$  the values $f_1 (x)$  and $f_2 (x)$  are the same. In this case we write $f_1 =f_2$.
Amann's definition (Herbert Amann, Analysis,Vol I, Page 16): Two functions $f:X\to Y$  and $g:U\to V$  are equal, in symbols $f=g$,  if $X=U,Y=V$  and $f(x)=g(x),\forall x\in X$.  That is to say, two functions are considered equal if they have the same domains and the codomains, and furthermore, take the same value at each argument.

The definitions are equivalent.  Equal functions implicitly share identical codomains by Zorich definition.  They cannot do otherwise, since the codomain of a function is defined as the set of images of all elements in the domain.  It follows directly from the stronger requirement of equal images for all members of the shared domain.
The codomain of $f_1$ is $f_1(X) \mathop{=}^{\text{def}} \{f_1(x) \mid \forall x \in X\}$ where $X$ is the domain of $f_1$.  Likewise for $f_2(X)$.
Circularly we can say: $f_1: X \to f_1(X)$
So:$$\underbrace{\bigl(f_1:X\to f_1(X)\bigr), \bigl(f_2:X\to f_2(X)\bigr), \bigl(\forall x\in X, f_1(x)=f_2(x)\bigr)}_{f_1=f_2} \implies \bigl(f_1(X)\equiv f_2(X)\bigr)$$
A: Some books include the codomain as part of the definition while others do not. See Wikipedia for a brief discussion on how Bourbaki gives both kinds of definition. Wikipedia says that the definition ignoring the codomain is preferred in set theory.
I am more used to the definition without a codomain. For example, my Baby Rudin (Principles of Mathematical Analysis, Second edition) on page 21 ignores the codomain. So does my Mendelson (Introduction to Mathematical Logic) on page 168. In particular, Mendelson basically defines a function as a class of ordered pairs, so the domain (p. 163) and the range (p. 167) (also called the image) are results of the function and not part of the definition.
It looks like you get to choose which definition you like.
