TITLE: Quadratics with roots as integers; possible values of a
QUESTION [6 upvotes]: Suppose $a$, $b$ are real numbers such that $a+b=12$ and both roots of the equation $x^2+ax+b=0$ are integers. 
Determine all possible values of $a$. 
I don't know how to go about doing this without long, messy casework.  I tries $(x-s)(x-r)=x^2+ax+b$ and got $-r-s=a$ and $rs=b$, but was unable to find all solutionss based on only these and $a+b=12$.  Could someone help me finish up?  Thanks.

REPLY [6 votes]: Since $a + b = 12$
$$-(r+s) + rs = 12$$
Using Simon's favorite factoring trick:
$$(r-1)(s-1) - 1 = 12 \iff (r-1)(s-1) = 13$$
Only two possible solutions arise:
$r -1 = 1$ and $s -1 = 13$, therefore $r = 2$ and $s = 14$
$r -1 = -1$ and $s -1 = -13$, therefore $r = 0$ and $s = -12$
Therefore, $a = -16$ and $b = 28$
or
$a = 12$ and $b = 0$