Does equality of polynomials imply equality of matrix polynomials? Say,$~~f(x) = h(x)g(x)~~$ for all $x \in \mathbb{R}$, where $f(x), g(x), h(x)$ are polynomials with real coefficients.
Let $B$ be any non-negative square matrix. Can we always say $f(B) = h(B)g(B)?~$ Does it hold for any square matrix $B$? Can we formally prove this, if true?
Here $~f(B), g(B), h(B)$ are the matrix polynomials (https://en.wikipedia.org/wiki/Matrix_polynomial).  
Any hints or guidance would be much appreciated. Thanks!
 A: Yes, it is . 
$f(x)$,$h(x)$, and $g(x)$ are polynomials in $x$, therefore, $f(B)$,$h(B)$, and $g(B)$ are polynomials in $B$. 
The addition and multiplication of matrices enjoy the same properties as addition and multiplication of real numbers except the commutative property of multiplication.
Since we are dealing with only one matrix $B$ in this question, the commutative property is also valid for polynomials in $B$.  
A: The problem is to see where the different formulas live. If you write $f(x)=h(x)g(x)$ the two members live in formal expressions but they are equal when they are evaluated as polynomials. Now, given a matrix $B$ there is a map (call it $\phi_B$) from the polynomials to the matrices such that 
$$
\phi_B(P+Q)=\phi_B(P)+\phi_B(Q)\ ;\ \phi_B(\alpha P)=\alpha\phi_B(P)\ ;\ 
\phi_B(PQ)=\phi_B(P)\phi_B(Q)\qquad (*)
$$ 
and one sees that $\phi_B(P)=P(B)$. If fact, this map $\phi_B$ is the unique map $\phi : k[X]\to M(n,k)$ which satisfies $(*)$, $\phi(1)=I$ and $\phi(X)=B$. So, if two expressions (however different as expressions) evaluate as the same polynomial (as $X^2-1$ and $(X-1)(X+1)$) their value at $B$ are the same. Expressions are better understood when written with tree-like structures. For instance $X^2-1$ reads (sorry but I am a bit clumsy in Mathjax drawings)
\begin{array}{cccccc}
  &  & - &  \\
  &╱&   &╲  \\
 & * &   & 1 & \\
╱ & &╲ &   & &  \\
X &  & X & &  
\end{array}
whereas $(X-1)(X+1)$ reads
\begin{array}{cccccc}
  &  & * &  \\
  &╱&   &╲  \\
 & - &   &  & +\\
╱ & &╲ &   ╱ & &╲  \\
X &  & 1 & X &  & 1
\end{array}
You can represent any polynomial expression like this. Identities are statements like $T_1=T_2$ where $T_i$ are formal expressions but are equal when evaluated within the realm of polynomials.   
Hope it helps !
