How to write a polynomial function that has the roots $-2$ and $\sqrt7$? I need to write a polynomial function with integer coefficients that has the roots $-2$ and $\sqrt7$. I'm able to do this correctly when I'm given roots like $-3+i$ & $-3-i$, in which I set the roots equal to zero and then multiply them by one another. However, when I try this with $-2$ and $\sqrt7$ and multiply $x+2$ by $x-\sqrt7$, I get $x^2+2x-\sqrt7 x-2\sqrt7$. I don't know where to go from here, and I don't think that this is the correct next step. What do I do next?

$x = \sqrt 7 \implies$
$x^2 = 7\implies$
$x^2 - 7 =0$.  So $x^2 -7$ has $\sqrt 7$ as a root.
And $x=-20\implies x+2 = 0$ so $x+2$ has $-2$ as a root.
If $x^2-7=0$ and $x+2=0$ then $(x^2-7)(x+2)=0$ and $(x^2-7)(x+2)=x^3+2x^2-7x-14$ has $\sqrt 7$ and $-2$ as roots.
(It also has $-\sqrt 7$ as a root.)
=====
By the way.  There is no 2nd degree polynomial with two roots $-2$ and $\sqrt 7$.
A second degree polynomial has at most two roots and if the two roots are $r_1$ and $r_2$ the polynomial is $(x-r_1)(x-r_2)= x^2 -(r_1+r_2)x + r_1r_2$ and if $r_1$ or $r_2$ are irrational we have no reason to assume $r_1+r_2$ or $r_1r_2$ are integers.
Is if $r_1,r_2 = -2,\sqrt 7$ they won't be.  But to counter $\sqrt 7$ as a root we can add a third root of $-\sqrt 7$ to get a third degree polynomial:
$(x-\sqrt 7)(x+\sqrt 7)(x+2) = x^3+2x^2-7x-14$.
