Could someone show an example of two spaces $X$ and $Y$ which are not of the same homotopy type, but nevertheless $\pi_q(X)=\pi_q(Y)$ for every $q$? Is there an example in the CW complex or smooth category?

$\begingroup$ In the early days of math overflow this question would have been welcomed. If this question were asked today it would almost certainly be sent to stack exchange. I propose we close it so that standards are kept consistent and so that no one else comes along to bump it to the front page. I don't think it'll garner any new answers and even if it did this is not the right place to record such examples. $\endgroup$– David WhiteAug 17, 2014 at 22:04

14$\begingroup$ I think this is still a perfectly fine question, and should remain open. $\endgroup$– Charles RezkAug 18, 2014 at 2:40
7 Answers
There are such spaces, for example $X = S^2 \times \mathbb{R}P^3$, $Y = S^3 \times \mathbb{R}P^2.$ (These are both smooth and CWcomplexes.)
Whitehead's Theorem says that for CWcomplexes, if a map $f : X \to Y$ induces an isomorphism on all homotopy groups then it is a homotopy equivalence. But, as the example above shows, you need the map. Such a map is called a weak homotopy equivalence.
(Whitehead's Theorem is not true for spaces wilder than CWcomplexes. The Warsaw circle has all of its homotopy groups trivial but the unique map to a point is not a homotopy equivalence.)

9$\begingroup$ Also the long line has zero homotopy groups, but is not contractible. It's too long! (but it is also a manifold, sort of...) $\endgroup$ Oct 31, 2009 at 15:37

$\begingroup$ @ChrisSchommerPries If you require a countable base in the definition of a manifold, then no. $\endgroup$ Oct 30, 2021 at 0:35

$\begingroup$ another similar example in one lower dimension is $ X= S^2 \times \mathbb{R}P^2 $ and $ Y=S^2 \rtimes \mathbb{R}P^2 $ the unique nontrivial $ S^2 $ bundle over $ \mathbb{R}P^2 $ (although this is not as simple as your example and not as low dimensional as the example with lens spaces) $\endgroup$ Apr 10, 2022 at 20:17
All of these examples involve a bit of cleverness, so I thought I'd point out a more straightforward way to construct counterexamples. If $X$ is any space, we can build a space $X' = K(\pi_0 X, 0) \times K(\pi_1 X, 1) \times K(\pi_2 X, 2) \times \dots$ which has the same homotopy groups as $X$, but which is usually not weakly equivalent to $X$. Pretty much any invariant of spaces other than the homotopy groups will distinguish them. For instance, if $X = S^2$, then $H_3(X) = 0$, but $X'$ contains $K(\pi_3 S^2, 3) = K(\mathbb{Z}, 3)$ as a retract, so $H_3(X')$ contains $H_3(K(\mathbb{Z}, 3)) = \mathbb{Z}$ as a retract and cannot be $0$.
Of course, this doesn't produce geometrically nice spaces like smooth manifolds.
$S^3 \times \mathbb{R}P^2$ and $\mathbb{R}P^3 \times S^2$ are both smooth 5manifolds with fundamental group $\mathbb{Z}/2$ and universal cover $S^3 \times S^2$, so their homotopy groups are all the same. On the other hand, only the latter is orientable since $\mathbb{R}P^3$ is orientable but $\mathbb{R}P^2$ isn't, so they have different values on $H^5$ and therefore can't be homotopy equivalent. (I think this example is in Hatcher somewhere.)

1$\begingroup$ Beaten by 21 seconds  I guess this really is a standard example! $\endgroup$ Oct 31, 2009 at 13:54

$\begingroup$ I used the Wikipedia for this example... (But, yes it is the standard example, I think.) $\endgroup$ Oct 31, 2009 at 13:59

12$\begingroup$ Here's another example for the sake of originality: two 3dimensional lens spaces L(p,q1) and L(p,q2) are homotopy equivalent iff q1*q2 = \pm n^2 (mod p) for some n, so L(5,1) and L(5,2) are not homotopy equivalent. But they both have fundamental group Z/5Z and universal cover S^3, so their homotopy groups are the same. $\endgroup$ Oct 31, 2009 at 14:00
Along the same lines: you can produce examples involving simply connected finite CWcomplexes, by using $S^1$ actions: $\mathbb{C}P^m \times S^{2n+1}$ and $S^{2m+1}\times \mathbb{C}P^n$ have the same homotopy groups, for instance.
It's easy to produce examples with arbitrarily high connectivity: take the homotopy fiber $X$ of any nontrivial map $K(A,m)\to K(B,n+1)$, with $n>m$. Then $X$ and $Y=K(A,m) \times K(B,n)$ have the same homotopy groups, but are not homotopy equivalent.
Here's a new question: for given $k$, can you find a pair of $k$connected finite CWcomplexes which have the same homotopy groups, but aren't homotopy equivalent?
It's easy to construct myriads of such examples using finite $T_0$ topological spaces. These are equivalent in a natural way to finite posets (check this wikipedia article). With a poset $P$ we may associate an abstract simplicial complex $K(P)$ whose simplices are the chains of $P$. It turns out that the geometric realization of $K(P)$ and $P$ are weakly homotopy equivalent (there is a continuous map $K(P) \to P$ inducing isomorphisms on homotopy groups). However, these spaces are not homotopy equivalent (unless they are both homotopy equivalent to a discrete space).
Moreover, examples of weakly homotopy equivalent finite spaces that are not homotopy equivalent are also easy to give.
The following notes by J.P. May are a nice introduction to this topic: http://www.math.uchicago.edu/~may/MISC/FiniteSpaces.pdf , http://www.math.uchicago.edu/~may/MISC/SimpCxes.pdf
Consider $X=S^1\vee S^3$ and its double cover $X_2$ i.e, attach two copy of $S^3$ one in north pole and one in south pole of $S^1$. Then $\pi_1(X) =\mathbb{Z} = \pi_1(X_2)$. And covering map induced isomorphism in $\pi_n$ for all $n\geq 2$. But they are not homotopically equivalent since their Eular Characteristics are different.
The simplest examples I know are the $3$dimensional lens spaces $L(p,q)$. They display many oddities.
Consider the lens spaces $L(p,q_0)$ and $L(p,q_1)$, $\gcd(p,q_0)=\gcd(p,q_1)=1$. Their fundamental groups are isomorphic to the cyclic group $\newcommand{\bZ}{\mathbb{Z}}$ $\bZ/p\bZ$. Since both these lens spaces have the same universal cover $S^3$, their higher homotopy groups are also isomorphic.
A theorem of FranzRueffWhitehead (see Theorem 2.60 of these notes) shows that $L(p,q_0)$ and $L(p,q_1)$ are homotopy equivalent if and only
$$q_1\equiv \pm \ell^2 q_0\bmod p, $$
for some $\ell\in\bZ$. This reduces the problem to a number theoretic one. For example, $L(5,1)$ is not homotopy equivalent to $L(5,2)$ since $\pm 2$ is not a quadratic residue mod $5$.
On the other hand, the lens spaces $L(7,1)$ and $L(7,2)$ are homotopy equivalent, but they are not homeomorphic.