Extension of a continuous map on $ {\mathbf{GL}_{n}}(\mathbb{R}) $ to $ {\mathbf{M}_{n}}(\mathbb{R}) $. I was reading in my analysis textbook that the map $ f: {\mathbf{GL}_{n}}(\mathbb{R}) \to {\mathbf{GL}_{n}}(\mathbb{R}) $ defined by $ f(A) := A^{-1} $ is a continuous map. I also saw that $ {\mathbf{GL}_{n}}(\mathbb{R}) $ is dense in $ {\mathbf{M}_{n}}(\mathbb{R}) $. My question is:

What is the unique extension of $ f $ to $ {\mathbf{M}_{n}}(\mathbb{R}) $?

 A: The matrices
$$ A_{n} = \begin{pmatrix} \frac{1}{n} & 0\\ 0 & \frac{1}{n} \end{pmatrix}$$
converge to the zero matrix as $n \to \infty$. Their inverses are
$$ A_{n} = n \begin{pmatrix} 1 & 0\\ 0 & 1 \end{pmatrix}$$
And this goes to infinity in matrix norm as $n\to \infty$. Thus there is no way to extend the inverse to even the zero matrix.
This example is analogous to trying to extend $f(x) = x^{-1}$ from $(0,1)$ to $[0,1]$.
A: As pointed out by the others, you cannot extend $f$ to a continuous function $g:M_n(\mathbb{R})\to M_n(\mathbb{R})$, because there exists a convergent sequence of invertible matrices $X_n$ such that $f(X_n)=X_n^{-1}$ diverges. There does exist, however, a bijective function $g:M_n(\mathbb{R})\to M_n(\mathbb{R})$ such that $g=f$ on $GL_n(\mathbb{R})$, namely, $g(X)=X^+$ is the Moore-Penrose pseudoinverse of $X$.
A: Just to add to the two answers above. If you refer to my solution in the thread Left topological zero-divisors in Banach algebras., you will see that if $ X \in \partial({\text{GL}_{n}}(\mathbb{R})) \subseteq {\text{M}_{n}}(\mathbb{R}) $, where $ \partial $ denotes the topological boundary operator, then there exists a sequence $ (X_{n})_{n \in \mathbb{N}} $ in $ {\text{GL}_{n}}(\mathbb{R}) $ such that $ \displaystyle \lim_{n \to \infty} X_{n} = X $ but $ \displaystyle \lim_{n \to \infty} \| X_{n}^{-1} \| = \infty $. This proves that $ (\bullet)^{-1}: {\text{GL}_{n}}(\mathbb{R}) \to {\text{GL}_{n}}(\mathbb{R}) $ cannot be extended continuously to $ {\text{M}_{n}}(\mathbb{R}) $.
