Dimension of the tangent space in algebraic geometry In my algebraic geometry course, we are studying tangent space and there is something I don't really understand. We define the tangent space as follows.

Let $a \in X$ be an variety. By chosing an affine neighborhood of $a$ we assume that $X \subset \mathbb A^n$ and that $a = 0$ is the origin. Then
$$T_aX = V(f_1:f \in I(X))$$
is the tangent space of $X$ at $a$, where $f_1$ denotes the linear term of $f\in I(X)$.

Thereafter, my teacher said that in the above definition of the tangent space, we had embedded $X$ in $\mathbb A^n$ but there are many other ways to embbed $X$ in some $\mathbb A^k$ and it is not at all obvious that the tangent space has the same dimension in these different embeddings. And then we showed the following statement that gives a definition of the tangent space that is independant of the embedding we chosed.

The tangent space is isomorphic to be the dual space of $I_a/I_a^2$, where $I_a$ is the unique maximal ideal in $\mathcal O_{X, a}$ (the stalk of the regular function at $a$).

Here are my questions: Why does we need this statement to ensure that the dimension of the tangent space do not depend on the embedding ? The tangent space is an affine variety, so it exists on its own and does not depends on any embedding right ? Moreover, as it is a vector space, the dimensons (the "topological" one and the "vector space" one) coincide and the dimension as a vector space is strictly related to the space itself, not on any embedding.. Why isn't the invariance of the dimension obvious ?
 A: Well in your definition the tangent space is constructed from an embedding of $X$, so there is no guarantee that the tangent space that is constructed from another embedding is isomorphic to this one.
A: You are thinking of the tangent space as a geometric object where it is obviously intrinsic. But neither definition here, extrinsic (linear terms of the ideal) or intrinsic (quotient of maximal ideal by its square), is clearly connected to this object (nor is it intuitively clear what this thing should even be over fields other than $\mathbb R$ and $\mathbb C$).
So what you are really proving is that the dimension of "the thing cut out by the linear terms" does not depend on the presentation as a subset of affine space, which is not at all clear given that you can e.g. for any $n > 1$ embed $\mathbb A^1 \to \mathbb A^n$ as a curve of arbitrary degree.
A: Question: "Why does we need this statement to ensure that the dimension of the tangent space do not depend on the embedding?"
Answer: If $X:=V(I) \subseteq \mathbb{A}^n_k$ where $I \subseteq k[x_1,..,x_n]$ is your variety and if $X :=V(J) \subseteq \mathbb{A}^m_k$ with $J\subseteq k[y_1,..,y_m]$ it follows you have two embeddings
$$i: X \rightarrow \mathbb{A}^n_k\text{  and  }j: X \rightarrow \mathbb{A}^m_k$$
You get two definitions of the tangent space $T_x(X)$ at $x$: One using $I$ and one using $J$. Denote these two spaces by $T^I_x(X)$ and $T^J_x(X)$.
Example: Let $f(x,y):=x^2+y^2-1$ and let $I:=(f) \subseteq k[x,y]$. Let $p:=(1/\sqrt{2},1/\sqrt{2})\in S:=V(I)$ and make the change of coordinates
$$x:=u+1/\sqrt{2}, v:=y+1/\sqrt{2}$$
to get
$$f(u,v)=\sqrt{2}(u+v)+u^2+v^2$$
with $f^*:=\sqrt{2}(u+v)$. Let $I^*:=(f^*)=(u+v)\subseteq k[u,v]$. Define $C_p(S):=Spec(k[u,v]/I^*)$. With this construction you have made a coordinate
change and in the new coordinates $u,v$ it follows the original point $p$ corresponds to the origin $(0,0)$ and $C_p(S)$ is the "tangent line" of $S$ at $p$ viewed as an algebraic variety/scheme. There is an isomorphism
$$C_p(S) \cong Spec(k[t])\cong \mathbb{A}^1_k$$
since $k[u,v]/(u+v) \cong k[t]$ is an isomorphism of rings: map $t$ to the class of $u$ or $v$.
You may check that there is an isomorphism $\mathfrak{m}/\mathfrak{m}^2 \cong k\{t\}$ when $\mathfrak{m}:=(x-\frac{1}{\sqrt{2}}, y-\frac{1}{\sqrt{2}})$. Hence $Sym_k^*((\mathfrak{m}/\mathfrak{m}^2)^*) \cong k[x]$ with $x:=t^*$ the dual basis. Hence
$$Spec(Sym_k^*(\mathfrak{m}/\mathfrak{m}^2)^*)) \cong \mathbb{A}^1_k \cong C_p(S).$$
Note: You have defined the tangent space $T^I_x(X)$ as an algebraic "variety".
Given any vector space $V$ of dimension $n$ over $k$, we define the "affine space of $V$" (scheme theoretically) as
$$\mathbb{A}^n(V):=Spec(Sym_k^*(V^*)).$$
If $V:=k\{e_1,..,e_n\}$ is a basis for $V$ and $x_i$ the dual basis it follows
$Sym_k^*(V^*) \cong k[x_1,..,x_n]$ hence $Spec(Sym_k^*(V^*)) \cong \mathbb{A}^n_k$ is affine $n$-space over $k$.
When your lecturer says
"The tangent space is isomorphic to be the dual space of Ia/I2a, where Ia is the unique maximal ideal in OX,a (the stalk of the regular function at a)."
he means there is an isomorphism
$$T_a^I(X) \cong Spec(Sym_k^*(I_a/I_a^2)).$$
There cannot be an "isomorphism" $T_a^I(X) \cong (I_a/I_a^2)^*$ since $T_a(X)$ is an"algebraic variety" and $(I_a/I_a^2)^*$ is a $k$-vector space.
Since the local ring $\mathcal{O}_{X,x}$ is independent of embedding you get using this construction isomorphisms (let $I_a:=\mathfrak{m}_x$)
$$T^I_x(X) \cong Spec(Sym_k^*((\mathfrak{m}_x/\mathfrak{m}_x^2)^*)) \cong \mathbb{A}^d_k \cong T^J_x(X)$$
since $\mathfrak{m}_x/\mathfrak{m}_x^2$ has dimension $d$ over $k$.
It follows the two "tangent spaces" are isomorphic.
Question: "Why isn't the invariance of the dimension obvious?"
Answer: The definition of $T^I_x(X)$ involves the ideal $I$. It is not immediate that there is an isomorphism $T^I_x(X) \cong T^J_x(X)$.
Again: Mumford's book "The red book of varieties and schemes" devotes much space to explaining definitions in algebraic geometry. There is an intuitive explanation of the definition of the tangent space and tangent cone.
