Derivative criterion for repeated factors I've found the following problem:

Let $R$ be a ring. Suppose that you can factor a polynomial $f(x)\in R[x]$ as a product of linear factors: $$f(x)=a(x-a_1)\cdots (x-a_n).$$ Show that $f$ does not have repeated factors if an only if $f(x)$ and $f'(x)$ are relatively prime.

Here two polynomials are relatively prime if they do not hay common factors.
First, I doubt that this can be done in arbitrary rings.
Second, if we assume that $R$ is a commutative ring, we can prove that if $f(x)$ and $f'(x)$ are relatively prime then $f$ does not have reapeted factors as is done here.
For the converse, we have
$$f'(x)=a\sum_{k=1}^n \frac{f(x)}{x-a_k}.$$
Assuming that $R$ is such that $R[x]$ is a UFD I'm able to finish the proof of the converse but I haven't found counter examples to say that this are missed conditions in the statement of the problem. Otherwise, how can I solve it?
 A: I don't this you can speak of relatively prime (at least not in terms of factors) unless $R[X]$ is UFD. Here is your basic problem outside UFDs:
In $\mathbb Z/6 \mathbb Z [X]$ we have
$$(x-1)(x-2)=x^2-3x+2=(x-4)(x-5)$$
Let 
$$P(X)=x^3-4x^2+5x-2$$
Then $P(X)$ can be factored as $(x-1)^2(x-2)$ but also as $(x-1)(x-4)(x-5)$.
So, is $(x-1)$ a double root or not? Is the polynomial relatively prime to $(x-2)$ or not? 
Keep in mind that the derivative is independent of the factorization, but since the factorization is not unique, the definition of repeated factors is not.
More exactly, and this will happen everytime $R[X]$ is not an UFD, your Theorem cannot be true in this case because the factorization
$$P(x)= (x-1)^2(x-2)$$ tells you that $P$ is nor relatively prime to $P'$, while the factorization
$$P(X)=(x-1)(x-4)(x-5)$$
tells you exactly the opposite.... If we apply the same result twice to the same polynomial, it cannot yield opposite conclusions...
Added Just for fun. If $P(X)=x^3-4x^2+5x-2$ then $P'(X)=3X^2-2X-1=(X-1)(3X+1)$. So by applying the Lemma to $P(X)=(X-1)(X-4)(X-5)$ you can claim a counterexample, because the lemma only say if you find some factorization... It would be interesting to see if in non-UFD the lemma is true if one looks at all the possible factorizations: is it true that one of them have multiple factprs if and only if $P,P'$ have a common factor?
