Set of singular points of a normal variety. In my algebraic geometry course these result appeared:
If X is a normal variety, then the set of singular points $S$ have codimension $\geq 2$.
(Here normal means that $\mathcal{O}_x$ is integrally closed for all $x\in X$)
I've read many proofs of this fact in books and I understood them. However my teacher said that it was a ''fairly easy exercise'' and gave us three steps to do it:

*

*Consider the case when $S$ has an irreducible component $Y$ of codimension 1, defined by an equation in $X$

*Let $Y$ an afine subvariety of $X$ with $\text{codim}(Y)=1$. Prove that $\mathcal{O}_Y$ is a discrete valuation ring, and hence the maximal ideal of $\mathcal{O}_Y$ is principal.

*Prove the general case using 1. and 2.

I'm trying to find a conection with these and the proofs I've found in the books, but I don't see it. If I can get some help on how to aproach this exercise in this particular proof I'll be very grateful. (Although my teacher said it was not a dificult exercise, it does not look easy for me)
Edit: My problem is that most books solve it in a short way but using plenty of previous results. What I am looking (if possible, I don't know if this exists) is a complete proof without refering to any strong result. I have a nice background on commutative algebra and abstract algebra in general, but very little knowledge about algebraic geometry (I've recently started to study it). So I am looking for a proof using commutative algebra methods. Of course, I dont want you to do all the work, I will be very happy with just an sketch of the proof, to make me think a bit and complete the gaps.
Edit: This is my attempt, if you can help me to complete/correct it:

*

*Let $Y=V(f)$ and $y\in Y$ a point which is non-sigular as a point of $Y$ (this is posible since the set of singular points of a variety is proper). If we show that $y$ is non-singular as a point of $X$ we are done. Let us denote by $m_{X,y}$, the maximal ideal of the local ring of $X$ at $y$ (same with $m_{Y,y}$). If $f_1,\dots,f_n$ is a basis for $m_{Y,y}/m_{Y,y}^2$, then $f,f_1,\dots,f_n$ is a basis for $m_{X,y}/m_{X,y}^2$ and this proves that $y$ is non-singular, contradiction.


*The definition I'll use for DVR is Noetherian, dim 1, local and integrally closed. $\mathcal{O}_Y$ is known to be local, and it is integrally closed because $X$ is normal. Also, since it is the localization of a noetherian ring it is noetherian. But I don't know how to prove that it has dimension 1.


*No ideas for this step. I guess that using 2. I should be able to prove the existence of a component $Y$ as in 1, but don't know how to start.
 A: To answer 2,
When $X$ is affine (and irreducible) and $Y$ is an affine (and irreducible) subvariety of $X$, then you can check that $\mathcal O_Y$ is isomorphic to $A(X)_{I(Y)}$ (localization) and therefore, it is a noetherian domain, it is integrally closed because $A(X)$ is integrally closed. Using the famous formula $\dim A = \dim A_{\mathfrak p} + \dim A/\mathfrak p$, we have $$\dim \mathcal O_Y = \dim A(X) - \dim A(X)/I(Y) = \dim X - \dim Y =1$$
So we get that it is a DVR.
To answer 3,
I keep notation as above, and use $S = A(X) \setminus I(Y)$.
$X$ can be covered by open affine sets $X_j$, and $S$, which is a closed subset of $X$, has a (closed) irreducible component $Y$ of codimension 1. Therefore, one of the $X_j \cap Y$ is a closed subvariety of $X_j$ of codimension 1. This reduces to the second question. Now, we have $S^{-1}I(X)$ is generated by $(f/1)$.

Maybe you were expecting to get $I(X) = (f)$, but this is not always the case, because $A(X)$ is not a UFD, it is only integrally closed. Recall that a domain is a UFD iff every prime ideal of height 1 (like I(X)) is principal

Let $g_1, \ldots, g_n$ be generators of $I(X)$. Then, since $A(X)$ is a domain, there are $s_1, \ldots, s_n \in S$ and $a_1, \ldots a_n \in A(X)$ such that $s_j g_j = a_jf$.
Now let $U = X \setminus Z(s_1, \ldots , s_n)$. Then $U \cap Y$ is a subvariety of codimension 1 again, but it is defined as $Z(f)$, because in the ring of regular functions $k[U]$, $s_1, \ldots , s_n$ are invertible, and so you can apply the argument in 1.
If there is any concern about wether all this reduction makes you lose some generality, note that the singular set of $X$, intersected with $U$ is equal to the singular set of $U$ whenever $U$ is open, because being a singular point is an open condition.
I have tried to explain you this in the best way. I think that most steps are quite standard. Maybe the unexpected part is was how to get a hypersurface after knowing that $\mathcal{O}_Y$ is a DVR.
