<s>[INST] Find the condition such that the roots of the polynomial are in AP 
$f(x)=x^3+3px^2+3qx+r$ has roots in AP.Find the relation between $p,q$ and $r$.
[Answer:$-2p^2-3pq+r=0$]

My attempt:-
Taking $d$ as the common difference of the roots in AP we have $f(x)=(x-(a-d))(x-a)(x-(a+d))=x^3-3x^2a+(3a^2-d^2)x-a(a^2-d^2)$.
Comparing this with,the given equation,we get,
$(p=-a),q=(\frac{3a^2-d^2}{3}),r=-a(a^2-d^2)$.
But,after this I have no idea how to eliminate $a$ and $d$ from the equation and find a relation between $p,r$ and $r$.
Thanks for any help!!
 [/INST] As you suggest, take the roots as $a-d,a,a+d$, then you get $p=-a,3q=3a^2-d^2,r=-a^3+ad^2$. Substituting the first and third in the second we get $$-2p^3+3pq-r=0$$ Check: take roots 1,2,3. The equation is $(x-1)(x-2)(x-3)=x^3-6x^2+11x-6$, so $p=-2,3q=11,r=-6$. The relation $-2p^3+3pq-r=0$ holds. The relation given in the question of $-2p^2-3pq+r$ does not.
</s>