Problem:
Let $f:X\rightarrow Y$ be a map. $f:X\rightarrow Y$ is continuous $\iff$ $f:X\rightarrow f(X)$ is continuous
My attempt: Forward Direction: Suppose $f:X\rightarrow Y$ is continuous. Let $V$ be open in $f(X)$, so $V=U\cap f(X)$, where $U$ is open in $Y$. Then $f^{-1}(V)=f^{-1}(U\cap f(X))$ $=$ $f^{-1}(U)\cap X =f^{-1}(U)$, which is open in $X$, since $f$ is continuous.
Backwards Direction: Suppose $g$ $:$ $X\rightarrow f(X)$ is continuous where $g(x)=f(x)$ for each $x\in X$. Let $V$ be open in $Y$. So $V\cap f(X)$ is open in $f(X)$. Hence $g^{-1}(V\cap f(X))$ is open in $X$. But $g^{-1}(V\cap f(X))$ $=$ $f^{-1}(V\cap f(X))$ $=$ $f^{-1}(V)\cap X=f^{-1}(V)$. Thus $f : X\rightarrow Y$ is continuous.
Is my attempt correct? (Please answer this first)
Yes, this is correct. Slick proof: the standard embedding $i: f[X] \to Y$ defined by $i(x)=x$ is initial. So $f: X \to f[X]$ is continuous iff $i \circ f$ is continuous.