Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) PDF Download

Q1: The Lucas sequence Ln is defined by the recurrence relation:
L= Ln−1 + Ln−2, for n ≥ 3,
with L1 = 1 and L2 = 3
Which one of the options given is TRUE?  (2023)
(a) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) 
(b) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
(c) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
(d) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
Ans: 
(a)
Sol: By using n = 1, options can be eliminated easily and there are methods like solving linear homogeneous recurrenceby making characteristic equation, generating function etc.
As answer is added here by converting Ln − Ln−1 − Ln−2 = 0 to characteristic equation r− r − 1 = 0 by assuming solution Ln = crn; c > 0
But the question is “why” we assume so ?  
So, we can use an approach of Linear Algebra and prove that our assumption is correct because it is difficult to assumesomething while solving this question first time because we might find difficulty to assume it without having any reason.
So,this method is long but answer your question of "Why ?"
Here, we have given a difference equation of order two as L= Ln−1 + Ln−2  ;n ≥ 3

The idea is, we will make the system of two simultaneous difference equations of order one from this linear difference equationof order 2 and then write it in the matrix form and solve this system.

Assume, Ln−2 = Mn−1 or Mn = Ln−1

And this way, we have a system of two difference equations of order one as :

Ln = Ln−1+Mn−1    (1)

Mn = Ln−1+0Mn−1    (2)

Now, if we write this system in the matrix form as:
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)Now, we replace Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
So, Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
In this way, we get,
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)Hence,
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)Now, say, Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
Now, to find An−2, we need to find An and for that we can use the idea of Cayley-Hamilton theorem.
(An can be computed with the use of Diagonalization concept by finding eigenvalues and eigenvectors for the matrix A.)
Suppose, λ is an eigenvalue for the matrix A. So characteristic equation will be:
det(A - λI) = 0
So, characteristic equation will be:
λ2 - λ - 1 = 0
This is the same characteristic equation which we got while solving linear homogeneous recurrence and so, you can say, this is a proof for making that characteristic equation for linear homogeneous recurrence withconstant coefficient  without assuming solution of the recurrencein the form of cλn or λn.
Now, According to the Cayley-Hamilton theorem, every square matrix A satisfies its characteristic equation and so,
A2 - A - I = 0
A2  = A  + I
A3 = A2  + A = 2A + I
A4 = 2A2 + A = 3A + 2I

Hence, you can write An = aA + bI for some arbitrary constant a and b.
Hence, 

Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)So, Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) and
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)Since, λ2 −λ − 1 = 0 gives
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)So, we get,
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)Now, put a and b in A= aA + bI, we get:  
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
And so,
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
Now, finally, by (3), we get:
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
After solving it, we get,
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
Q2: Consider the following recurrence:
f(1) = 1;
f(2n) = 2f(n) − 1, for n ≥ 1;
f(2n + 1) = 2f(n) + 1, for n ≥ 1.
Then, which of the following statements is/are TRUE?
MSQ  (2022)
(a) f(2n−1) = 2n−1
(b) f(2n)=1f(2n) = 1
(c) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)= 2n+1+1
(d) f(2n+1)=2n+1f(2n + 1) = 2+ 1
Ans:
(a, b, c)
Sol: Edit: To do this question quickly in exam, you can do something like informal induction:
A) Let, f(2n−1) = 2n−1 is true for all natural n≥1, it means f(2n−1−1) = 2n−1−1 is also true for n ≥ 2.
Now,
f(2− 1) = f((2− 1 − 1) + 1) = f(2− 2 + 1) = f(2(2n−1−1) + 1)
= 2f(2n−1−1) + 1 = 2(2n−1−1) + 1 = 2n−1
Similarly,
B) f(2n) = f(2 × 2n−1) = 2f(2n−1) − 1 = 2 × 1 − 1 = 1
C) f(5.2n) = f(2(5 × 2n−1)) = 2f(5 × 2n−1) − 1
= 2 × (2+ 1) − 1 =2n+1 + 1
D) f(2n+1) = f(2 × 2n−1 + 1) = 2f(2n−1) + 1 = 2 × 1 + 1 = 3
Hence, A, B and C are correct options

