[Math] Number of ways to choose a pair $\{a,b\}$ of distinct numbers from the set $\{1,2,…,50\}$

combinationscombinatorics

Find the number of ways to choose a pair $\{a,b\}$ of distinct numbers from the set $\{1,2,…,50\}$ such that

i) $|a-b| = 5$;

ii) $|a-b| \leq 5 $

My thoughts:

For (i)
For every 6 consecutive numbers, there's a pair. But I can't do $C_{6}^{50}$ as it's not every 6 number combinations I want.

Then answer given is (i)45 (ii)235

Best Answer

For the first problem, the leftmost (smallest) of the chosen numbers can be any of $1,2,3,\dots,45$. Then the other number is determined.

A similar idea will take care of the second problem. The number of choices is $49+48+47+46+45$.

The same idea works in general. For the generalization of the second problem, we are summing a simple arithmetic sequence.