How big is the set of hypersurfaces with bad singularities? Let $R=k[x_1,\ldots,x_n]_d$ be the set of all homogeneous polynomials with degree $d$, and let 
$$S_i =\{f \in R \mid \text{first $i$-th order derivatives of $f$ are all zero at $x$, for some $x\in Z(f)$}\}.$$
I would like to know that, what is the codimension of $S_i$ in $R$? For example, $S_1$ consists of such $Z(f)$ is singular, and it is well-known that $\mathrm{codim}(S_1)=1$. But I don’t know how to do for a general $i$.
Thanks in advance.
 A: One way to approach this kind of question is by using a sort of incidence correspondence to linearise the problem. I don't have time to write all details, but I can sketch the idea in case it helps you.
Let me change notation slightly so that $R$ is the polynomial ring in $n+1$ variables. So the polynomials you are asking about define hypersurfaces of degree $d$ in $\mathbf P^n$. The space of such hypersurfaces is $\mathbf P^N$ where $N={n+d \choose d}-1$. 
Now define
$$\Sigma_i = \left\{ (x,V) \in \mathbf P^n \times \mathbf P^N \mid V \text{ has a singularity of multiplicity of order $ \geq i$ at } x \right\}.$$
Then $S_i$ is the projection of $\Sigma_i$ onto the $\mathbf P^N$ factor. (Actually your definition of $S_i$ differs from this by scalar multiplication, but that doesn't affect the codimension, so let's not worry.)
Why is this helpful? The point is that we can understand $\Sigma_i$ by looking at its projection onto the $\mathbf P^n$ factor. For a fixed $x \in \mathbf P^n$, the set of hypersurfaces with a singularity of order $\geq i$ at $x$ is a linear subspace of $\mathbf P^N$ whose codimension is easy to calculate (just count the number of partial derivatives which are vanishing). Since $\mathbf P^n$ is homogeneous, the answer is the same for all $x$. So $\Sigma_i$ is a $\mathbf P^m$-bundle over $\mathbf P^n$, for some value of $m$ that you have just calculated.
Then the last step is to project to $\mathbf P^N$. I claim that this projection is finite, so the dimension of $S_i$ actually the same as that of $\Sigma_i$. To prove the claim, it suffices to find a single hypersurface of degree $d$ with a nonempty finite set of points of multiplicity $i$. I leave that as an exercise.   
