Restriction of Continuous Mapping is Continuous/Topological Spaces

Theorem
Let $T_1 = \left({S_1, \tau_1}\right)$ and $T_2 = \left({S_2, \tau_2}\right)$ be topological spaces.

Let $S \subseteq S_1$ be a subset of $S_1$.

Let $f: S_1 \to S_2$ be a mapping which is continuous.

Let $f \restriction_S: S \to S_2$ be the restriction of $f$ to $S$.

Then $f \restriction_S$ is continuous, where $S$ is equipped with the subspace topology.

Proof
Let $U \in \tau_2$ be an open set.

We have that:

By definition of continuous mapping, $f^{-1} \left[{U}\right]$ is open in $T_1$.

By definition of subspace topology, $f^{-1} \left[{U}\right] \cap S$ is open.

But as $f^{-1} \left[{U}\right] \cap S = {f \restriction_S}^{-1} \left[{U}\right]$ it follows that ${f \restriction_S}^{-1} \left[{U}\right]$ is open.

Since $U$ was arbitrary, $f$ is continuous.