I think I have a big confusion in my understanding of smooth manifolds.
Here is the definition of smooth manifolds that I have
Let $M\subset\mathbb{R}^k$, we say that $M$ is a smooth manifold of dimension $m$ if each $x\in M$ has a relative neighborhood in $M$ that is diffeomorphic to some open subset of $\mathbb{R}^m$.
My confusion is the following : I have the feeling that it implies that $m=k$
Here is my reasoning : Let $x\in M$ and denote $W$ a neighborhood of $M$ such that $W\cap M$ is diffeomorphic to some open subset $U\subset\mathbb{R}^m$ through the parametrization $g : U\to g(U)$.
Since $g$ is a diffeomorphism, we can find $V$ an open subset of $\mathbb{R}^k$ such that $g : U\to V$ is a diffeomorphism between open subset of $\mathbb{R}^{m}$ and $\mathbb{R}^k$ but this is well known that this implies that $m=k$
I cannot see where I am wrong but I know that it is the case, if you could provide some helps in order to overcome this misunderstanding please.
One consequence of this is that when I got interested in the tangent space $TM_{x}$, proving that it was a n dimensional vector space was a $2$ lines proof since in my (possible false) setting the derivative at a point of my parametrization $dg_{u}$ is automatically invertible by the chain rule
I am using the following definition of a diffeomorphism : Let $f:X\to Y$ where $X\subset\mathbb{R}^k$ and $Y\subset\mathbb{R}^m$ are open subsets, $f$ is said to be a diffeomorphism if it is an homeomorphism such that $f$ is $C^1$ and its inverse $f^{-1}$ is also $C^1$.