Trying to prove the equivalence of two notions of a tangent space of a scheme I am going the proof of: Let $X$ be a scheme of finite type over $k$, $x \in X$ is a closed point.
The following two $k$-vector spaces are canonically isomorphic.

*

*$T_x = \hom_{k}(\mathfrak{m}_x/\mathfrak{m}_x^2, k)$


*The space of derivations $D: O_{X,x} \to k$ over $k$.
The direction 1) to 2) of the proof I can follow.
For the other direction he defines a map from 2) to 1) as follows.
Given $\ell: \mathfrak{m}_x/ \mathfrak{m}_x^2 \to k$, define $D$ by
$$
D(f) := \ell[f - f(x)]
$$
and this is supposed to be a derivation. I am not seeing how this $D$ is well defined... Can someone clarify this please? Thank you
 A: $\require{AMScd}$
To check that $D$ is well-defined, the only thing you really need to check is that $f - f(x)\in\mathfrak{m}_x.$ Indeed, $D$ is defined by taking the class of $f - f(x)$ in $\mathfrak{m}_x/\mathfrak{m}_x^2$ and applying $\ell$ to it. Observe that there's no choice involved here! You're not using the representative $f - f(x)$ to define the map, you're using the class of $f - f(x)$ itself.
Issues of being well-defined usually arise in situations like the following. Suppose you have a quotient map of rings $\pi : R\to R/I,$ and suppose you have a ring map $f : R\to S.$ You can try to define a map $\overline{f} : R/I\to S$ by the formula $\overline{f}(r + I) := f(r),$ but this in general will depend on the choice of representative $r$ of the coset $r + I.$ So, in a situation like this, you need to check that $f(r) = f(r')$ for any two $r,r'\in R$ such that $r - r'\in I.$ This amounts to showing that the map $f$ sends every element of $I$ to $0.$ (In fact, this is the universal property of the quotient $R/I$: any map $f : R\to S$ such that $f$ maps every element of $I$ to $0$ descends uniquely to a map $\overline{f} : R/I\to S$ making the diagram
$$\begin{CD}
R @>\pi>> R/I\\
@VfVV @VV\overline{f}V\\
S @>\operatorname{id}>> S
\end{CD}$$
commute.
However, if on the other hand you have a quotient map of rings $\pi : R\to R/I$ and you have a map $f : R/I\to S,$ there's a natural way to get a map $R\to S$ -- simply compose the two! You can always form the composition
$$
R\xrightarrow{\pi} R/I\xrightarrow{f} S
$$
without worrying about issues of being well-defined, since composition of ring maps is always well-defined.
In your situation, you have a map $\ell : \mathfrak{m}_x/\mathfrak{m}_x^2\to k$ from the quotient, and you're making a new map by starting with an element of $\mathfrak{m}_x,$ looking at its image under the canonical map $\mathfrak{m}_x\to\mathfrak{m}_x/\mathfrak{m}_x^2$, and then applying $\ell.$ This is perfectly legal!
So, to see that $f - f(x)\in\mathfrak{m}_x,$ observe first that because $X$ is a $k$-scheme and $x$ is a closed point, you have a canonical map $\pi : \mathcal{O}_{X,x}\to\mathcal{O}_{X,x}/\mathfrak{m_x}\cong k.$ Moreover, this map comes with a canonical section $\sigma : k\to\mathcal{O}_{X,x};$ that is, we have $\pi\circ\sigma = \operatorname{id}_k.$
The second thing we need to note is that $f(x)$ is simply the image of $f$ under the composition $$\mathcal{O}_{X,x}\xrightarrow{\pi}k\xrightarrow{\sigma}\mathcal{O}_{X,x}.$$
Now, we proceed to make sense of the construction. We can compute
\begin{align*}
\pi(f - f(x)) &= \pi(f - \sigma\circ\pi(f))\\
&= \pi(f) - \pi\circ\sigma\circ\pi(f)\\
&= \pi(f) - \operatorname{id}\circ\pi(f)\\
&= \pi(f) - \pi(f)\\
&=0.
\end{align*}
Thus, $f - f(x)$ does in fact lie in $\mathfrak{m}_x = \ker(\pi).$
