<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] $(p=-a),q=(\frac{3a^2-d^2}{3}),r=-a(a^2-d^2)\\
r=p(a^2-d^2)\\
\frac rp=(a^2-d^2)\\
3q=(3a^2-d^2)\\
3q=2p^2 + \frac rp\\
0=2p^3 - 3pq + r$
For the answer given, it is not correct.
Check it against $(x+1)(x+2)(x+3) = x^3 + 6x^2 + 11x + 6$
$-2p^2 - 3pq + r = -24$
</s>