To show that the number of ways in which three numbers in arithmetic progression can be selected from the set {1, 2, 3, ..., n} is given by \( \frac{1}{4}(n-1)^2 \) or \( \frac{1}{4}n(n-2) \) depending on whether \( n \) is odd or even, we can follow these steps:
### Step 1: Define the Arithmetic Progression
Let the three terms in arithmetic progression (AP) be represented as:
- First term: \( a \)
- Second term: \( a + d \)
- Third term: \( a + 2d \)
Here, \( a \) is the first term and \( d \) is the common difference.
### Step 2: Set Constraints
Since we are selecting numbers from the set {1, 2, 3, ..., n}, we must ensure:
1. \( a \geq 1 \)
2. \( a + 2d \leq n \)
From the second condition, we can derive:
\[
a \leq n - 2d
\]
### Step 3: Determine the Range for \( d \)
From the constraints, we know:
- \( d \) must be a natural number.
- The maximum value of \( d \) can be determined by the condition \( a + 2d \leq n \). This implies:
\[
d \leq \frac{n - a}{2}
\]
### Step 4: Count the Possible Values of \( a \) for Each \( d \)
For each fixed \( d \), the value of \( a \) can range from \( 1 \) to \( n - 2d \). Thus, the number of possible values for \( a \) is:
\[
n - 2d
\]
### Step 5: Calculate Total Combinations
Now, we need to sum the number of valid \( a \) values over all possible \( d \):
- The maximum value of \( d \) can be determined by the condition \( n - 2d \geq 1 \), leading to:
\[
d \leq \frac{n-1}{2}
\]
This gives us two cases based on whether \( n \) is odd or even.
### Case 1: \( n \) is Odd
If \( n \) is odd, let \( n = 2k + 1 \) for some integer \( k \). The maximum value of \( d \) is \( k \):
\[
\text{Total combinations} = \sum_{d=1}^{k} (n - 2d) = \sum_{d=1}^{k} (2k + 1 - 2d)
\]
This simplifies to:
\[
= \sum_{d=1}^{k} (2k + 1) - 2\sum_{d=1}^{k} d = k(2k + 1) - 2 \cdot \frac{k(k + 1)}{2}
\]
\[
= k(2k + 1) - k(k + 1) = k^2
\]
Substituting \( k = \frac{n - 1}{2} \):
\[
= \left(\frac{n - 1}{2}\right)^2 = \frac{(n - 1)^2}{4}
\]
### Case 2: \( n \) is Even
If \( n \) is even, let \( n = 2k \). The maximum value of \( d \) is \( k - 1 \):
\[
\text{Total combinations} = \sum_{d=1}^{k-1} (n - 2d) = \sum_{d=1}^{k-1} (2k - 2d)
\]
This simplifies to:
\[
= \sum_{d=1}^{k-1} (2k) - 2\sum_{d=1}^{k-1} d = (k-1)(2k) - 2 \cdot \frac{(k-1)k}{2}
\]
\[
= (k-1)(2k) - (k-1)k = (k-1)k
\]
Substituting \( k = \frac{n}{2} \):
\[
= \left(\frac{n}{2} - 1\right)\left(\frac{n}{2}\right) = \frac{n(n - 2)}{4}
\]
### Conclusion
Thus, we have shown that:
- If \( n \) is odd, the number of ways is \( \frac{1}{4}(n-1)^2 \).
- If \( n \) is even, the number of ways is \( \frac{1}{4}n(n-2) \).