# About the tangent cone and tangent space of an affine variety

Let $$X\subset \mathbb{A}^n$$ be an affine variety then $$X= Z(I)$$ is the zero locus of the ideal $$I$$. In general the tangent cone at $$0$$ is define as $$TC= Z(I^{in})$$ where $$I^{in}$$ is the initial ideal and $$TS= Z(I^{lin})$$ is the tangent space. If $$I=(f)$$ then it's easy compute tangent space and cone in fact $$I^{in}=(f^{in})$$ and $$I^{lin}= (f^{lin})$$. My question is : if the Ideal $$I$$ is not principal there is a general way to compute the initial ideal and the linearization. Because for $$TS$$ in general I can use the definition $$TS= \sum_i \frac{\partial f_j}{\partial x_i}f(p)(x_i-p)=0$$ but for the tangent cone? If the ideal I is homogeneus $$I^{in}=I$$? And if it is homogeneus of degree >1 $$I^{lin}=0$$? Thanks for the clarifications!

If $$0\in Z(I)$$, you always have $$(f_1,\dots,f_m)^{\text{lin}} = (f_1^{\text{lin}},\dots,f_m^{\text{lin}})$$ (this is why it agrees with doing the partial derivative thing), which is pretty easy to prove (each $$f_i$$ has no constant term, and if you write out a generic element of $$I$$, its linear term will pretty clearly be a combination of the linear terms of the $$f_i$$). And so, for your other question, yes -- if all $$f_i$$ have degree at least 2, then $$I^{\text{lin}} = 0$$ (also because all partial derivatives at $$0$$ are equal to $$0$$).
And yes, if $$I$$ is homogeneous, then $$I^{\text{in}} = I$$: for any $$f\in I$$, we have that the homogeneous component $$f^{\text{in}} \in I$$, too, and conversely if $$g\in I^{\text{in}}$$, then it's the lowest-degree term of some $$f\in I$$, so it's also in $$I$$ since it's a homogeneous component of $$f$$.
As for the question of how to compute $$I^{\text{in}}$$ in general, I'm not so sure, and I would even guess that there's not a good algorithm. I think you could basically use Buchberger's algorithm, but it would require you to be able to find LCMs/GCDs of multivariate polynomials (which you can probably do by hand for simple examples, so it might still be useful). I'm not really making a claim about this -- I just don't know of a good way to do it. Basically, you keep trying to cancel out the lowest degree terms using pairs of polynomials until you can't do so (nontrivially) anymore.
Take this example from Section 4g of J.S. Milne's AG notes. Consider $$I=(xy,xz+z(y^2-z^2))$$. We have that $$-z(xy)+y(xz+z(y^2-z^2)) = yz(y^2-z^2) \in I$$, but $$yz(y^2-z^2)\notin(xy,xz)$$, and actually $$I^{\text{in}} = (xy,xz,yz(y^2-z^2))$$. You see how we found the GCD of the two initial terms of the generators to make them cancel 'minimally', then added the leading term of the resulting polynomial to our list of generators for the initial ideal. We keep a list of all the polynomials we encountered, too (not just their leading terms, which we keep as generators for the initial ideal). Now that we added this one, we check if any of the new pairs in the list of whole polynomials have nontrivial GCDs and repeat. In this case, the algorithm ends here, because repeating the process yields no new initial terms. This algorithm definitely terminates, by the Noetherianness of the polynomial ring, and I think it also gives you a full list of generators for the initial ideal.