Assignment 1: 1 Information
Assignment 1: 1 Information
1 Information
• Rationale for the assignment: This assignment has several objectives:
– To make you more comfortable with using SageMath and Jupyter Notebook.
– To enhance your understanding of linear recurrences and propositional logic.
– To improve your abilities to read and write mathematical text.
• Deadline: Assignment is due by 11:55 p.m. on Friday, August 31, 2018. It is your responsi-
bility to submit the assignment before the deadline on Moodle. E-mail submissions and
submissions in the wrong format will not be graded (you will get a zero).
• What to submit: For this assignment, you should submit a document in the iPython note-
book (.ipynb) format.
• Marking Scheme: There will be four assignments in this course. The best three will con-
tribute 12% each to your final course grade.
– This assignment will be graded out of 60 points. Points corresponding to each question
are indicated.
– Bonus points can help you score better on this assignment. The sum of points corre-
sponding to the six questions is 70. Your score out of 70 will be taken as your score out
of 60. However, if your score exceeds 60, it will be reduced to 60.
2 Questions
2.1 Question 1 [3 points]
In class, we discussed that ∨ and ∧ are associative, i.e., ( A ∨ B) ∨ C is logically equivalent to
A ∨ ( B ∨ C ). Is → an associative logical operation, i.e., is ( A → B) → C logically equivalent to
A → ( B → C )? Hint: Use SageMath.
1
2.2 Question 2 [6 points]
Use the principle of mathematical induction to show that
n
∑ (2i − 1) = n2
i =1
You must show the procedure you used to arrive at your answer.
Hints:
• You can use SageMath to compute roots of polynomials. For example, the code be-
low computes the roots of p( x ) = 2x2 − 3x − 1. The output is a list of the form
[(r1 , m1 ), (r2 , m2 ), ..., (r j , m j )] where r1 , r2 , ..., r j are distinct roots and m1 , m2 , ..., m j are their
corresponding multiplicities. Multiplicity indicates how many times a root is repeated.
• You can also use SageMath to solve a system of linear equations. The sample code below
solves the following system of linear equations:
x + 2y − z = 2
3x − y − 2z = −5
x+y+z = 6
2
In [9]: #Define variables
var('x, y, z')
#Find solution
solve(eqns, x, y, z)
Plotting Help: The function below computes the sequence Xn , 0 ≤ n ≤ nmax for specified values
of α and nmax .
The function code needs to be included only once in your document. Each time you wish to
make the plot for a different value of α, use the code shown below. This code calls the sequence()
function to compute Xn and then plots it. In the example, α = 2.5 and nmax = 50. Copy the code
below for every plot you wish to include in your document and change the value of variables
alpha and nmax to desired ones. Depending on the value of α, you may wish to use a linear or a
logarithmic y-axis. This can be specified using the scaletype variable.
3
In [11]: #Desired value of alpha
alpha = 2.5
Out[11]:
4
2.5 Question 5 [12 points]
The following students have volunteered to participate in a student committee:
• There should be one physics and one biology student from the same batch. There could be
other students from these majors.
• There should be one humanities and one economics student from the same batch. There
could be other students from these majors.
• The following pairs of students do not get along and at most one student from each pair can
be part of the committee.
c. [2 points] Is it the case that if both economics students are part of the committee, then all the
remaining members must be residing in UG2?
d. [3 points] If Aneesh has to be a member, is the rest of the committee automatically deter-
mined?
5
Note:
• For part a, no points will be given if you do not clearly state the notation you are using. If
there are mistakes in part a, you will not get any points for the remaining parts.
a. [8 points] Imagine that you keep tossing a coin till you get two consecutive heads. How
many distinct coin toss sequences are there of length n (i.e., a total of n coin tosses)? Clearly,
n must be ≥ 2 and the last two tosses must be HH. Let Sn be the total number of distinct
sequences of length n ≥ 2. These distinct sequences can be partitioned into two mutually
exclusive sets: those in which the first toss is H, and those in which the first toss is T. Let Hn
and Tn be the corresponding numbers of these sequences. It is evident that Sn = Hn + Tn .
• iii. [4 points] Solve the recurrence in the previous part and hence find an expression for Sn
as a function of n.
b. [4 points] This part is a variant of part a. Find the number of distinct coin toss sequences of
length n that end in HT, i.e., a heads followed by a tails. You can adopt a similar approach
to part a, but you will find that the recurrence is simpler to solve.
a. [5 points] Recall that the nth Fibonacci number, f n , is defined using the following recurrence:
f n = f n −1 + f n −2
f0 = 0
f1 = 1
Let F ( x ) be the generating function for f n , i.e., let F ( x ) = ∑i∞=0 f i xi . Show that
x
F(x) =
1 − x − x2
b. [7 points] Show that
6
" √ !n √ !n #
(n) n! 1+ 5 1− 5
F (0) = √ −
5 2 2
Here, F (n) (0) is the nth derivative of F ( x ) evaluated at x = 0. Hint: Compare the Taylor
series of F ( x ) about x = 0 with the generating series.
c. [5 points] Show that the generating function for the sequence sn = n is given by
∞
x
S( x ) = ∑ s i x i = (1 − x )2
i =0