TITLE: Dimension of affine scheme
QUESTION [5 upvotes]: I'm reading Eisenbud's "Geometry of Schemes" now. In the book, dimension of a scheme $X$ is defined by supremum of local dimension $\dim(X, x)$, where $\dim(X, x)$ is Krull dimension of stalk $\mathcal{O}_{X, x}$. Also, $x$ is "singular " if local dimension is strictly smaller than dimension of Zariski (co)tangent space $\mathfrak{m}_{X,x}/\mathfrak{m}_{X, x}^{2}$ over residue field $k(x)=\mathcal{O}_{X, x}/\mathfrak{m}_{X, x}$. 
Intuitively I understand these definitions, but it was hard for me to compute these. For example, a circle $$X=\mathrm{Spec}\mathbb{R}[x, y]/(x^{2}+y^{2}-1)$$ would be nonsingular at all point, especially at $(x-1, y)\in X$. I think that local dimension and dimension of Zariski (co)tangent space will be same as 1, but I failed to compute these. Actually, I can't even convince that residue field at $p=(x-1, y)$ is $\mathbb{R}$. 
Also, I think that if we consider union of line and circle, $$Y=\mathrm{Spec}\mathbb{R}[x, y]/(y(x^{2}+y^{2}-1))$$ then the point $p$ will be singular and $\dim (Y, p)=1, \dim_{k(p)}\mathfrak{m}_{Y,p}/\mathfrak{m}_{Y, p}^{2}=2$. Are there any concrete algorithms to compute these?

REPLY [2 votes]: a) The circle $X$ is the variety associated to the ring $A=\mathbb{R}[X,Y]/(X^{2}+Y^{2}-1)=\mathbb{R}[x, y]$.
At the point $p=(1,0)$ its local ring is $\mathcal O_{X,p}=A_{(x-1,y)}=\mathbb R[x-1,y]_{(x-1,y)}$, a discrete valuation ring (with uniformizing parameter $y$) and thus regular of Krull dimension $1$.
The residue field at $p$ is $k(p)=\mathcal O_{X,p}/\mathfrak m_p=\mathbb R$ and the cotangent space to $X$ at $p$ is the $\mathbb R$- vector space  $\mathfrak m_p/\mathfrak m_p^2=\mathbb R.\overline {x-1}+\mathbb R.\overline y=\mathbb R.\overline y$, which has $\mathbb R$-dimension $1$.
[I have used that $\overline {x-1}=\bar 0\in \mathfrak m_p/\mathfrak m_p^2$ since $x-1=-\frac {y^2}{x+1}\in \mathfrak m_p^2$ ]
b) The variety $Y$ is associated to the ring $B=\mathbb{R}[X,Y]/(Y(X^{2}+Y^{2}-1)=\mathbb{R}[\xi, y]$, where we replaced the variable $x$ by $\xi=x-1$, so that $y(\xi^2+2\xi+y^2)=0$ in $B$ .
Now $\mathfrak m_p=(\xi,y)\subset B_{(\xi,y)}=\mathcal O_{Y,p}$ and the cotangent space to $Y$ at $p$ is $\mathfrak m_p/ \mathfrak m_p^2=\mathbb R.\bar\xi+\mathbb R.\bar y$ .   
It has $\mathbb R$-dimension $2$ since $\bar\xi,\bar y$ are linearly independant because $y(\xi^2+2\xi+y^2)$ has no linear term.