I need to prove that there exists a homeomorphism between the one-point compactification of $\mathbb{R}^n$, that is, $\mathbb{R}^n\cup\lbrace\infty\rbrace$, and the $n$-dimensional sphere $S^n$. Let's denote the north pole of $S^n$ by $N$.
Let's remember that if $\tau$ is the usual topology of $\mathbb{R}^n$, then there exists a unique topology $\varphi$ that makes $\mathbb{R}^n\cup\lbrace\infty\rbrace$ Hausdorff and compact. And this topology is defined as $\varphi = \tau\cup\lbrace V|\infty\in V; \mathbb{R}^n\setminus V$ compact$\rbrace$.
We know that the stereographic projection $f\colon\mathbb{R}^{n}\longrightarrow S^n\setminus \lbrace N\rbrace$ given by $f(x_1,\cdots , x_n) = \left(\dfrac{2x_1}{x_1^2+\cdots + x_n^2},\cdots, \dfrac{2x_{n}}{x_1^2+\cdots + x_n^2}, \dfrac{x_1^2+\cdots + x_n^2 -1}{x_1^2+\cdots + x_n^2 +1}\right)$ is a homeomorphism, which is clear to me. Let's denote the inverse of $f$ by $g$.
To show that $S^n$ is homeomorphic to $\mathbb{R}^n\cup\lbrace\infty\rbrace$, we can define the function $\bar{f}\colon\mathbb{R}^n\cup\lbrace\infty\rbrace\longrightarrow S^n$ given by $\bar{f}(x)=f(x)$ if $x\in\mathbb{R}^n$ and $f(\infty)=N$, which is clearly a bijection with inverse $\bar{g}\colon S^n\longrightarrow\mathbb{R}^n\cup\lbrace\infty\rbrace$ given by $\bar{g}(x)=g(x)$ if $x\in S^n\setminus\lbrace N\rbrace$ and $g(N) = \infty$.
So, my question is: how can I prove that $\bar{f}$ and $\bar{g}$ are continuous at $\infty$ and $N$ respectively?
Initially, to show the continuity of $\bar{f}$, my idea was to take an open neighborhood $V$ of $N$. By the definition of relative topology, this implies the existence of an open set $A$ of $\mathbb{R}^{n+1}$ such that $V = A\cap S^n$. But upon analyzing the inverse image $\bar{f}^{-1}(V) = \bar{f}^{1}(A)\cap\bar{f}^{-1}(S^n)$ I couldn't conclude anything. How can I proceed?