How many ways can a given positive integer n >= 2 be expressed as the sum of 2 positive integers (which are not necessarily distinct)? For example, for n = 3, the number of ways is 2 i.e. 1 + 2 = 2 + 1 = 1. Give the answer without any explanation. A. n/2 B. floor(n/2) C. n - 1 D. ceil(n/2)
GATE 2002 · Discrete Mathematics · Balls In Bins · medium
Answer: floor(n/2)
- Set up the constraint: Since a <= b and a + b = n, we get 2a <= n, so a <= n/2. Also a >= 1.
- Count valid values of a: a can be 1, 2, ..., floor(n/2). Each gives a unique unordered pair. Total = floor(n/2).
- Verify with example: Only pair: (1, 2). Indeed 1 + 2 = 3. Matches the example in the question.