I want to prove (or find a counterexample) of the following intuitive idea.
Hypothesis
Let $X$ and $Y$ be two topological spaces, and let $A$ be a subspace of $X$ and $f:A\rightarrow Y$. If there exists a $g:X\rightarrow Y$ that is continuous and satisfies $g(x)=f(x)$ for all $x\in A$, then $f$ is continuous.
My guess is that, if it is true, then this is almost a trivial fact for someone thoroughly initiated in topology. It's definitely not trivial for me, but is just an intuitive idea.
The idea is that if a function's domain is living in some parent space, and that function can be continuously extended to the parent space, then that original function is continuous, in the topological subspace sense. The simple example is that one can draw interesting "disconnected" piece-wise functions on the real line so that all the pieces can be connected to make a continuous function, then the original function is in fact continuous. This fact is often difficult for students to grasp in introductory topology or analysis.
Example:
Consider $f:\{0\}\cup[1,2]\rightarrow\mathbb R$ defined by
$$f(x)=\begin{cases}
0 & \text{ for } x=0\\
1 & \text{ for } x\in[1,2]\\
\end{cases}$$
then $f$ is continuous (with the standard topology), even though its graph looks discontinous (because we can see the "in-between" space that doesn't exist as far as $f$ is concerned). This is a typical motivating example for me. As an introductory student should be able to more easily see that such an extension is continuous.
Alternatively, when the left and right limits at a point don't match up, there is no way to continuously connect them while keeping the property of being a function. E.g. $$f(x)=\begin{cases} 0 & \text{ for } x\in[0,1)\\ 1 & \text{ for } x\in[1,2]\\ \end{cases}$$ cannot be continuously extended to all of $\mathbb R$ (with the standard topology).
Attempt at proof of hypothesis:
We need to show that for an arbitrary open set $V\subset Y$, that $f^{-1}(V\cap f(A))=U\cap A$ where $U$ is open in $X$. We have that
$$\begin{aligned}
f^{-1}(V\cap f(A))&=f^{-1}(V)\cap f^{-1}(f(A)) \\
&=(g^{-1}(V)\cap A)\cap A \\
&=g^{-1}(V)\cap A.
\end{aligned}$$
The first line is justified by the fact that if $x\in f^{-1}(V\cap f(A))$ then $f(x)\in V$ and $f(x)\in f(A)$ so $x\in f^{-1}(V)\cap f^{-1}(f(A))$. We also have that $x\in A$ since $A$ is the domain of $f$ by definition. This also gives $f^{-1}(f(A))=A$ (the pre-image of the range is the domain). Furthermore $x\in f^{-1}(V)$ means that both $x\in A$ (the domain of $f$) and hence that $g(x)=f(x)\in V$. This gives us that $x\in g^{-1}(V)\cap A$ which shows the second line. The third line is trivial.
Thus let $U=g^{-1}(V)$ which is open by continuity of $g$. So $f^{-1}(V\cap f(A))$ is equivalent to an open set intersected with $A$ which is the definiton of being open in a subspace. $_\blacksquare$
My questions are:
- Is this proof correct? If not, where am I going wrong?
- If so, I assume this a standard result, and can someone provide a reference for it?
I found this MathSE post after typing this up which shows that a restriction of a continuous function is continuous. The proof is identical in essence, but I'm just looking at the problem in the other direction as extending a function rather than restricting it. Either way, I would still like a reference where this is either a proven result, stated as fact, or given as an exercise or so.