GATE 2023 CS Q.15
The Lucas sequence is defined by the recurrence relation: , for , with and .
Which one of the options given is TRUE?
- (A)
- (B)
- (C)
- (D)
GATE CS
A recurrence relation defines each term of a sequence from earlier terms, and a generating function packs a whole sequence into one power series. For GATE you set up a recurrence for a counting problem, solve linear constant-coefficient recurrences by the characteristic equation, and use generating functions to read off terms, solve recurrences and count selections.
3 previous-year questions · 3 solved · 5 practice questions
Convention: a sequence is and runs over unless a question says otherwise. A recurrence gives in terms of earlier terms; it determines the sequence only together with enough initial conditions (for a recurrence of order , the first consecutive values).
To set up a recurrence for a counting problem, split the objects of size by what happens at the last position (or the first), so that each case reduces to a smaller count of the same kind. The cases must not overlap and must cover everything.
Procedure for a counting recurrence
Define precisely (what is counted, for which ).
Split the objects of size by the last symbol, last tile or last step.
Express each case as a count of a smaller size; add the cases.
Compute the initial values by direct listing, including if it makes sense.
Test the recurrence on a small by listing.
Problem | Recurrence | Initial values |
|---|---|---|
Binary strings of length with no two consecutive 1s | ||
Tilings of a strip with and tiles | ||
Ways to climb stairs taking 1 or 2 steps at a time | ||
Fibonacci numbers | ||
Lucas numbers | ||
Minimum moves for the Tower of Hanoi with discs | ||
Regions of the plane cut by lines, no two parallel and no three through one point | ||
Derangements of objects (permutations with no fixed point) | for | |
Catalan numbers: binary trees with nodes (unlabelled, left and right child distinguished) | for |
Closed forms for the table
No two consecutive 1s: ; tilings and stairs: .
Tower of Hanoi: .
Regions: (so ).
Derangements: ; also for .
Catalan: ; also counts strings of matched pairs of parentheses and triangulations of a convex polygon with sides.
CATALAN NUMBERS AND DERANGEMENTS
For ; for example and .
Why the first row works: for , a valid string of length ends in 0 (the first symbols form any valid string) or ends in 01 (the first symbols form any valid string). Hence for , with (the empty string) and . Here (00, 01, 10), so .
WORKED EXAMPLE
Ternary strings over must not contain two consecutive 's. Let be the number of such strings of length . Find a recurrence and .
Strings ending in or : 2 choices for the last symbol after any valid string of length , giving .
Strings ending in : the symbol before it must be or (2 choices), and the first symbols form any valid string, giving .
So for , with and .
and .
Check: of the 27 strings of length 3, those containing are (3) and (3), with in both lists, so ; and .
Answer: and .
A linear homogeneous recurrence of order with constant coefficients has the form with . Trying gives its characteristic equation.
CHARACTERISTIC EQUATION
For ; it has degree , so roots over the complex numbers counted with multiplicity. Since , no root is 0.
GENERAL SOLUTION, DISTINCT ROOTS
When all roots are distinct (real or complex); the constants come from the initial conditions.
CONTRIBUTION OF A REPEATED ROOT
A root of multiplicity contributes this term; add the contributions of all roots.
FIBONACCI AND LUCAS CLOSED FORMS
Roots of ; and .
Procedure
Write the characteristic equation and find its roots with multiplicities.
Write the general solution (distinct roots: ; repeated root: polynomial in times ).
Substitute the initial conditions to get linear equations for the constants.
Solve for the constants and check the closed form against several terms.
WORKED EXAMPLE
Solve with , , and find .
Characteristic equation , so or .
.
: . : . Hence , .
. Check: and the recurrence gives .
.
Answer: and .
WORKED EXAMPLE
Solve with , .
Characteristic equation : a double root .
.
. gives .
. Check: by the formula, and from the recurrence.
Answer: .
EXAM TIP
The number of constants equals the order , and you need exactly initial conditions. A quick check of and from both the recurrence and your closed form catches most algebra slips.
For , the solution is : the general solution of the homogeneous part plus any one particular solution. Find the particular solution by a trial form matched to , then fix the constants of the homogeneous part using the initial conditions of the full recurrence (not of the homogeneous part alone).
Trial form if the base is not a characteristic root | If the base is a root of multiplicity | |
|---|---|---|
constant | (base is 1) | |
polynomial of degree | polynomial of degree with unknown coefficients | (polynomial of degree ), base is 1 |
polynomial of degree times | (polynomial of degree ) | (polynomial of degree ) |
If is a sum of terms of different kinds (for example ), find a particular solution for each term separately and add them.
FIRST-ORDER LINEAR RECURRENCE
For with constants and . Example: , gives .
WORKED EXAMPLE
Solve with , .
Homogeneous part: , roots 1 and 2, so .
and 2 is a root of multiplicity 1, so try .
Substitute and divide by : , so .
. From : . From : , so . Hence , .
. Check: , and the recurrence gives . Also and .
Answer: .
WORKED EXAMPLE
Let and for (powers of 2). Find .
Put and : then for , with .
Homogeneous part ; 2 is a root, so try : gives .
and gives , so .
With : . Check: ; ; .
Answer: for a power of 2.
EXAM TIP
If the usual trial form for already appears in the homogeneous solution, it fails: substituting it into gives 0, which cannot equal a non-zero . Multiply by , where is the multiplicity of the base as a root. Constants must be fitted after adding the particular solution.
The ordinary generating function of a sequence is the formal power series . The sequence is the list of coefficients, written . Convergence is not needed for counting; we only manipulate coefficients.
GEOMETRIC SERIES
Coefficients and ; so gives .
LINEAR SEQUENCES
Coefficients and .
NEGATIVE BINOMIAL SERIES
For integer ; counts solutions of in non-negative integers.
FINITE SERIES
For integer ; the second gives a bounded choice of to items.
GENERALISED BINOMIAL THEOREM
For any real , with ; for it gives the negative binomial series with signs, .
SQUARES
Obtained by applying to .
Operation on the sequence | Effect on the generating function |
|---|---|
Add: | |
Scale: | |
Shift right: ( zeros) | |
Shift left: (drop ) | |
Multiply by : | |
Partial sums: | |
Convolution: | |
Replace by : |
To read a sequence off a rational closed form, first divide out any polynomial part if the numerator's degree is not smaller than the denominator's (it changes only the first few coefficients), then split the rest into partial fractions of the type and use the series above. For example has coefficients .
Procedure
Multiply the recurrence by and sum over all for which it holds.
Express each sum through , using the shift rules and the initial terms.
Solve the resulting linear equation for as a rational function.
Factor the denominator, split into partial fractions, and expand each piece.
Read off and check against the first terms.
FIBONACCI AND LUCAS GENERATING FUNCTIONS
With and .
WORKED EXAMPLE
Use generating functions to solve for , with , .
Let . The recurrence holds for , so .
With , : , so .
, so .
Partial fractions: . Check: .
So . Check: and ; and .
Answer: .
CATALAN GENERATING FUNCTION
The quadratic comes from the convolution ; the minus sign is the root with . Expanding by the generalised binomial theorem gives .
EXAM TIP
Before any cancellation with the numerator, the denominator of is the characteristic polynomial written backwards, : for you get . A root of the characteristic equation corresponds to a factor .
To count selections, build one factor per item type: the factor lists the allowed numbers of copies as powers of . The product's coefficient of counts the ways to select items in total, because multiplying the series adds exponents. Copies within a type are identical and the order of selection does not matter (multisets); equivalently, the coefficient counts ways to put identical objects into distinct boxes, one box per factor.
Restriction on a variable | Factor |
|---|---|
any | |
even | |
odd | |
a multiple of () |
NON-NEGATIVE INTEGER SOLUTIONS
For ; the coefficient of in , i.e. identical objects into distinct boxes. With every the count is (for ; zero if ).
WORKED EXAMPLE
Find the number of solutions of in non-negative even integers.
Each variable is even, so each factor is and the product is .
Put : the coefficient of is the coefficient of in .
That is .
Answer: 28
EXAM TIP
For an upper bound use and expand the numerator by the binomial theorem; the terms beyond the target degree can be ignored. Also: always state which variable ranges over which values before writing the factor.
PREVIOUS-YEAR QUESTIONS
Try each question first, then open the answer. We placed each question under a topic ourselves; the exam paper does not label topics.
See these papers in full: GATE CSE 2023 · GATE CSE 2022 · GATE CSE 2018
The Lucas sequence is defined by the recurrence relation: , for , with and .
Which one of the options given is TRUE?
Which one of the following is the closed form for the generating function of the sequence defined below?
Which one of the following is a closed form expression for the generating function of the sequence , where for all ?
PRACTICE
Let be the number of binary strings of length that do not contain three consecutive 0s, with . Find .
Answer:
For , split a valid string by its ending: 1, 10 or 100, each after any valid string of length , or . (Ending 000 is not allowed.)
So for , with , , .
(only 000 is excluded), , , .
The sequence satisfies for with and . Which is the closed form for ?
Answer: (B)
Characteristic equation , a double root 3.
. .
gives .
. Check and .
Let be an ordinary generating function. Which of the following statements are correct?
The coefficient of in is .
is the generating function of .
is the generating function of the constant sequence .
The coefficient of in is 15.
Answer: (A), (B), (D)
A: true, gives .
B: true, it is times the series of A.
C: false, , giving .
D: true, .
How many solutions does have, where each is an integer with ?
Answer:
Coefficient of in .
; the term does not reach degree 10.
Count .
Check by symmetry: gives , and then automatically, so .
Let and for . What is ?
2185
2187
1457
2191
Answer: (A)
Homogeneous solution ; the constant 4 gives a particular solution with , so .
and gives , so .
. Check: from both the formula and the recurrence.
OFFICIAL GATE 2027 SYLLABUS WORDING
Copied from the GATE 2027 syllabus; see all 2027 syllabi.
GATE CS
recurrence relations, generating functions
Preparing in Kolkata? IAE Academy's course for GATE CSE.