_____________________


Given: f(2n) = 2f(n) − 1 and f(2n + 1) = 2f(n) + 1 for n ≥ 1
Now, I shall check options one by one.
Option (B):
f(2n) = 2f(2n/2) − 1 [∵ 2n is an even term for n ≥ 1 and since for even terms recurrence is defined as f(2n) = 2f(n)−1  which can be written as f(n) = 2f(n/2) − 1 So, I can write f(2n) as 2f(2n/2) − 1]
So, f(2n) = 2f(2n−1) − 1
= 2[2f(2n−2) − 1] − 1 = 22f(2n−2) − 2 − 1
Like this I can write:
f(2n) = 2kf(2n−k)−2k−1 − 2k−2 −...− 1
Put n − k = 0 ⇒ k = n
So, f(2n) = 2∗ 1 − (1 + 2 +...+ 2n−1) = 2n–((1∗(2n−1))/(2−1)) = 2n – 2n + 1 = 1
Hence, f(2n) = 1
Option (A):
Since, 2− 1 is an odd term for n ≥ 1 So, I can get the value of f(2− 1) from the recurrence which is defined for odd terms i.e. f(2n + 1) = 2f(n) + 1 which can be written as Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
So,
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
So,  f(2− 1) = 2f(2n−1 − 1) + 1
= 2[2f(2n−2 – 1) + 1] + 1 = 22f(2n−2 − 1) + 2 + 1
Like this I can write as:
f(2– 1) = 2kf(2n−k − 1) + 2k−1 + 2k−2 +...+ 1
Put 2n−k − 1 = 1 ⇒ 2n−k = 2 ⇒ n−k = 1 ⇒ k = n − 1
So,
f(2n–1) = 2n−1 ∗ 1 + 2n−2 + 2n−3 +...+ 1 = 1 + 2 +….+ 2n−1
=((2n − 1)/(2 − 1)) = 2– 1
So, f(2– 1) = 2– 1
Option (C):
For n ≥ 1, 5 × 2n will give an even value, So, I can use recurrence which is defined for even terms i.e. f(2n) = 2f(n) − 1  which can be written as f(n) = 2f(n/2) − 1 So, I can write f(5 × 2n) as  Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
So,
f(5×2n) = 2f(5 × 2n−1) – 1
= 2[2f(5 × 2n−2) – 1] −1 = 22f(5 × 2n−2)–2 − 1
Like this I can write:
f(5 × 2n) = 2kf(5 × 2n−k) – 2k−1 – 2k−2 −...− 20
Since f(5 × 21) = f(10) = 2f(5) − 1 = 2[2f(2) + 1] − 1 = 2[2 + 1] − 1 = 5
So, put 5 × 2n−k = 10 ⇒ 2n−k = 21 ⇒ n − k = 1 ⇒ k = n − 1
So,
f(5 x 2n) = 2n-1 x 5-2n-2 - 2n-3 - ... -1 = 5 x 2n-1 - [1 + 2 + ... + 2n-2]
f(5 x 2n) = 5 x 5-2n-2 - Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)= 5 x 2n-1 - 2n-1 + 1 = 2n-1 (5 - 1) + 1
f(5 x 2n) = 2n-2 x 22 + 1 = 2n+1 + 1
Option (D):
Since, 2+ 1 is an odd value for n ≥ 1, So, I can get the values for f(2+ 1) from the recurrence which is defined for odd values of f. i.e. f(2n + 1) = 2f(n) + 1 which can be written as f(n) Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)
So,
f(2n + 1) = Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) 2f(2n - 1) + 1 = 2 x 1 + 1 = 3
Hence, Answer: A, B, C (By putting values of n and evaluating f(.), we can eliminate some option also here.)

