GATE / CS ARCHIVE

GATE CSE 2022 / QUESTION 36

GATE CSE 2022 Q36

Discrete Mathematics · Recurrences & Generating Functions · Full GATE CSE 2022 paper

GATE 2022, Q36 2 marks · MCQ
Report issue

Recurrences & Generating Functions

Question 36, GATE 2022: For n≥0, a_n=n+1 if n is odd, and 1 otherwise. Find the ordinary generating function. Options all include +1/(1−x): A x(1+x²)/(1−x²)²; B x(3−x²)/(1−x²)²; C 2x/(1−x²)²; D x/(1−x²)².
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Write an=1+n for odd n and 1 for even n. The baseline generating function is 1/(1−x). Also Σ_(odd n≥1) n xn=x d/dx[x/(1−x²)]=x(1+x²)/(1−x²)². Adding gives 1/(1−x)+x(1+x²)/(1−x²)², option A.

The first coefficients are 1,2,1,4,1,6,… . Begin with the all-ones series, then add x+3x³+5x⁵+… . Differentiating x+x³+x⁵+…=x/(1−x²) and multiplying by x produces exactly that odd-index correction. This also checks that the constant coefficient remains 1.

Original paper, page 24 · Answer key