find the number of ways to choose an ordered pair $(a, b)$ of numbers from the set {${1, 2, 3, ..., 10}$} such that $|a-b|\leqslant5$
My Approach:
I wrote down all the solutions, choosing $a=10$, $a=9$ and so on. Adding up all those solutions gave me the answer $70$. I think I counted all of the solutions but the answer is $80$.
Your answer is correct if the numbers cannot be repeated. You get $80$ if you assume that the same number can be picked twice. For $a \in (1, 5)$, you have $6$ choices each which is $a \leq b \leq a + 5$. That leads to $6 \times 5 \times 2 = 60$ solutions. Multiplication by $2$ is as they are ordered pairs.
Now for $a \in (6, 10)$, the number of choices reduce by $1$ for every next number. So for $6$, we have five choices ($6$ - $10$), for $7$, four choices and so on.
That leads to $2 \times (5 + 4 + 3 + 2 + 1) = 30$ solutions.
Now note that $a = b$ should be counted only once i.e. we counted $(1, 1), (2, 2)...(10, 10)$ twice when we multiplied by $2$.
So the answer is $60 + 30 - 10 = 80$. This is assuming that the same number can be picked twice.