Continuity is a local property: topology, proof 
Consider topological spaces $X, Y$ and $f: X\to Y$, $x\in X$.

*

*Show: if $f$ is continuous in $x\in V\subseteq X$, then $f_{\mid V}: V\to Y$ is continuous in $x$.


*Show: if $f_{\mid V}: V\to Y$ is continuous in $x$ and $V\subseteq X$ is a neighborhood of $x$, then $f$ is continuous in $x$.

My attempt:

*

*Let $U\in\tau_{Y}, f_{\mid V}(x)\in U$. Then $f_{\mid V}^{-1}(U) = f^{-1}(U)\cap V$. I believe that this is an open neighborhood of $x$ in $V$, as $f_{\mid V}(x)=f(x)$, implying $x\in f^{-1}(U)$ and the continuity of $f$ in $x$ implies $f^{-1}(U)\in\tau_X$.


*Let $U\in\tau_Y, f(x)\in U$. The function $f_{\mid V}$ is continuous in $x$ and $f(x)=f_{\mid V}(x)$ (?), so $f_{\mid V}^{-1}(U)$ is an open neighborhood of $x$. Now, I'm stuck and I don't know how to introduce the fact that $V$ is a neighborhood of $x$ and how to go from $f_{\mid V}$ to $f$.
Is my reasoning for the first bullet point correct? Any hints for the second one?
Thanks!
 A: Item 1 looks good.
For item 2: Let us use a simpler definition. $f$ is continuous at $x$ if and only if for every open neighborhood $U$ of $f(x)$ there exists an open neighborhood $W$ of $x$ with $f(W) \subseteq U$.
Proof: Let $U$ be an open neighborhood of $f(x)=f_{|V}(x)$. Then, there exists a neighborhood $\tilde W = W \cap V$ in $V$ of $x$ with $f_{|V}(\tilde W) \subseteq U$ where $W\subseteq X$ is open. As $V$ is open, $\tilde W = W\cap V$ is also open in $X$ and thus $\tilde W$ is also an open neighborhood of $x$ in $X$.
A: Let $f:X \to Y$ be a function between topological spaces, and $x\in X$ a point of $X$. Then you say that $f$ is continuous at $x$ if for every open subset $B$ of $Y$ such that $f(x)\in B$ there exists an open subset $A$ of $X$ such that $f(A)\subseteq B$.
Now suppose that $f$ as above is continuous at $x$ and take an open subset $B$ of $Y$ which contains $f(x)$. You are looking to an open subset $A$ of $V$ such that $f_{|V}(A)\subseteq B$. Since $f$ is continuous at $x$, you know there exists an open subset $A'$ of $X$, containing $x$, such that $f(A')\subseteq B$. Then consider the intersection $A=V\cap A'$. It is an open subset of $V$, because it is the intersection of the subspace $V$ of $X$ with an open subset of $X$, it contains $x$ and for every $y\in V\cap A'$, $f_{|V}(x)=f(x)\in B$. This shows that the restriction of $f$ to $V$ is indeed continuous at $x$.
Conversely, suppose that $f$ restricted to a neighborhood $V$ of $x$ is continuous at $x$. Take an open subset $B$ of $Y$ containing $f(x)$ and seek an open subset $A$ of $X$ containing $x$ such that $f(A)\subseteq B$. Since $f_{|V}$ is continuous at $x$, you know there exists an open subset  $A'$ of $V$, containing $x$, such that $f_{|V}(A')\subseteq B$. But  open subsets of $V$ has the form $A'=V\cap G$, for some open subset $G$ of $X$. If $V$ is open, you are done, with $A=A'$, otherwise you may choose a subset $U$ of $V$ open in $X$ and containing $x$ and take $A=U\cap G$
