number of positive integral solution of $|a-b|\leq 10,a>1,b<1000$ number of positive integral solution of $|a-b|\leq 10,a>1,b<1000$ 
writing $|a-b|\leq 10$ as $-10 \leq (a-b)\leq 10$
staring from $a=2,-10 \leq 2-b \leq 10$
$b=1,2,3,4,.....,12$
starting from $a=3\;,-10 \leq 3-b \leq 10$
$b=1,2,3,4,......,13$
but this is very difficult to count all cases
could some help me with this, Thanks
 A: First overcounting a bit, for every $b$ there are precisely $21$ values of $a$ such that $|a-b|\leq10$. Given that $b$ is positive and $b<1000$, this yields a total of $999\times21$ solutions. The only problem is that we have overcounted the solutions with $a\leq1$. In this case $b\leq11$, so there are only a few cases to check and count.
A: We can see that for $a =2$, the solution set for $b\in [1,12]$. Similarly, for $a=3$, the solution set is $b\in [1,13]$. And so on,... till $a=10$, the solution set is $b\in [1,20]$.  

You would have noticed a similarity in the cases of $a\in [2,10]$ in that the first element in the solution set of $b$ is always $1$. But that similarity stops here. We notice that for $a=11$, the solution set is $b\in [1,21]$ and for $a=12$, it is $b\in [2,22]$. A pattern starts developing here in the sense that for $a\geq 11$ (you can say that for $10$ also) the solution set of $b$ is $[a-10,a+10]$. Hence, we can say that the total number of cases is $$f(a) = 
\begin{cases}
 10+a & ;2\leq a\leq 10\\
 20 & ;  a>10
\end{cases}$$ Hope it helps.
A: $$-10\leq a-b \leq 10$$
$$-10+a\leq b \leq 10+a$$
Therefore applying the other constraints ($b\geq1$ and $b \leq 999$):
$$\max\{-10+a,1\}\leq b \leq \min\{10+a,999\}$$

$2 \leq a\leq 10$:
$$1 \leq b \leq 10+a$$
Therefore you will have $10+a$ solutions for each $a$:
$$\sum_{i=2}^{10} (10+i)=144$$
$11 \leq a\leq 989$:
$$-10+a\leq b \leq 10+a$$
Then the number of solutions is $21$ for each one therefore you will have in total $$\sum_{i=11}^{989} 21=20559$$
$ 990 \leq a \leq 1009$: 
$$-10+a\leq b \leq 999$$
Therefore you will have $999-(-10+a)+1=1010-a$ solutions for each $a$:
$$\sum_{i=990}^{1009} (1010-i)=210$$
So the total number of solutions is $144+20559+210=20913$