Q3: Consider the recurrence relation a1 = 8, an = 6n+ 2n + an−1. Let a99 = K × 104. The value of K is .  (2016 SET-1)
(a) 198
(b) 148
(c) 226
(d) 312
Ans:
(a)
Sol: an = 6n2 + 2n + an-1
= 6n2 + 2n + 6(n − 1)+ 2(n − 1) + an−2
= 6n+ 2n + 6(n − 1)+ 2(n − 1) + 6(n − 2)+ 2(n − 2) +......+ a1
= 6n2 + 2n + 6(n−1)+ 2(n−1) + 6(n − 2)+ 2(n − 2)+......+ 6.12 + 2.1
= 6(n2 + (n − 1)+...+ 2+ 12) + 2(n + (n − 1) + ...+ 2 + 1)
Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)= n(n + 1)(2n + 1 + 1)
an = 2n(n + 1)2
for n = 99 a99 = 2 x 99 x (99 + 1)2 = 198 x 104

Q4: Let an be the number of n-bit strings that do NOT contain two consecutive 1s. Which one of the following is the recurrence relation for  an?  (2016 SET-1)
(a) an=an1+2an2an = an−1 + 2an−2 
(b) an=an1+an2an = an−1 + an−2
(c) an = 2an−1 + an−2
(d) an=2an1+2an2a= 2an−1 + 2an−2
Ans:
(b)
Sol: Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)an = an-1 + an-2
Rest of the options are already out.
Alternatively, we can get a string in an by appending "0" to any string in an−1 as well as by appending "01" to any string in an−2 and the two cases are mutually exclusive (no common strings) as well as exhaustive (covers all cases).  
Correct Answer: B

Q5: Let an represent the number of bit strings of length n containing two consecutive 1s. What is the recurrence relation for an?  (2015 SET-1)
(a) an2+an1+2n2an−2 + an−1 + 2n−2
(b) an−2 + 2an−1 + 2n−2
(c) 2an−2 + an−1 + 2n−2
(d) 2an2+2an1+2n22an−2 + 2an−1 + 2n−2
Ans:
(a)
Sol: Counting the number of bit strings NOT containing two consecutive 1's. (It is easy to derive a recurrence relation for the NOT case as shown below)
0      1

00  01  10  −3 (append both 0 and 1 to any string ending in 0, and append 0 to any string ending in 1)

000  001  010  100  101 − 5 (all strings ending in 0 give two strings and those ending in 1 give 1 string)

0000  0001  0010  0100  0101  1000  1001  1010 − 8 


Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) (where adenote the number of bit strings of length n containing two consecutive 1s)
2− an = (2n−1 − an−1) + (2n−2 − an−2)
a= 2n−2(4 − 2 − 1) + an−1 + an−2
an = an−1 + an−2 + 2n−2
Correct Option: A

The document Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Engineering Mathematics for Computer Science Engineering.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
34 videos|115 docs|72 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Previous Year Questions: Recurrence - Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)

1. What is a recurrence relation in computer science?
Ans. A recurrence relation in computer science is an equation that recursively defines a sequence based on its previous terms.
2. How are recurrence relations used in algorithms and data structures?
Ans. Recurrence relations are used in algorithms and data structures to analyze the time complexity of algorithms, particularly in the context of divide and conquer strategies.
3. Can you give an example of a recurrence relation used in computer science?
Ans. One common example of a recurrence relation is the Fibonacci sequence, where each term is the sum of the two preceding terms: F(n) = F(n-1) + F(n-2).
4. How can we solve recurrence relations in computer science?
Ans. Recurrence relations can be solved using techniques such as iteration, substitution, and the master theorem, depending on the form and complexity of the relation.
5. Why is understanding recurrence relations important for computer scientists and programmers?
Ans. Understanding recurrence relations is crucial for analyzing the efficiency and performance of algorithms, which is essential for designing optimized and scalable software solutions.
34 videos|115 docs|72 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

video lectures

,

MCQs

,

Semester Notes

,

Exam

,

Important questions

,

Objective type Questions

,

Free

,

Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)

,

Extra Questions

,

Sample Paper

,

pdf

,

ppt

,

Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)

,

past year papers

,

practice quizzes

,

Viva Questions

,

shortcuts and tricks

,

Previous Year Questions with Solutions

,

mock tests for examination

,

study material

,

Previous Year Questions: Recurrence | Engineering Mathematics for Computer Science Engineering - Computer Science Engineering (CSE)

,

Summary

;