Let $X \subseteq \mathbb{P}_k^n$ be a smooth projective variety over $k$ algebraically closed. What is $\text{dim}_k(\mathcal{O}_{X, x}/m_x^2)$? This is part of Hartshorne's proof of one of Bertini's theorems (II.8.18). There are a couple of points in the proof here that I do not understand. Denote  $V = \Gamma(\mathbb{P}^n, \mathcal{O}(1))$.
First, we let $x \in X$ be a closed point and fix some linear form $f_0 \in V$ so that $x$ is not in the hyperplane determined by $f_0$. Put succinctly, $x \in D_+(f_0)$. Denote $\varphi_x:V \to \mathcal{O}_{X,x}/m_x^2$ to be the natural map introduced in the book.
Explicitly, $\varphi_x$ can be understood to be a composition of restrictions and trivializations. On $D_+(f_0)$, we know $\mathcal{O}(1)$ is trivialized by $f \mapsto f/f_0$ so we just do this and restrict to $X$, and then to $x \in D_+(f_0) \cap X$.
The claims I am unsure about are the following. First, it is claimed that $\varphi_x$ is surjective since $m_x$ is generated by linear forms given that $x$ is closed. Second, it is claimed that $\dim_k \mathcal{O}_{X,x}/m_x^2 = \dim X + 1$.
My confusion stems from the fact that this only shows that $\varphi_x$ is surjective onto $m_x$, and not necessarily on the whole of $\mathcal{O}_{X,x}/m_x^2$. Why does $\varphi_x$ also map to all the functions outside of $m_x$?
For the second fact, the assumption that $X$ is smooth we have that $\dim_k m_x/m_x^2 = \dim X$ so why does adding the rest of $\mathcal{O}_{X,x}$ only add one dimension? My guess is that we have an exact sequence $$0 \to m_x/m_x^2 \to \mathcal{O}_{X, x}/m_x^2 \to \mathcal{O}_{X,x}/m_x \to 0$$ by the third isomorphism theorem, and the fact that $\mathcal{O}_{X,x}/m_x = k$ as a closed point, but I'm not really sure if this works.
Thanks very much!
 A: *

*$f_0\mapsto f_0/f_0=1$, and any function in $\mathcal{O}_{X,x}/\mathfrak{m}_x^2$ is the sum of a constant function and a function in $\mathfrak{m}_x/\mathfrak{m}_x^2$.

*Yes, your exact sequence is precisely the right way to show this. (Your justification that the residue field at $x$ is $k$ should also have the fact that $k$ is algebraically closed in it - in general, if $x$ is a closed point in a finite-type scheme over a field $k$, then the residue field at $x$ is a finite extension of $k$, and adding that $k$ is algebraically closed means that this is exactly $k$.)

A: In a sense, modding out by $m_x^2$ means that two functions are equal if they have the same zeroth and first derivatives. Functions in $m_x$ are functions where the zeroth derivative is zero ($f(x) = 0$). Functions in $m_x^2$ are functions whose zeroth and first derivatives at $x$ are $0$.
For instance, let $m = (x, y, z)$ inside $k[x,y,z]$ corresponding to the point $(0, 0, 0) \in \operatorname{Spec}k[x,y,z]$.
Next, I want to look at the local ring $\mathcal{O} = k[x,y,z]_m$ but not inside the fraction field $k(x,y,z)$ but rather I want to take Taylor series. So I am going to embed $\mathcal{O} \subset k((x,y,z))$ via Taylor series expansion.
In this way, $\mathcal{O}$ corresponds to Taylor series with no negative powers of $x, y, z$, i.e. $\mathcal{O} \subset k[[x,y,z]]$. Then $\mathcal{O}/m$ corresponds to Taylor series where $x, y, z \equiv 0$, so just constants. Likewise $\mathcal{O}/m^2$ corresponds to Taylor series where all the second order terms are zero.
