Let $M_1 \subset \mathbb{R}^k$ be a smooth $n_1$-dimensional manifold and $M_2 \subset \mathbb{R}^k$ be a smooth $n_2$-dimensional manifold, such that $M_1 \subset M_2$.
The task is to show that if $M_1$ is relatively open in $M_2$ then $n_1=n_2$.
By definition, since $M_1$ is relatively open in $M_2$, then there is an open set $U \subset \mathbb{R}^k$ such that $M_1 = M_2 \cap U$.
Let $x \in M_1$, then there is an open set $x \in U_1 \subset \mathbb{R}^k$ and a map $r: G \to M_1$ such that $r(G) = M_1 \cap U_1$ and $G \subset \mathbb{R}^{n_1}$ is open.
Now, I get $r(G) = M_2 \cap (U \cap U_1)$ so I want to somehow expand $r$ to be a map of $M_2$, since I need it to be from an open domain $G' \subset \mathbb{R}^{n_2}$, but I don't know how to do it without losing regularity and injectivity.
Moreover, there is a hint that says to show that for every $x \in M_1$ it satisfies $T_xM_1 = T_xM_2$ and then use it somehow.
While I know how to show $T_xM_1 \subset T_xM_2$ by using the definition with curves, but I don't know how to show the other direction and what is the use of it in the solution.
Help would be appreciated.
Open subsets of $M_2$ are exactly those that can be written in the form $U \cap M_2$ where $U$ is an open set of $\Bbb R^k$ . Thus $M_1$ is an open subset of $M_2$ .
From the definition of tangent space at a point, note that $T_x (V)= T_x(M_2) , \forall $ open subsets $V$ of $M_2$ such that $x \in V$ .Thus in our case, $T_x (M_1)=T_x (M_2), \forall x \in M_1$ . Thus $$dim(M_1)=dim(T_x(M_1))=dim(T_x(M_2))=dim(M_2)$$