Solution:
(a) The number of ordered triples \( (a,b,c),\) where \( 1 \le a, b,c \le n,\) is \(n^3\) We can classify these triples into three categories.
Case 1: \(a,b,c\) are all equal.
There are \(n\) ordered triples in this case.
Case 2: Two of \(a,b,c\) are equal, and the third is different.
There are \(n\) ways to choose the two equal values, then \(n-1\) ways to choose the third value that is different. There are then \(3\) ways to arrange the numbers within the ordered triple, so the number of ordered triples in this case is \(3n(n-1).\)
Case 3: \(a,b,c\) are all different.
There are \(\dbinom{n}{3}\) ways to choose three different values. There are then \(3!=6\) ways to arrange them, so the number of ordered triples in this case is \(6\dbinom{n}{3}\)
By counting the number of triples \((a,b,c)\) in two different ways, we arrive at the conclusion
\(n^3=n+3n(n-1)+6\dbinom{n}{3}. \)
(b) The number of subsets of \(\{1,2,3,...,n+2\}\) containing three different numbers is \(\dbinom{n+2}{3}\)
We can also count the number of subsets as follows. Let the subset be \(\{a,b,c\},\) where \(a Then the middle element \(b\) is at least \(2\) and at most \(n+1\) so we can let \(b=k+1\) where \(1\le k \le n.\)
Once the middle element \(b=k+1\) is chosen, the smallest element \(a\) must be between \(1\) and \(k\) inclusive, so there are \(k\) ways of choosing the smallest element \(a\). The largest element \(c\) must be between \(k+2\) and \(n+2\) inclusive, so there are \((n+2)-(k-2)+1\) ways of choosing the largest element \(c\). So the number of subsets where the middle element is \(k+1\) is \(k(n-k+1)\) Summing over \(1 \le k \le n\) we get
\(\dbinom{n+2}{3}=(1)(n)+(2)(n-1)+(3)(n-2)+\cdots+(k)(n-k+1)+\cdots+(n)(1).\)