isomorphism and $id$

In a category I have two objects $a$ and $b$ and a morphism $m$ from $a$ to $b$ and one $n$ from $b$ to $a$. Is this always an isomorphism? Why is it emphasized that this has to be true, too: $m \circ n = \mathrm{id}_b$ and $n \circ m = \mathrm{id}_a$?

I am looking for an example in which the id-part is not true and therefore $m$ and $n$ are not isomorphic.

-
Are you saying that the hom-sets $Hom(a,b)$ and $Hom(b,a)$ consist of one element? This does not imply that $a,b$ are isomorphic. (For instance, consider two non-isomorphic irreducible representations of a finite group.) –  Akhil Mathew Jul 27 '10 at 17:40

If you have no restrictions on m and n, then clearly they cannot be isomorphisms in general. For instance, take any two groups G and H and let m: G --> H, n: H --> G be the zero homomorphisms.

Even if you say that n and m are monomorphisms, then it is still not true in general that they are isomorphisms. I believe it is true however if your category is one whose objects are sets with additional structure. See this question: http://math.stackexchange.com/questions/309/if-a-is-a-subobject-of-b-and-b-a-subobject-of-a-are-they-isomorphic/327#327.

-
Someone told me that it is true that if $m$ and $n$ are both epimorphisms, then the objects are isomorphic. Is this so? I'm sceptical... –  Seamus Aug 3 '10 at 13:13
@Seamus, pick any category $C$ where the statement is not true for monomorphisms and consider its opposite category $C^{\mathrm{op}}$: then the statement is not true of epimorphisms in $C^{\mathrm{op}}$. –  Mariano Suárez-Alvarez Sep 1 '10 at 12:53
Yeah, I thought so! So that guy was wrong. Hah. –  Seamus Sep 1 '10 at 15:26
It's true for sets, but not any category of sets with additional structure, for example groups (unless I misunderstand what "additional structure" means). The free groups on two and three generators embed in each other but are not isomorphic. –  MartianInvader May 24 '11 at 17:00

The important point here, I think, is about Hom(a,a) and Hom(b,b). nm is guaranteed to be an element of the first and mn an element of the second; to be an isomorphism, both of these maps must be the identity by definition. The definition of category requires that you have at least the identity in both endomorphism sets; if neither set has non-identity elements then you get an isomorphism, since the compositions don't have anything other than the identity to be, but this needn't hold in general.

Maximally toy example: take the full subcategory of sets given by the one element set A and the two element set B. Hom(A,A) is only the identity, but Hom(B,B) has four elements, two of which are not isomorphisms.

-
To make this perhaps even clearer, say we have the objects $a=\{x, y\}$ and $b=\{z\}$. Define $m\colon a\to b$ by $x\mapsto z$, $y\mapsto z$ (the only possible morphism here). Define $n\colon b\to a$ by $z\mapsto x$. But, of course, $n\circ m$ doesn't equal $\mathrm{id}_a$, since $(n\circ m)(y)=n(m(y))=n(z)=x$, $(n\circ m)(x)=n(m(x))=n(z)=x$, so we have $n\circ m\colon a\to a$ is $x\mapsto x$, $y\mapsto x$.
Perhaps if the cardinality of objects $a$ and $b$ equal each other, then a morphism $m$ from $a$ to $b$ and a morphism $n$ from $b$ to $a$, then both $m$ qualifies as an isomorphism and $n$ qualifies as an isomorphism also.