Restriction of a continuous function is continuous

I am trying to solve this exercise in Tao's analysis text.

Let $$X$$ be a subset of $$\mathbf{R}$$ be a continuous function. If $$Y$$ is a subset of $$X$$, show that the restriction $$f \mid_Y : Y \to \mathbf{R}$$ of $$f$$ to $$Y$$ is also a continuous function.

Here is my attempt at a proof.

Define the inclusion map $$i: Y \to X$$. Since $$f$$ is continuous by assumption, we have \begin{align*} \forall \epsilon > 0, \forall x_0 \in X, \exists \delta > 0, \forall x \in X, |x - x_0| < \delta \implies |f(x) - f(x_0)| < \epsilon. \end{align*} We first show that $$i$$ is continuous on its entire domain. Let $$\epsilon > 0$$. Pick an arbitrary $$y_0 \in Y$$. Then, by continuity of $$f$$, there exists $$\delta$$ such that for any $$y \in Y$$ (which is also in $$X$$), $$|y - y_0| < \delta$$ implies $$|i(y) - i(y_0)| < \epsilon$$. Thus, $$i$$ is continuous. Since the composition of continuous functions is continuous, $$f \circ i$$ is continuous. but $$f \mid_Y = f \circ i$$. Thus, the restriction is also continuous.

How does this look? I worry the proof could be lacking rigor, particularly in explaining why $$i$$ is continuous. All I am trying to say is that the same $$\delta$$ from continuity of $$f$$ should work for $$i$$ since "$$\forall x \in X$$" in the definition of continuity of $$f$$ certainly applies for a subset of $$X$$.

To prove the continuity of the function $$i$$, you should show the existence of a $$\delta \gt0$$ such that the definition of continuity holds. I don't see how the continuity of $$f$$ guarantees such a $$\delta$$ for the continuity of $$i$$.
For the inclusion map, the obvious choice is to take $$\delta =\varepsilon$$. Apart from that, your proof looks fine.
• Thank you for the response. Could you explain a bit more why $\delta = \epsilon$ works? I have tried this, and it seems I would need to prove that $|y - y_0| < \delta = \epsilon$ implies that $|i(y) - i(y_0)| = |x - x_0| < \epsilon$. I am not sure how his follows. It also doesn't seem to use continuity of $f$ (though perhaps that fact isn't needed). – user465188 Jun 23 '19 at 3:33
• $i (y)=y$ for all $y\in Y$. Inclusion map is the identity map restricted to $Y$. – Shivering Soldier Jun 23 '19 at 3:36