Let $P(x)\in \mathbb{R}[x]$ Show there exists a non-constant polynomial $m(x)$ such that $m^2(x)|P(x)$ iff gcd$(P(x),P'(x))$ is not $1$.
My attempt: if $m^2(x)|P(x)$ then $m(x)|gcd(P(x),P'(x))$. So the only if part is pretty much done
Help with if part
If $\gcd \ne 1$ then $p(x) =k(x)(x-a)$ and $p'(x) =q(x)(x-a)$ for some $a$. But $$p'(x) = k'(x)(x-a)+k(x)$$
So if we put $x=a$ we get: $$0=p'(a) = k(a)\implies x-a\mid k(x)$$ $$\implies k(x)=r(x)(x-a)$$
so $p(x)= r(x)(x-a)^2$