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 $M_1 \subseteq S_1$ be a subset of $S_1$.

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

Let $M_2 \subseteq S_2$ be a subset of $S_2$ such that $f\left[{M_1}\right] \subseteq M_2$.

Let $f \restriction_{M_1 \times M_2}: M_1 \to M_2$ be the restriction of $f$ to $S$.

Then $f \restriction_{M_1 \times M_2}$ is continuous, where both $M_1$ and $M_2$ are equipped with the subspace topology.

Proof
Let $O \in M_2$ be an open set with respect to the subspace topology.

By definition of the subspace topology, $O = U \cap M_2$ for an open set $U \in \tau_2$.

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 M_1$ is open.

But as $f^{-1} \left[{U}\right] \cap M_1 = {f \restriction_{M_1 \times M_2}}^{-1} \left[{O}\right]$ it follows that ${f \restriction_{M_1 \times M_2}}^{-1} \left[{O}\right]$ is open.

Since $O \subseteq M_2$ was an arbitrary open set, $f$ is continuous.