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$

361 Views Asked by At

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

2

There are 2 best solutions below

2
On BEST ANSWER

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.

0
On

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

`