When p(A)=0 iff p(B)=0 for any polynomial,why same minimal polynomial?

For two matrices A and B, when p(A)=0 iff p(B)=0 for any polynomial, what will happen? i read that A and B have the same minimal polynomial, why?

 PhysOrg.com science news on PhysOrg.com >> 'Whodunnit' of Irish potato famine solved>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change>> Curiosity Mars rover drills second rock target

 Quote by td21 For two matrices A and B, when p(A)=0 iff p(B)=0 for any polynomial, what will happen? i read that A and B have the same minimal polynomial, why?
Let $$m_A, m_B$$ be the minimal polynimials of A and B. Then $$m_A (A) = 0\Rightarrow m_A (B) = 0 \Rightarrow m_B / m_A^{(1)}$$
and
$$m_B (B) = 0\Rightarrow m_B (B) = 0 \Rightarrow m_A / m_B ^{(2)}$$
$$\overset {(1), (2)}{\Rightarrow} m_A = k \cdot m_B$$
with k a constant.
But $$m_A, m_B$$ are both monic polynomials so, $$k=1$$
and finally $$m_A = m_B.$$

 Recognitions: Gold Member Science Advisor Staff Emeritus Pretty much the same thing but in slightly differentwords: Suppose PA(x), of degree n, is the minimal polynomial for A. Then PA(A)= 0 so PA(B)= 0. If This is not the minimal polynomial for B, there exist a polynomial PB, of degree m< n, such that PB(A)= 0. But then PB(A)= 0 contradicting the fact that the mininal polynomial of A has degree n> m.