If $C'$ is a subcategory of $C$, why can $\mathrm{Hom}_C(X, Y)$ and $\mathrm{Hom}_{C'}(X, Y)$ be different?

Let $C$ be a category and $C'$ a subcategory of $C$. Then by the definition of a subcategory, $$\mathrm{Hom}_{C'}(X, Y) \subseteq \mathrm{Hom}_C(X, Y)$$ for $X, Y$ in $C'$. My question is why it is possible that $\mathrm{Hom}_C(X, Y) \neq \mathrm{Hom}_{C'}(X, Y)$?

Let $\mathsf{Mod}$ be the category of all right $A$-modules, where $A$ is a $K$-algebra and $K$ is a field. Let $\mathsf{mod}$ be the subcategory of $\mathsf{Mod}$ consisting of all finitely generated right $A$-modules. It is said that $$\mathrm{Hom}_{\mathsf{Mod}}(X, Y) = \mathrm{Hom}_{\mathsf{mod}}(X, Y)$$ for any $X, Y$ in $\mathsf{mod}$. How to show that $\mathrm{Hom}_{\mathsf{Mod}}(X, Y) = \mathrm{Hom}_{\mathsf{mod}}(X, Y)$? Thank you very much.

-
For the first let me give you an example, Consider Category of sets and Category of Groups, Say X and Y are 2 groups, then what about Hom(X,Y) in sets and Groups? –  Ram Mar 6 '13 at 8:23
I edited your first formula, since it was written backwards –  magma Mar 6 '13 at 20:11

Possibly my favourite example is when $C'$ is the category of rings, and $C$ the subcategory of rings with a multiplicative identity.

Take the rings $$A = \left\{ \begin{bmatrix} a & 0\\ 0 & 0 \end{bmatrix} : a \in \mathbf{Q} \right\}, \qquad B = \left\{ \begin{bmatrix} a & 0\\ 0 & b \end{bmatrix} : a, b \in \mathbf{Q} \right\}.$$

They both have an identity, which is $$\begin{bmatrix} 1 & 0\\ 0 & 0 \end{bmatrix}$$ for $A$, and $$\begin{bmatrix} 1 & 0\\ 0 & 1 \end{bmatrix}$$ for $B$.

Then the inclusion map $$A \to B, \qquad \begin{bmatrix} a & 0\\ 0 & 0 \end{bmatrix} \mapsto \begin{bmatrix} a & 0\\ 0 & 0 \end{bmatrix}$$ is a morphism in $C'$ but not in $C$.

-
Right. More generally (and simpler) the inclusion $R\to R\times S:r\mapsto(r,0)$ for any rings $R,S$ with $S$ nontrivial, is a morphism of unit-less rings, but not of unital rings. –  Marc van Leeuwen Mar 6 '13 at 8:35
@MarcvanLeeuwen, absolutely. I was going for an elementary example, though, as it requires only a basic familiarity with matrices. –  Andreas Caranti Mar 6 '13 at 8:39

See the definition of full subcategory. If you are describing the subcategory by only restricting the class of objects, as is done in the example you gave by imposing "finitely generated", then you are implicitly defining a full subcategory (no additional restrictions of morphisms). In other words, there is nothing to prove for the equality of Hom-sets, it is just implicit in the description.

An example of a non-full subcategory is the category of associative $K$-algebras as subcategory of the category of rings: not only a $K$-algebra is a ring that also must be a $K$-vector space (in a compatible way), but also the morphisms of $K$-algebras must be $K$-linear. The latter is not necessarily the case for a ring morphism between two $K$-algebras, so one can get strictly smaller Hom-sets in the subcategory.

-

First, if $C'$ is a subcategory $C$ then it's $Hom_{C'}(X,Y)\subseteq Hom_C(X,Y)$, not the other way around.

If equality holds for all object $X,Y$ then $C'$ is a full subcategory of $C$. This is the case for the categories of modules you consider. However, there is no reason to demand that any subcategory be a full subcategory. For instance, just like the empty set is contained in any set, so it is convenient to have the empty category (no objects, no arrows) to be a subcategory of any category. This would not be the case if you demanded all subcategories to be full. There are many other examples where you want to be able to consider just some of the objects of a given category and some of the arrows. In fact, the objects in a category are just there for decoration. A category can be defined in a completely object-free way. That means that what actually counts in a category are the arrows, and so a subcategory should consists of a subset collection of the arrows, which itself forms a category with the same composition rule as in the ambient category.

EDIT: Thank you Marc van Leeuwen for the correction that the empty category is always a full subcategory. What I had in mind is the for every category $C$ there is a natural subcategory consisting of all the objects of the category and only the identity arrows.

-
The empty category is a full subgategory of any category. Since there aren't any Hom-sets to consider, the required equality of Hom-sets is vacously satified. –  Marc van Leeuwen Mar 6 '13 at 8:52
Very true @MarcvanLeeuwen, I did not write I what had in mind. I made a remark in the answer to that effect. Thanks! –  Ittay Weiss Mar 6 '13 at 9:05