# Maps between Eilenberg–MacLane spaces

I was re-reading an algebraic topology book the other day, and I came across the following problem:

Suppose that $\pi$ and $\rho$ are abelian groups and $n\geq 1$. Determine $[K(\pi,n),K(\rho,n)]$, the set of (based) homotopy classes of maps between the corresponding Eilenberg-MacLane spaces.

I believe that the following is a solution: We have two functors $K(-,n)$ from (discrete) abelian groups to (the homotopy category of nice) topological spaces, and $\pi_n = [S^n,-]$ going the other direction. When we suitably restrict these functors, they appear to be inverses. Therefore $[K(\pi,n),K(\rho,n)]\cong \hom_{Ab}(\pi,\rho)$

I have two questions. Is the solution correct, or are there errors in the logic? If it does work, is there a way to make it completely transparent that the functors are inverse to each other? And if it is correct, if we suitably topologize $\pi_n(-)$, does this extend to non-discrete topological groups?

Second, is there a different way to approach the problem which better illuminates what is going on or illustrates an important point about $K(\pi,n)$?

-
@Grigory M: I mean that if we restrict to the (full sub-)category of CW complexes with homotopy groups concentrated in degree $n$ and discrete abelian groups, the two functors seem to induce inverse equivalences, if I am thinking about things correctly. –  Aaron Jun 4 '11 at 7:05
It's certainly true, but this statement is exactly equivalent to the problem you quote. You can't prove it... well, without doing something :-) –  Grigory M Jun 4 '11 at 7:08
I mean, it has an obvious part: $\pi_n\circ K(-;n)\cong Id$; but the part $K(-;n)\circ\pi_n\cong Id$ relies on the problem. –  Grigory M Jun 4 '11 at 7:10

Recall that $[X,K(G,n)]=H^n(X;G)$. Hence $[K(\pi,n),K(\rho,n)]=H^n(K(\pi,n);\rho)$ — which (by Hurewicz theorem + universal coefficients) is exactly $\hom(\pi,\rho)$.
I don't know. Some obstruction theory proof, perhaps?.. Anyway, let me give a warning: if you find an easy proof, check that it doesn't "prove" that, say, $[\mathbb T^2,S^2]\to\hom(\pi_1(\mathbb T^2),\pi_1(S^2))=0$ is injective. –  Grigory M Jun 4 '11 at 16:59