[proofplan]
We argue by contradiction: a homeomorphism $h: \mathbb{R}^n \to \mathbb{R}^m$ would restrict to a homeomorphism between punctured Euclidean spaces, so it suffices to distinguish $\mathbb{R}^n \setminus \{0\}$ from $\mathbb{R}^m \setminus \{0\}$ for $n \neq m$. Each punctured space deformation retracts onto the unit sphere of its dimension, so by homotopy invariance of homology the invariants $H_{n-1}(\mathbb{R}^n \setminus \{0\}) \cong H_{n-1}(S^{n-1}) \cong \mathbb{Z}$ distinguish different dimensions. We may assume $n \geq 1$ throughout: the case $m = 0$ is immediate since $\mathbb{R}^0$ is a single point while $\mathbb{R}^n$ has more than one point for $n \geq 1$.
[/proofplan]
[step:Reduce to comparing punctured Euclidean spaces via a putative homeomorphism]
Suppose for contradiction that there exists a homeomorphism
\begin{align*}
h: \mathbb{R}^n &\to \mathbb{R}^m.
\end{align*}
By post-composing with the translation $y \mapsto y - h(0)$ (a homeomorphism of $\mathbb{R}^m$), we may assume $h(0) = 0$. Removing the origin from both sides, the restriction
\begin{align*}
h\big|_{\mathbb{R}^n \setminus \{0\}}: \mathbb{R}^n \setminus \{0\} &\to \mathbb{R}^m \setminus \{0\}
\end{align*}
is a homeomorphism: $h$ is a bijection with $h(0) = 0$, so the restriction to the complement is a bijection onto the complement of $h(0) = 0$; continuity and continuity of the inverse are inherited from the subspace topology.
[/step]
[step:Deformation retract each punctured space onto its unit sphere]
We construct a deformation retraction $r_n: \mathbb{R}^n \setminus \{0\} \to S^{n-1}$, where $S^{n-1} = \{x \in \mathbb{R}^n : |x| = 1\}$ with its subspace topology. Define the straight-line homotopy
\begin{align*}
H_n: (\mathbb{R}^n \setminus \{0\}) \times [0,1] &\to \mathbb{R}^n \setminus \{0\} \\
(x, t) &\mapsto (1-t)\, x + t\, \tfrac{x}{|x|}.
\end{align*}
We verify that $H_n$ lands in $\mathbb{R}^n \setminus \{0\}$: for $t \in [0,1]$, the point $H_n(x,t) = \left((1-t) + t/|x|\right) x$ is a positive scalar multiple of $x$, hence nonzero. Continuity of $H_n$ follows from continuity of scalar multiplication and the norm map on $\mathbb{R}^n \setminus \{0\}$. At $t = 0$, $H_n(x, 0) = x$, and at $t = 1$, $H_n(x, 1) = x/|x| \in S^{n-1}$. Moreover, for $x \in S^{n-1}$ we have $x/|x| = x$, so $H_n(x, t) = x$ for all $t$. This shows $H_n$ is a deformation retraction of $\mathbb{R}^n \setminus \{0\}$ onto $S^{n-1}$, so $\mathbb{R}^n \setminus \{0\} \simeq S^{n-1}$ (homotopy equivalent).
The identical construction (replacing $n$ with $m$) gives $\mathbb{R}^m \setminus \{0\} \simeq S^{m-1}$.
[guided]
The goal is to replace the open non-compact punctured spaces with their more tractable spherical cores. The natural map is the radial projection $x \mapsto x/|x|$; we must show this is a homotopy inverse to the inclusion $S^{n-1} \hookrightarrow \mathbb{R}^n \setminus \{0\}$.
The straight-line homotopy $H_n(x, t) = (1-t)\,x + t\,x/|x|$ linearly interpolates from the identity at $t=0$ to the radial retraction at $t=1$. Why is it a valid map into $\mathbb{R}^n \setminus \{0\}$? We compute
\begin{align*}
H_n(x, t) = \left( (1-t) + \frac{t}{|x|} \right) x.
\end{align*}
The scalar $(1-t) + t/|x|$ is a convex combination of $1$ and $1/|x|$, both positive (recall $|x| > 0$ since $x \neq 0$), so it is strictly positive. Hence $H_n(x,t) \neq 0$.
Why is $H_n$ a *deformation* retraction (fixing $S^{n-1}$) rather than just a homotopy? For $x \in S^{n-1}$ we have $|x| = 1$, so $x/|x| = x$ and $H_n(x, t) = (1-t)x + tx = x$ identically in $t$. This is the "strong deformation retract" property and in particular implies that the inclusion $S^{n-1} \hookrightarrow \mathbb{R}^n \setminus \{0\}$ and the radial retraction are homotopy inverses, so the two spaces are homotopy equivalent.
The same argument applies verbatim with $n$ replaced by $m$, yielding $\mathbb{R}^m \setminus \{0\} \simeq S^{m-1}$.
[/guided]
[/step]
[step:Apply homology to extract a dimension-distinguishing invariant]
Since $h\big|_{\mathbb{R}^n \setminus \{0\}}$ is a homeomorphism, by [Homeomorphic Spaces Have Isomorphic Homology](/theorems/1942) it induces an isomorphism
\begin{align*}
H_k(\mathbb{R}^n \setminus \{0\}) \cong H_k(\mathbb{R}^m \setminus \{0\}) \quad \text{for every } k \geq 0.
\end{align*}
Combined with the homotopy equivalences $\mathbb{R}^n \setminus \{0\} \simeq S^{n-1}$ and $\mathbb{R}^m \setminus \{0\} \simeq S^{m-1}$ from the previous step, and using that homotopy equivalent spaces have isomorphic homology (which follows from [Homotopic Maps Induce Equal Maps on Homology](/theorems/1944) applied to a homotopy equivalence and its inverse), we obtain
\begin{align*}
H_k(S^{n-1}) \cong H_k(S^{m-1}) \quad \text{for every } k \geq 0.
\end{align*}
By [Homology of Spheres](/theorems/1945),
\begin{align*}
H_k(S^{n-1}) \cong \begin{cases} \mathbb{Z} & k = 0 \text{ or } k = n-1, \\ 0 & \text{otherwise}, \end{cases}
\end{align*}
and similarly for $S^{m-1}$. For $n \geq 2$ and $m \geq 2$ with $n \neq m$, take $k = n - 1 \geq 1$. Then $H_{n-1}(S^{n-1}) \cong \mathbb{Z}$, but $H_{n-1}(S^{m-1}) = 0$ since $n - 1 \neq 0$ and $n - 1 \neq m - 1$. This contradicts the isomorphism $H_{n-1}(S^{n-1}) \cong H_{n-1}(S^{m-1})$.
For the remaining case $n = 1$, $m \geq 2$ (or vice versa), we use $k = m - 1 \geq 1$: then $H_{m-1}(S^{m-1}) \cong \mathbb{Z}$ while $H_{m-1}(S^0) = 0$ since $m - 1 \geq 1$. This again contradicts the isomorphism.
[guided]
The strategy is to find a homotopy invariant that depends on dimension. The homology groups of spheres do exactly this: the sphere $S^{n-1}$ has its top-dimensional homology $H_{n-1}$ equal to $\mathbb{Z}$ and all other positive-degree homology equal to zero. So the degree in which the nonzero top homology appears *records* the dimension of the sphere.
We must verify two chains of reasoning: first, that a homeomorphism $\mathbb{R}^n \to \mathbb{R}^m$ forces an isomorphism of homology of the punctured spaces, and second, that the punctured spaces have the same homology as the spheres.
For the first: we invoke [Homeomorphic Spaces Have Isomorphic Homology](/theorems/1942), whose hypothesis is the existence of a homeomorphism between the two spaces — which we constructed in Step 1 as $h$ restricted to the complement of the origin.
For the second: homotopy equivalent spaces have isomorphic homology. This follows from applying [Homotopic Maps Induce Equal Maps on Homology](/theorems/1944) to the composition of a homotopy equivalence with its inverse: the composition is homotopic to the identity, hence induces the identity on homology, so each of the two maps in the homotopy equivalence must induce an isomorphism.
Assembling the chain: $H_k(\mathbb{R}^n \setminus \{0\}) \cong H_k(S^{n-1})$ and $H_k(\mathbb{R}^m \setminus \{0\}) \cong H_k(S^{m-1})$ via homotopy invariance, and $H_k(\mathbb{R}^n \setminus \{0\}) \cong H_k(\mathbb{R}^m \setminus \{0\})$ via the homeomorphism. Combining:
\begin{align*}
H_k(S^{n-1}) \cong H_k(S^{m-1}) \text{ for every } k \geq 0.
\end{align*}
Now the dimensional distinction: take $k = n - 1$ (assume WLOG $n \geq 2$ and $n > m$, so $k \geq 1$ and $k \neq m - 1$). By [Homology of Spheres](/theorems/1945), $H_k(S^{n-1}) = H_{n-1}(S^{n-1}) = \mathbb{Z}$, while $H_k(S^{m-1}) = H_{n-1}(S^{m-1}) = 0$ (because $k = n-1 \neq m - 1$ and $k = n - 1 \geq 1 \neq 0$). Thus $\mathbb{Z} \cong 0$, a contradiction.
The edge cases where $n = 1$ or $m = 1$ (so that $S^{n-1} = S^0$ is just two points) need separate handling: we use $k = \max(n, m) - 1$ to distinguish.
The case $m = 0$ requires no homological input: $\mathbb{R}^0$ is a one-point space, while $\mathbb{R}^n$ for $n \geq 1$ is uncountable, so no bijection exists.
[/guided]
[/step]
[step:Conclude that no homeomorphism exists]
Each case has produced a contradiction with the assumption that a homeomorphism $h: \mathbb{R}^n \to \mathbb{R}^m$ exists for $n \neq m$. Hence no such homeomorphism exists, so $\mathbb{R}^n \not\cong \mathbb{R}^m$ as topological spaces whenever $m \neq n$. This completes the proof.
[/step]