<s>[INST] Integral expression $P=x^3+x^2+ax+1$, ... I am trying to solve the following problem: Consider the integral expression $P=x^3+x^2+ax+1$, where $a$ is a rational number. At $a = ?$ the value of $P$ is a rational number for any x which satisfies the equation $x^2+2x-2=0$, and in this case the value of $P$ is ?
I have the key with the answers -4 and -1 but am wondering which steps do I take to get to that answer? So far I have only concluded that for $x^2+2x-2=0, x_1=-1+\sqrt3,x_2=-1-\sqrt3)$
 [/INST] If $x^2 + 2x - 2 = 0$ then $$P-(x^2+2x-2)=P-0=P$$ which tells us that $$P = x^3 + (a-2)x +3$$
Now we need to plug in $x_1$ and $x_2$ in order to solve for $a$.
$$P=(-1+\sqrt{3})^3 + (a-2)(-1+\sqrt{3}) + 3 = (-1+3\sqrt{3}-9+3\sqrt{3})+(a-2)(-1+\sqrt{3}) + 3$$
$$=(-5) + 4\sqrt{3} + a(-1 + \sqrt{3})$$
$$=(-5) + (4+a)\sqrt{3} - a$$
Notice that we need to get rid of the $\sqrt{3}$ term in order to make $P$ rational. Thus the choice of $a=-4$ will work, since that zeros out the term with $\sqrt{3}$.
Apply the same idea with $x_2$ and that will give you your answer.
Note that we didn't have to subtract by $x^2+2x-2$ in the beginning, but by doing so we were able to get rid of the $x^2$ term, and thus allowed us to avoid doing a foil and a cube.
</s>