[proofplan]
We prove the criterion pointwise. At a point $p\in X$, the local ring of $X$ is the hypersurface quotient of the regular local ring $\mathcal O_{\mathbb A_k^n,p}$. The Zariski tangent space is the kernel of the linear form obtained by evaluating the first partial derivatives of $f$ at $p$, so a nonzero gradient gives the expected tangent dimension $n-1$ and hence regularity. Conversely, if all first partial derivatives vanish at $p$, then the defining equation has no linear term in the maximal ideal of the ambient regular local ring, so the hypersurface quotient has embedding dimension too large and is singular.
[/proofplan]
custom_env
admin
[step:Fix a point and identify the local hypersurface ring]
Let
\begin{align*}
R:=k[x_1,\dots,x_n]
\end{align*}
and let $p\in X$ be a point. Since $X=\operatorname{Spec}(R/(f))$, the point $p$ corresponds to a prime ideal $\mathfrak p\trianglelefteq R$ with $f\in\mathfrak p$. Define
\begin{align*}
S:=R_{\mathfrak p}
\end{align*}
and let
\begin{align*}
\mathfrak m:=\mathfrak pR_{\mathfrak p}
\end{align*}
be its maximal ideal. Then
\begin{align*}
\mathcal O_{X,p}\cong S/(f).
\end{align*}
The local ring $S$ is a regular local ring, because it is the local ring of [affine space](/page/Affine%20Space) at the point $p$. Its Krull dimension is
\begin{align*}
\dim S=\operatorname{height}(\mathfrak p).
\end{align*}
Since $R$ is a domain and localization preserves domains, $S$ is a domain and the image of the nonzero element $f$ remains nonzero in $S$. Since $f\in\mathfrak p$, its image lies in $\mathfrak m$, and hence $f\in\mathfrak m$ is a nonzero nonunit of $S$.
[/step]
custom_env
admin
[step:Detect whether $f$ has a linear term in the ambient regular local ring]Let $\kappa(p):=S/\mathfrak m$ be the residue field at $p$. The cotangent space of the ambient local ring is the $\kappa(p)$-[vector space](/page/Vector%20Space) $\mathfrak m/\mathfrak m^2$. Since $S=R_{\mathfrak p}$ is the local ring of affine $n$-space at $\mathfrak p$, it is a regular local ring, and the natural differential map
\begin{align*}
\delta_p:\mathfrak m/\mathfrak m^2&\to \Omega_{S/k}\otimes_S\kappa(p)
\end{align*}
\begin{align*}
\overline{g}&\mapsto dg\otimes 1
\end{align*}
is injective. Under the standard basis $dx_1,\dots,dx_n$ of the free $S$-module $\Omega_{S/k}$, one has
\begin{align*}
df=\sum_{i=1}^n \frac{\partial f}{\partial x_i}\,dx_i.
\end{align*}
Therefore the class of $f$ in $\mathfrak m/\mathfrak m^2$ is zero if and only if
\begin{align*}
\frac{\partial f}{\partial x_i}\in\mathfrak p
\end{align*}
for every $i\in\{1,\dots,n\}$. Equivalently, $f\in\mathfrak m^2$ if and only if all first partial derivatives of $f$ lie in $\mathfrak p$.[/step]
custom_env
admin
[guided]The point $p$ may be a non-closed scheme point, so the relevant first-order object is not an $n$-dimensional affine tangent space over $k$. The local object that controls regularity is the cotangent space $\mathfrak m/\mathfrak m^2$ of the local ring
\begin{align*}
S=R_{\mathfrak p}.
\end{align*}
Because $S$ is the local ring of affine space at $\mathfrak p$, it is a regular local ring. For this smooth ambient local ring, the natural map
\begin{align*}
\delta_p:\mathfrak m/\mathfrak m^2&\to \Omega_{S/k}\otimes_S\kappa(p)
\end{align*}
\begin{align*}
\overline{g}&\mapsto dg\otimes 1
\end{align*}
is injective. Thus an element $g\in\mathfrak m$ lies in $\mathfrak m^2$ exactly when its differential vanishes after tensoring with the residue field.
Now apply this to $g=f$. The module of Kähler differentials $\Omega_{S/k}$ is free with basis $dx_1,\dots,dx_n$, and the differential of $f$ is
\begin{align*}
df=\sum_{i=1}^n \frac{\partial f}{\partial x_i}\,dx_i.
\end{align*}
After tensoring with $\kappa(p)=S/\mathfrak m$, the coefficient of $dx_i\otimes 1$ is the image of $\partial f/\partial x_i$ in $\kappa(p)$. Hence $df\otimes 1=0$ if and only if every [partial derivative](/page/Partial%20Derivative) $\partial f/\partial x_i$ belongs to $\mathfrak p$. By injectivity of $\delta_p$, this is equivalent to the class of $f$ in $\mathfrak m/\mathfrak m^2$ being zero, that is, to $f\in\mathfrak m^2$.[/guided]
custom_env
admin
[step:Show that a nonzero partial derivative gives a regular local ring]
Assume that, for some index $i\in\{1,\dots,n\}$,
\begin{align*}
\frac{\partial f}{\partial x_i}\notin\mathfrak p.
\end{align*}
By the preceding step, $f\notin\mathfrak m^2$. Since $S$ is a regular local ring, the nonzero class of $f$ in $\mathfrak m/\mathfrak m^2$ can be extended to a $\kappa(p)$-basis of $\mathfrak m/\mathfrak m^2$. Lifting that basis gives a regular system of parameters
\begin{align*}
f,u_2,\dots,u_d
\end{align*}
for $S$, where $d:=\dim S$. Hence the maximal ideal of $S/(f)$ is generated by the images of $u_2,\dots,u_d$, so
\begin{align*}
\operatorname{embdim}(S/(f))=d-1.
\end{align*}
Because $f$ is a nonzero element of the domain $S$, it is a nonzerodivisor, and the principal ideal theorem for a nonzerodivisor in the regular local domain $S$ gives
\begin{align*}
\dim S/(f)=d-1.
\end{align*}
Thus the embedding dimension of $S/(f)$ equals its Krull dimension. By the embedding-dimension criterion for regular local rings, $\mathcal O_{X,p}\cong S/(f)$ is regular. Therefore $p\notin\operatorname{Sing}(X)$.
[/step]
custom_env
admin
[step:Show that vanishing of all partial derivatives forces singularity]
Assume now that
\begin{align*}
\frac{\partial f}{\partial x_i}\in\mathfrak p
\end{align*}
for every $i\in\{1,\dots,n\}$. By the preceding step, $f\in\mathfrak m^2$. Therefore quotienting by $(f)$ does not change the cotangent space:
\begin{align*}
\mathfrak m_{S/(f)}/\mathfrak m_{S/(f)}^2\cong \mathfrak m/\mathfrak m^2,
\end{align*}
where $\mathfrak m_{S/(f)}:=\mathfrak m/(f)$ is the maximal ideal of $S/(f)$. Hence
\begin{align*}
\operatorname{embdim}(S/(f))=\operatorname{embdim}(S)=\dim S.
\end{align*}
Because $f$ is a nonzero element of the domain $S$, it is a nonzerodivisor, and the principal ideal theorem for a nonzerodivisor in the regular local domain $S$ gives
\begin{align*}
\dim S/(f)=\dim S-1.
\end{align*}
Thus the embedding dimension of $\mathcal O_{X,p}\cong S/(f)$ is strictly larger than its Krull dimension. By the embedding-dimension criterion for regular local rings, $\mathcal O_{X,p}$ is not regular, and so
\begin{align*}
p\in\operatorname{Sing}(X).
\end{align*}
[/step]
custom_env
admin
[step:Identify the singular locus with the Jacobian vanishing set]
Combining the two implications, a point $p\in X$ is singular if and only if
\begin{align*}
\frac{\partial f}{\partial x_i}\in\mathfrak p
\end{align*}
for every $i\in\{1,\dots,n\}$. Since membership in $X$ is the condition $f\in\mathfrak p$, this is equivalent to
\begin{align*}
p\in V\left(f,\frac{\partial f}{\partial x_1},\dots,\frac{\partial f}{\partial x_n}\right).
\end{align*}
Therefore, as underlying closed subsets of $\mathbb A_k^n$,
\begin{align*}
\operatorname{Sing}(X)
=
V\left(f,\frac{\partial f}{\partial x_1},\dots,\frac{\partial f}{\partial x_n}\right).
\end{align*}
This proves the theorem.
[/step]