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$

absolute valuecombinationscombinatorics

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$.

Best Answer

Cause we find: ordered pair (a,b)

Case 1: Assume a = b then: we have 10 pair ex: (1,1), (2,2), (3,3), ..., (10,10)

Case 2: Assume a > b then: $ 5 \ge a-b > 0 $ $ \Rightarrow b+5 \ge a \gt b $

    Notice: For each b (from 1 to 5) we can get: 
              5 value for a ( from b+1 to b+5)
            --> The number of way: 5 * 5 =25
     For each b ( from 6 to 10) we can get: 
              10 - b value for a
            --> the number of way: 4 + 3 + 2 + 1 = 10

the number of way for case 2 is: $ 5 \times 5 + 4 + 3 + 2 + 1 = 35$

Case 3:

Swap (a,b) from case 2:

 the number of ways: 35

So we counted: 10 + 35 +35 = 80 pair

`

Related Question