Total number of values of $a$ such that the equation $x^2+ax+a+1=0$ has integral roots Find the total number of values of $a$ such that the equation $x^2+ax+a+1=0$ has integral roots
The equation can also be written as $$\left(x+\frac{a}{2}\right)^2=\frac{a^2-4a-4}{4}$$
So $a$ is a multiple of $2$ and $a^2-4a-4$ is a multiple of $4$ and $\frac{a^2-4a-4}{4}$ is a perfect square.
How can I find $a$ using the above conditions?

The sum $r+s$ of the roots is $-a$ and their product $rs$ is $a+1$. So, as in your calculation, we want
$$(r-s)^2=(r+s)^2-4rs=a^2-4(a+1)$$ 
to be a perfect square. So we want $(a-2)^2-8$ to be a perfect square. 
There are only two perfect squares that differ by $8$, so $(a-2)^2=9$, and now we can find the possible values of $a$. It is easy to verify that they both work. 
