<s>[INST] Quadratic polynomials $f(x)$ with rational coefficients such that $f(p)=q, f(q)=r, f(r)=p$ where $p,q,r$ are the roots of $x^3-7x+7$. Let $p,q,r$ be the three roots of $x^3-7x+7$. Find all quadratic polynomials $f(x)$ with rational coefficients such that $f(p)=q, f(q)=r, f(r)=p$.

So far, I let $f(x)=ax^2+bx+c$, and I have
$$ap^2+bp+c=q,$$
$$aq^2+bq+c=r,$$
$$ar^2+br+c=p.$$
Adding the three equations and apply Vieta's formulas, I get $$a(p^2+q^2+r^2)+b(p+q+r)+3c=p+q+r\implies 14a+3c=0.$$
This is because $p^2+q^2+r^2=(p+q+r)^2-2(pq+qr+pr)=0^2-2(-7)=14,$ and $p+q+r=0$. However, I am unable to continue from here. Can I have some help?
Thanks!
 [/INST] Multiply each of your three equations by the root on its left hand side
$$ap^3+bp^2+cp=pq,$$
$$aq^3+bq^2+cq=qr,$$
$$ar^3+br^2+cr=rp.$$
Add the three equations again and apply Vieta's formulas, but also using $p^3 = 7p-7$ etc (they are roots!), so $$p^3+q^3+r^3 =-21$$ gives $-21a+14b=-7$, so $3a=2b+1$, which now gives all three coefficients in terms of one of them.
It is also true that if $f(x)=x^3-7x+7$ and $g(x)=ax^2+bx+c$, then $f(g(x))$ is zero at all the roots of $p$ (as $q$ just permutes these roots), so f(x) has to be a factor of the sixth order polynomial $h(x)=f(g(x))$. We can also find the other cubic factor of $h$: apart from $p$, $q$ and $r$, its other roots are the other values of $x$ that make $g(x)=p$ or $q$ or $r$. That is, $-\dfrac{b}{a}-p$, $-\dfrac{b}{a}-q$,$-\dfrac{b}{a}-r$. The cubic with these roots is (using $a^3$ as the coefficient of $x^3$) $$a^3x^3+3ba^2x^2+(3b^2a-7a^3)x+(b^3-7a^2b-7a^3).$$
This means that the constant coefficient of $h$ is $7(b^3-7a^2b-7a^3)$, from the two factors we have; but it is also, from the definition of $h$, $f(g(0))=c^3-7c+7.$ We know $b$ and $c$ in terms of $a$, from earlier calculations, so we have a cubic satisfied by $a$. This cubic turns out to be $$(a^2-9)(85a+27)=0,$$ so there are 3 possible values of $a$ and corresponding values of $b$, $c$.
</s>