Continuity with subspaces 
Let $f:X\rightarrow Y$ be a continuous between topological spaces. Show that the restriction of $f$ to any subspace $A \subseteq X$ is continuous.

I am studying for an exam and the answer to this just says that the solution should be obvious from the definition of continuity, so I wanted to check if this is the right answer:
Suppose Y is open, then since $f$ is continous, X is also open. Then, since $A\subseteq$X, A is also open.
So $f:A\rightarrow Y$ is continuous since the preimage of Y, an open set, is also open.
 A: One possible definition of continuity is the following:
"A function $f:X\rightarrow Y$, where $X$ and $Y$ are topological spaces, is said to be continuous if for every open subset of $Y$, it's preimage by $f$ is open in $X$, i.e., if $V\subseteq Y$ is open (in $Y$), then $f^{-1}(V)$ is open (in $X$)."
In your argument, you only proved that the preimage of a specific open set in $Y$ ($Y$ itself) is open in $A$, which is not sufficient.
Now, let $f:X\rightarrow Y$ be a continuous function and $A\subseteq X$.
In the definition of subspace, a subset $V\subseteq A$ is open in $A$ iff there exists $U\subseteq X$ open in $X$ such that $V=U\cap A$.
Consider the restriction $f|_A:x\in A\mapsto f(x)\in Y$, and let $B$ be an open subset of $Y$. It should be clear that $f|_A^{-1}(B)=f^{-1}(B)\cap A$. Since $f$ is continuous from $X$ to $Y$ and $B$ is open in $Y$ then $f^{-1}(B)$ is open in $X$, hence $f|_A^{-1}(B)$ is the intersection of $A$ with an open subset of $X$, and is therefore open in $A$ (for every open subset of $B$).
We then conclude that $f|_A$ is a continuous function from $A$ to $Y$.
A: Your reasoning is not quite right. The proof goes something like:
Let $Y^\prime\subseteq Y$ be open, then by continuity of $f$, $f^{-1}(Y^\prime)\subseteq X$ is open. Hence $f|_A^{-1}(Y^\prime) = f^{-1}(Y^\prime)\cap A$ is open in $A$ by the definition of the subspace topology.
Thus, since the preimage of any open set under $f|_A$ is open, $f|_A$ is continuous.
