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 $M_1 \times M_2$.

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

Proof
Let $V \subseteq M_2$ be an open set with respect to the subspace topology of $M_2$.

By definition of the subspace topology, $V = 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 with respect to the subspace topology of $M_1$.

As $f^{-1} \left[{U}\right] \cap M_1 = {f {\restriction_{M_1 \times M_2}}}^{-1} \left[{V}\right]$ it follows that ${f {\restriction_{M_1 \times M_2}}}^{-1} \left[{V}\right]$ is open with respect to the subspace topology of $M_1$.

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