Show that $f$ is continuous if and only if for each $x \in X$ there is a neighborhood $U$ of $x$ such that $f|U$ is continuous. Useful Definition: $f$ is continuous at $x_o\in X$ if for every $\epsilon >0, \exists \delta = \delta(\epsilon,x_o)<0$ such that if $x \in X$ and $\|x-x_o\|<\delta$ then $\|f(x)-f(x_o)\|<\epsilon$ 
$f$ is continuous if it is continuous for all $x\in X$.
Useful Theorem: $f$ is continuous (on all of $x$) $\iff$ for every open set $V$ in $R^m$, $f^{-1}(V)$ is open in $X$.
Exercise: Let $f:X\rightarrow Y$.  Show that $f$ is continuous if and only if for each $x \in X$ there is a neighborhood $U$ of $x$ such that $f|U$ is continuous.
My attempt:
proof.
($\implies$) Suppose that $f$ is continuous $\forall x\in X$.  Then there exists some open set in $V\subset Y$ such that $U \subset f^{-1}(V)$ where $f^{-1}(V)$ is open. Now since $U$ is a neighborhood it is open (I've proved that neighborhoods are open previously).  So by the Theorem above $f|U$ is continuous.
($\Longleftarrow$) Suppose that for each $x \in X$ there is a neighborhood $U$ of $x$ such that $f|U$ is continuous...
--
I'm not quite sure how to prove the rest of this or whether my first part of the proof was correct.  Any guidance would be appreciated.
 A: I guess this exercise is the exercise 5 in section 3 in chapter 1 on p.30 in "Analysis on Manifolds" by James R. Munkres.
On p.26 in this book, there is the definition of "neighborhood":

If $U$ is any open set containing $x_0$, we commonly refer to $U$ simply as a neighborhood of $x_0$.

My solution is here:

Assume that $f$ is continuous.
For each $x\in X$, we choose $U:=X$.
Then, $U$ is a neighborhood of $x$ and $f=f|U$ is continuous.


Conversely, assume that for each $x\in X$, there is a neighborhood $U$ of $x$ such that $f|U$ is continuous.
Let $x$ be any point in $X$.
Let $V$ be any open set in $Y$ which contains $f(x)$.
By assumption, there is a neighborhood $W$ of $x$ such that $f|W$ is continuous.
Since $(f|W)^{-1}(V)$ is an open set in $W$, there is an open set $U$ in $X$ such that $(f|W)^{-1}(V)=W\cap U$.
Since both of $W$ and $U$ are open sets in $X$, their intersection $(f|W)^{-1}(V)$ is also an open set in $X$ and $(f|W)^{-1}(V)$ contains $x$.
Obviously, $f((f|W)^{-1}(V))\subset V$ holds.
Therefore, $f$ is continuous.

