# Math Competition Question - Algebra

I found this old math competition question and I am completely at sea with this one. The only thing I can honestly say I've tried is plug in numbers and work from there, but it hasn't worked and I'm sure there's a more formal, direct approach to this problem. This is something I'm really interested in knowing how you solve, though!

So how would you solve this?

• Are $a$ and $b$ integers? Commented Nov 9, 2016 at 7:17
• yes! sorry, i forgot to mention that Commented Nov 9, 2016 at 16:33

By the quadratic formula, we need $a^2-4b$ and $a^2-4(b+1)$ both to be perfect squares.

The only squares that differ by $4$ are...

• $0^2$ and $2^2$? Commented Nov 9, 2016 at 6:00
• can you show me how you got there btw :--) Commented Nov 9, 2016 at 6:00
• It's the quadratic formula. In the first equation, a root $x$ must have: $$x=\frac{-a\pm\sqrt{a^2-4b}}{2}$$ And yes, this means that $a^2-4b=4$... Commented Nov 9, 2016 at 6:01
• what does this make the final answer then? Commented Nov 9, 2016 at 6:15
• @Horse $0 \color{red}{< } a < 1000$ and same for $b$. So $0$ and $4$ aren't the solution.
– user312097
Commented Nov 9, 2016 at 8:54

Okay. You will be knowing the formula for x which we get by completing the squares. $$x={-b\pm\sqrt(b^2-4ac)\over 2a}$$ Hence the basic thing is that $\sqrt(b^2-4ac)$ must be an integer. Which implies $b^2-4ac$ must be a whole square. Doing this for the two quadratic equations we get: $$a^2-4b=m^2$$ $$a^2-4b-4=n^2$$ For m,n in integers. Notice carefully that the two squares differ by 4.This doesn't happen for any integer. You can easily check this. The first few squares are 1,4,9,16......for The difference between the squares is is 3,5,7 and this keeps on increasing.The difference is 4 only for $0^2$ and $2^2$. Hence $b^2-4ac=4$ $$x={-a\pm\sqrt(a^2-4b)\over2}$$ Now we know that $\sqrt(a^2-4b)=2$. Hence if x has to be an integer then a is even. What about b? We know that $a^2-4b=4$, hence $$a=2\sqrt(b+1)$$ So b has to be of the form $n^2-1$ for n<1000. Which means a=2n but a<1000, this further restricts n to n<500. Hence we have 499 ordered pairs.

• $x^2+4x+3$ and $x^2+4x+4$ both have integer solutions, so your answer is wrong. Hint: You've left out one perfect square from your list... Commented Nov 9, 2016 at 6:34
• Yea. Noticed the mistake. Edited it. Thanks. Commented Nov 9, 2016 at 6:56
• @RithwikVidyarthi \sqrt{a + b +c} gives $\sqrt{a+b+c}$.
– user312097
Commented Nov 9, 2016 at 8:52
• Note, $b=n^2-1$ so you nead $n^2-1<1000,$ or $n<32$. Commented Nov 9, 2016 at 14:44

If $0=x_1^2+ax_1+b=x_2^2+ax_2+b+1,$ then by subtracting, $0=x_1^2-x_2^2+a(x_1-x_2)-1,$ so $1=(x_1-x_2)(x_1+x_2+a).$

Therefore $x_1-x_2=\pm 1=x_1+x_2+a.$ Solving this pair of linear equations, we have $$2x_1+a=\pm 2 \text { and } 2x_2+a=0.$$ So $x_2=-a/2$ which implies $$0=x_2^2+ax_2+b+1=a^2/4-a^2/2+b+1=b+1-a^2/4.$$ Since $8\leq 4(b+1)\leq 3996$ and $a^2=4(b+1)$ this gives $3\leq a\leq 63.$ But $a$ is even because $2x_1+a=\pm 2.$ So $a=2c$ where $2\leq c\leq 31.$ And $b=a^2/4-1=c^2-1.$