# Counting ordered pairs $(a,b)$ satisfying $a^2+b^2=(a+b)^2$, with $a$ and $b$ in the interval $[-100,100]$

A lazy mathematician believes that $$a^2+b^2 = (a+b)^2.$$ If $$a$$ and $$b$$ are both integers from the interval $$[-100, 100]$$, find the number of ordered pairs $$(a,b)$$ that satisfy the equation above.

The equation implies that $$2ab = 0$$, hence either $$a=0$$ or $$b=0$$. This would result in the following pairs. When $$a=0$$ $$(0,-100), (0, -99), \dots, (0, 100).$$

When $$b=0$$ $$(-100, 0), (-99, 0), \dots, (100, 0)$$

Since we have twice the pair $$(0, 0)$$ we should subtract $$1$$ from the total counts. For me it seems that there's $$200$$ possible choices in each scenario. This would imply that the total would be $$400-1 = 399$$, but the correct answer was $$401$$. What am I missing in the countings?

• There's actually 201 scenarios in each one, but yeah the argument is correct – Something Jun 10 '20 at 12:45
• Freshman's dream – RobPratt Jun 10 '20 at 17:41

How many numbers are there in the sequence $$-1, 0, 1$$? What about $$-10, -9, \ldots, 0, \ldots, 9, 10$$? How about in $$-100, \ldots, 100$$?
The problem with your reasoning is that the integers from $$-100$$ to $$100$$ comprise $$\color{green}{201}$$ integers, not $$\color{red}{200}$$ integers. Thus, the answer is $$2\cdot 201-1=\color{green}{401}$$.
$$a^2+b^2 = (a+b)^2\implies a^2+b^2 -(a+b)^2=0\implies \pm2ab=0$$ This means that one of $$a$$ or $$b$$ must be zero if the other is non-zero "or" both may be zero. This means we have $$200$$ non-zero values of $$a$$ when $$b$$ is zero plus $$200$$ values of $$b$$ when $$a$$ is zero plus the $$1$$ pair $$(0,0)$$ for a total of $$401$$ ordered pairs.