Consider the following recurrence:
f(1) = 1;
f(2n) = 2*f(n) - 1, for n >= 1;
f(2n+1) = 2*f(n) + 1, for n >= 1.
Then, which of the following statements is/are TRUE?
A. f(2^n - 1) = 2^n - 1 for all n >= 1
B. f(2^n) = 2^(n-1) for all n >= 1
C. f(2^n + 1) = 3 for all n >= 1
D. f(2^n) = 1 for all n >= 1
GATE 2022 · Discrete Mathematics · Recurrence Relation · medium
Answer: Statements A, C, and D are TRUE. Statement B is FALSE.
Check statement D: f(2^n) = 1 for all n >= 1: Base: f(2^1) = f(2) = 2*f(1)-1 = 1. Step: if f(2^{k-1})=1 then f(2^k) = 2*f(2^{k-1})-1 = 2*1-1 = 1. By induction, D is TRUE.
Check statement C: f(2^n + 1) = 3 for all n >= 1: 2^n+1 is odd, so f(2^n+1) = 2*f(2^{n-1})+1. By D, f(2^{n-1})=1 for n>=1, so f(2^n+1) = 2*1+1 = 3. C is TRUE.
Check statement A: f(2^n - 1) = 2^n - 1 for all n >= 1: Base n=1: f(1) = 1 = 2^1-1. Inductive step: 2^{n+1}-1 = 2*(2^n-1)+1 is odd, so f(2^{n+1}-1) = 2*f(2^n-1)+1 = 2*(2^n-1)+1 = 2^{n+1}-1. A is TRUE.
Check statement B: f(2^n) = 2^(n-1): f(2) = 1 = 2^0 = 2^{1-1} (matches). f(4) = 1 but 2^{2-1} = 2. Contradiction for n=2. B is FALSE.