Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Find Integer value of $a$ for which both roots of the equation $x^2-ax+2a = 0$ are also integers

My Try:: $\displaystyle x = \frac{a \pm \sqrt{a^2-8a}}{2}$. Now if the Roots are Integer . Then $a^2-8a=k^2$ where $k\in \mathbb{Z}$

Now How can I calculate after that., Thanks

share|cite|improve this question
If $a^2-8a=k^2$ then, completing the square, we get $a^2-8a+16=k^2+16$ and $(a-4)^2=k^2+16$, so $b^2-k^2=16$ (where $b=a-4$). What is known about Pell-like equations that would apply here? – Michael Hardy Feb 27 '13 at 17:04
up vote 6 down vote accepted

As you say, the question comes down to knowing when $a^2 - 8a - k^2 = 0$ for $k \in \mathbb{Z}$. Solving for $a$, $a = 4 \pm \sqrt{16 + k^2}$. As you can see, only for $k = 0$ or $k=3$ does this produce an integer solution for $a$ and so $a = 8$, $a = 0$, $a=9$ and $a=-1$ are possible.

The reason why those were the only $k$ values possible is because after a while, the difference between $k^2$ and $(k+1)^2$ is $2k+1$ and so when $k > 8$, $2k + 1$ becomes bigger than $16$. So we only need to test $k$ up to $8$.

share|cite|improve this answer
How about $k = 3$? – Andreas Caranti Feb 27 '13 at 16:58
@AndreasCaranti Sorry, I went through a (possibly ongoing) process of "oops" "fixed" "oops" "fixed". I've addressed that case now. – muzzlator Feb 27 '13 at 16:59
Thanks muzzlator – juantheron Mar 1 '13 at 4:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.