Subset Topology
A SUBSET BORROWS ITS OPEN SETS
A subset does not arrive with a topology of its own. It borrows one: intersect every open set of the surrounding space with the subset, and those intersections are its open sets. One of them can be open in the subset while failing to be open in \(M\).
The definition
Let \((M, \mathcal{O}_M)\) be a topological space and let \(S \subseteq M\). The subset topology on \(S\) is:
\[ \mathcal{O}\vert_S := \{\, U \cap S \mid U \in \mathcal{O}_M \,\}. \]
The collection really is a topology
\(\emptyset = \emptyset \cap S\) and \(S = M \cap S\), so both are open in \(S\). If \(A = \widetilde{A} \cap S\) and \(B = \widetilde{B} \cap S\) for open \(\widetilde{A}, \widetilde{B}\), then \(A \cap B = (\widetilde{A} \cap \widetilde{B}) \cap S\), and unions go the same way over any family at all: \(\bigcup_\alpha (\widetilde{U}_\alpha \cap S) = \left(\bigcup_\alpha \widetilde{U}_\alpha\right) \cap S\). Intersecting with \(S\) commutes with both operations.
Open in the subset is a different question from open in the whole
Take \(M = \mathbb{R}\) with its standard topology and \(S = [0,1]\). Then \(\left(-\tfrac{1}{2}, \tfrac{1}{2}\right) \cap S = \left[0, \tfrac{1}{2}\right)\), so \(\left[0, \tfrac{1}{2}\right)\) is open in \(S\).
It is not open in \(\mathbb{R}\): at \(0\) every \((-r,\, r)\) holds negative numbers, and the set holds none. Inside \(S\) the same test asks only for \((p-r,\, p+r) \cap S\), which at \(0\) is \([0,\, r)\) and does lie inside.
One direction never needs a hypothesis: a subset of \(S\) that is open in \(M\) is its own intersection with \(S\), so it is open in \(S\) too. The other direction is what can fail, and where \(S\) is itself open in \(M\) it does not, since \(U \cap S\) is then an intersection of two open sets of \(M\).
Why this inheritance and not another
Let \(f : M \to N\) be continuous and \(f\vert_S\) the same map with its domain cut down. For open \(V \subseteq N\), a point of \(S\) lands in \(V\) under \(f\vert_S\) exactly when it does under \(f\), so the preimages agree up to the cut:
\[ \mathrm{preim}_{f\vert_S}(V) = \mathrm{preim}_f(V) \cap S, \]
which is an open set of \(M\) intersected with \(S\), so open in \(S\). Restriction never costs continuity.
Nor would anything smaller serve. If a collection \(\mathcal{C}\) on \(S\) leaves every restriction continuous, apply that to the identity \(M \to M\): its restriction sends each point of \(S\) to itself, so \(U \cap S\) must lie in \(\mathcal{C}\) for every open \(U\), which is all of \(\mathcal{O}\vert_S\).
The target can be cut down to the image
The image of \(f\) is \(f(M) := \{\, f(p) \mid p \in M \,\}\), the part of the target actually reached. Give it the subset topology from \(N\). Its open sets are the intersections \(V \cap f(M)\), and every point of \(M\) is sent into \(f(M)\), so \(\mathrm{preim}_f(V \cap f(M)) = \mathrm{preim}_f(V)\).