Minimal number of generators of an ideal Suppose $Y$ is an affine variety in $\mathbb{A}^n$ of $\dim r$. Then height of the prime ideal $\mathcal{I}(Y)$ is $n-r$. We have a result:   
"Let $A$ be a Noetherian ring, $x_1,\dots ,x_r\in A$. Then every minimal prime ideal $\mathfrak{p}$ belonging to $(x_1,\dots ,x_r)$ has height $\leq r$." (Atiyah-Macdonald, Corollary $11.16$, page $121$). 
Now suppose $\mathcal{I}(Y)$ is generated by $m$ elements. Then, using the result, $n-r\leq m$. So $\mathcal{I}(Y)$ is minimally generated by $n-r$ elements.
$\underline{\text{My question}}$: Is it always possible to find $n-r$ elements which will generate $\mathcal{I}(Y)$ or there are some examples for which it is not possible to find that minimal number of elements ?
Also, in particular, if $Y$ is a linear variety then as @Georges pointed out we can always find $n-r$ elements which will generate the ideal $\mathcal{I}(Y)$. I need an explanation for this last part. 
Thank you.
 A: The answer is no. The most-famous example might be ideal $\mathcal I(Y)=(xz-y^2,yz-x^3,z^2-x^2y)$ of the curve parametrized by $(t^3,t^4,t^5)$ in $\mathbb A^3$.
We have $n=3$, $r=1$, but the ideal cannot be generated by $2$ elements (yet to be shown, I might leave it to you if you want).
The keyword to look up here is complete intersection.
A: 1) Macaulay has proved that there is no bound for the number of generators necessary to generate the ideal of $I(C)$ of a curve $C\subset \mathbb A^3$.
In other words given $N\in \mathbb N$ there exists a curve $C\subset \mathbb A^3$ such that $I(C)\neq (p_1,\cdots, p_N)$ for any choice of $N$ polynomials $p_i\in k[X,Y,Z]$  
2) Macaulay proved his result with the help of singular curves, as illustrated by MooS's example.
However, if $C$ is smooth the situation is much better:
In 1963 Forster proved that the ideal $I(C)$ of a smooth curve $C$ can be generated by $4$ elements, and in 1970 Abhyankar proved that $I(C)$ can even be generated by $3$ elements.
