I am trying to prove this result:
Let $A$ be a commutative ring different from $\{0\}$, $\mathbb{Z}/4\mathbb{Z}$ and $\mathbb{Z}/2\mathbb{Z}[X]/(X^2)$. Prove that if any monic polynomial of degree $2$ of $A[X]$ has at most two roots in $A$, then $A$ is an integral domain.
I have tried to suppose that $A$ is not an integral domain, so that $\exists a,b\in A$ with $a,b\ne 0$ and $ab=0$. If $a\ne b$, the polynomial $X(X-a+b)$ has three different roots: $0,a-b,$ and $a$, which is absurd.
However, if $a=b$ (so that $a^2=0$), I can't find a way to come to an absurdity. The polynomial $X^2$ has two different roots: $0$ and $a$, as well as any $xa$ for $x\in A$. An absurdity will occur if there exists $x\in A$ such that $xa\notin \{0,a\}$, and I can't see why just putting apart the three aforementioned rings ensures that it is the case.