In Matsumura's book ' Commutative ring theory' Theorem 17.4, page 135 its been proved that in a Noetheriam local ring $(A,\mathfrak m)$ for any proper ideal $I$, grade $I=$ ht$I$, where grade of an ideal is defined to be the maximal length of $A$ regular sequence contained inside $I$ and height of an ideal is defined to be the infimum of of ht$p$ where $p$ is a minimal prime ideal containing $I$. In general grade $\leq$ ht. For the other inequality let ht$I=r$. Then the book says that we can find $a_1,\ldots,a_r$ such that ht$(a_1,\ldots,a_i)=i$ for $1\leq i\leq r$. I can't see how can we get this.
I have an argument which directly says that we can find $a_1,\ldots ,a_r$ inside $I$ which is a regular sequence, where ht$I=r$. But my argument does not use that $A$ is Cohen-Macaulay, hence must be flawed. But I cannot find where it is wrong.
Let $r\geq 1$
Let $p_1,\ldots ,p_k$ are minimal prime ideals of $A$. Then $I\nsubseteq p_i$ for each i and hence by prime avoidance $I\nsubseteq\cup p_i$. Therefore $\exists a_1\in I $ such that $a_1$ is not a zero-divisor and hence regular.
Now let $r\geq 2$
We consider $A'=A/(a_1)$. Let $\overline{q_1},\ldots \overline{q_n}$ are minimal prime ideals of $A'$. Then each $q_i$ is a minimal prime ideal containing $(a_1)$ and hence ht$q_i=1$. Therefore $\overline I\nsubseteq\cup\overline{q_i}$ as ht$I\geq 2$. Then we can choose $\overline{a_2}\in\overline{I}$ such that it is a zero-divisor in $A'$. Hence $a_1,a_2$ is an $A$ sequence such that ht$(a_1,a_2)=2$. We continue this way...
Thank you in advance.