inequivalent matrices over $\mathbb{Z}[x]$ Consider the following two matrices over $\mathbb{Z}[x]$:
$$A=\begin{bmatrix} x-1 & -1 \\0 & x-1\end{bmatrix} \mbox{ and } B=\begin{bmatrix} x-1 & -2 \\0 & x-1\end{bmatrix}.$$
That they are not equivalent over $\mathbb{Z}[x]$ can be shown by an explicit computation: if $P,Q$ are two invertible matrices over $\mathbb{Z}[x]$ of size $2\times 2$ such that $PAQ=B$ then one obtains a system of four equations which is inconsistent, hence $A,B$ are not equivalent.
Q. Instead of this first principle-explicit computations, is there any clever trick to say why $A,B$ are not equivalent over $\mathbb{Z}[x]$?

Edit after answer by Dietrich Burde: Suppose
$$\begin{bmatrix} a(x) & b(x) \\ c(x) & d(x)\end{bmatrix} \begin{bmatrix} x-1 & -1 \\0 & x-1\end{bmatrix} \begin{bmatrix} p(x) & q(x) \\ r(x) & s(x)\end{bmatrix}= \begin{bmatrix} x-1 & -2 \\0 & x-1\end{bmatrix} $$
For simplicity, we understand $a=a(x)$, $b=b(x)$ etc., and at the time of use of it, we stress on $x$. 
$(1,2)$-th position of both sides gives $aq(x-1) -as+bs(x-1)=-2$.  Evaluate at $x=1$, we get $$-a(1)s(1)=-2.$$
In particular $a(1),s(1)$ are non-zero. Next, $(1,1)$-th position comparison gives $$ap(x-1)-ar+br(x-1)=0, (\mbox{ evaluate at $x=1$}) \Longrightarrow a(1)r(1)=0 \Longrightarrow r(1)=0.$$
Similarly comparing $(2,2)$-th position, we get $c(1)=0$.
Now matrices used in LHS have det. $\pm 1$,
$$a(x)d(x)-b(x)c(x)=\pm 1 \Rightarrow a(1)d(1)=\pm 1.$$
Similarly, 
$$p(1)s(1)=\pm 1.$$
Now compare following three equations over $\mathbb{Z}$ (which give contradiction)
$$a(1)s(1) =2, \,\,\,\,\,\,\,\, a(1)d(1)=\pm 1, \,\,\,\,\,\,\,\, p(1)s(1)=\pm 1.$$
 A: You can put $A$ in Smith normal form, and a moment's thought shows you can't do so with $B$. This suggests to me the following invariant.

Define $\operatorname{Con}(X)$ to be the ideal generated by the elements of $X$. $\operatorname{Con}$ stands for "content", by analogy with the similar definition for polynomials.
It's clear that $\operatorname{Con}(XY) \subseteq \operatorname{Con}(X)$ for any matrix $Y$. Thus, if $Y$ is invertible, $\operatorname{Con}(XY) = \operatorname{Con}(X)$.
Now, we compute.


*

*$\operatorname{Con}(A) = 1$

*$\operatorname{Con}(B) = (2, x-1)$



Finally, if we didn't believe in the theory of $\operatorname{Con}$, there is a very simple calculation we can do:
$$ A \equiv \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} \pmod{(2, x-1)} $$
$$ B \equiv \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix} \pmod{(2, x-1)} $$
If $A$ and $B$ were equivalent, then they'd be equivalent in $\mathbb{Z}[x]/(2, x-1)$ too, but it's clear that's impossible.
A: Actually one needs already a clever trick to see that these two matrices do not satisfy an equation
$$
PAQ=B,
$$
because $P,Q$ are two matrices in the group $GL_2(\mathbb{Z}[x])$, whose determinant must be a unit in $\mathbb{Z}[x]$. So
$$
P=\begin{pmatrix} a_0+a_1x+\cdots a_rx^r & b_0+b_1x+\cdots +b_sx^s \cr
c_0+c_1x+\cdots c_tx^t & d_0+d_1x+\cdots +d_ux^u
\end{pmatrix}
$$
with determinant $\pm 1$, and with arbitrary $r,s,t,u\ge 0$. We cannot just do a computation ("a system of four equations which is inconsistent"), since we do not know the degree of the four polynomials in $P$. The same holds for $Q$.
