A submanifold of a submanifold is a submanifold is the ambient space. Definition: Let $X$ be a manifold and $Y \subset X$. We say that $Y$ is a submanifold of $X$ if for every $y \in Y$, there exists some chart $(U, \phi)$ and $p \leq n$ such that $\phi(U \cap Y) = \phi(U) \cap (\mathbb{R}^p \times \{0\}^{n - p})$ where $n$ is the dimension of $X$.
Given this definition, I'm trying to prove that if $Z' \subset Z \subset X$ such that $Z'$ is a submanifold of $Z$ and $Z$ is a submanifold of $X$, then $Z'$ is a submanifold of $X$.
So far I've been quite unsuccessful, though I've come up with reasonable arguments but far from being rigorous. Any help greatly appreciated.
 A: Let $Y$ be a submanifold of $X$ and let $Z$ be a submanifold of $X$. Let $n , m , l \in \mathbb{N}$ and we suppose that $X$ is a $n$-dimensional differentiable manifold, $Y$ is a $m$-dimensional differentiable manifold and $Z$ is a $l$-dimensional differentiable manifold. Let $p \in Z \subset Y \subset X$. The rangs of the inclusions
$$
j : Y \to X \qquad \mbox{ and } \qquad k : Z \to Y
$$
in $p$ have to be $m$ and $l$, respectively, and we will see that the rang of $i = j \circ k : Z \to X$ is less or equal to $l$ and we will be done, as $l \leq m \leq n$.
On the one hand, we know that there exist a chart $(U , \varphi)$ in $X$, with $p \in U$, and a chart $(V_1 , {\psi}_1)$ in $Y$, with $p \in V_1$, such that
$$
rg(d{(\varphi \circ j \circ {\psi}_1^{- 1})}_{{\psi}_1(p)}) = n\mbox{.}
$$
On the other hand, we know that there exist a chart $(V_2 , {\psi}_2)$ in $Y$, with $p \in V_2$, and a chart $(W , \phi)$ in $Z$, with $p \in W$ such that
$$
rg(d{({\psi}_2 \circ k \circ {\phi}^{- 1})}_{\phi(p)}) = l\mbox{.}
$$
Let $V = V_1 \cap V_2$ and $\psi = {\psi}_1\big|_V$. Using the chain rule,
$$
d{(\varphi \circ i \circ {\phi}^{- 1})}_{\phi(p)} = d{(\varphi \circ j \circ {\psi}^{- 1} \circ \psi \circ k \circ {\phi}^{- 1})}_{\phi(p)} =
$$
$$
= d{(\varphi \circ j \circ {\psi}^{- 1})}_{\psi(p)} d{(\psi \circ k \circ {\phi}^{- 1})}_{\phi(p)}\mbox{.}
$$
Then
$$
rg(d{(\varphi \circ i \circ {\phi}^{- 1})}_{\phi(p)}) = rg(d{(\varphi \circ j \circ {\psi}^{- 1})}_{\psi(p)} d{(\psi \circ k \circ {\phi}^{- 1})}_{\phi(p)}) \leq l
$$
because the rang of the product of two matrix is less or equal to the rang of both rangs.
