Category of sets Let C be a category of sets, which has objects all sets and arrows all functions, with usual identity functions and the usual composition of functions. For any set S, the assignment s-s for all s in S describes the identity function. If S is a subset of Y, the assignment also describes the inclusion function from S to Y. These functions are different unless S is equal to Y. My question is why these functions are different since they have the same domain and assignment.
 A: The two functions have different codomains. Any map $S\to S$ lies in $Mor(S,S)$ while any map $S\to Y$ lies in $Mor(S,Y)$.
A: In Categories, we have two operations called Domain and Codomain from the collection of all arrows to the collection of all objects. Each arrow $f$ belongs to the collection $C(\mathrm{dom}f,\mathrm{codom} f)$. 
So in the Category of Sets, we actually are interested not just in the domain and the assignment of each function (which is what the arrows are), but also in the codomain. That is, you want to think of a function in the category $\mathcal{S}et$ as a triple, consisting of the domain, the codomain, and the actual set of pairs that make up the function (the assignment), $(A,B,f)$ for a function $f\colon A\to B$. Then the operator Domain will just give you the first component, $A$; the operator Codomain will give you the second component $B$. 
Here, two functions are equal if and only if they have the same domain, the same assignment, and the same codomain. The codomain is important because it is an important attribute of arrows in categories. 
So the inclusion function from $S$ to $Y$ has domain $S$, codomain $Y$, and rule $s\mapsto s$. The identity function from $S$ to itself has domain $S$, codomain $S$, and rule $s\mapsto s$. So the first function corresponds to
$$\Bigl(S, Y, \{(s,s)\in S\times S\}\Bigr)$$
while the second function is
$$\Bigl(S,S,\{(s,s)\in S\times S\}\Bigr).$$
If the two arrows are equal, then the value of Domain and of Codomain must be the same in both; that is, we must have $S=Y$. And of course, if $S=Y$, then they are the same function.
