Let $R$ be a commutative ring with only finitely many maximal ideals $\mathfrak m_1,\ldots,\mathfrak m_r$. Let $M$ be a finitely generated $R$-module. Then $$\mu_R(M)=\max\{\dim_{R/\mathfrak m_i}M/\mathfrak m_iM\mid 1\leq i\leq r\},$$ where $\mu_R(M)$ is the minimum number of generators of $M$ as $R$-module.
How can I prove this?
Of course the inequality $\geq$ is trivial; what I want to prove is that $\dim_{R/\mathfrak m_i}M/\mathfrak m_iM\leq\mu_R(M)$.
I was trying to prove it first if $R$ is a finite product of fields but I wasn't succesful; any help?