0% found this document useful (0 votes)
46 views4 pages

CS 121 Homework Zero: Fall 2019: Course Syllabus

The document is a homework assignment for CS 121 that introduces mathematical concepts needed for the course. It includes 11 problems testing skills in logic, sets, functions, graphs, and Big-O notation. Students are instructed to work independently but can discuss approaches with others in the class. Solutions must be written individually and in the requested format. Collaboration policies and resources for getting help are also outlined.

Uploaded by

Jorge Vallejos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views4 pages

CS 121 Homework Zero: Fall 2019: Course Syllabus

The document is a homework assignment for CS 121 that introduces mathematical concepts needed for the course. It includes 11 problems testing skills in logic, sets, functions, graphs, and Big-O notation. Students are instructed to work independently but can discuss approaches with others in the class. Solutions must be written individually and in the requested format. Collaboration policies and resources for getting help are also outlined.

Uploaded by

Jorge Vallejos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CS 121 Homework Zero: Fall 2019

The aim of problem set is to help you in brushing up on the mathematical


background needed to be successful in CS 121. This problem set will be due
in the first week of class, but I encourage you to start working on it over the
summer.
Some policies: (See the course syllabus for the full policies.)
• You can collaborate with other students that are currently enrolled in this
course (or, in the case of homework zero, planning to enroll in this course)
in brainstorming and thinking through approaches to solutions but you
should write the solutions on your own and cannot share them with other
students.
• Always make sure that you “own” your solutions to this other problem
sets. That is, you should always first grapple with the problems on your
own, and even if you participate in brainstorming sessions, make sure that
you completely understand the ideas and details underlying the solution.
This is in your interest as it ensures you have a solid understanding of
the course material, and will help in the midterms and final. There will
be many “bonus points” in the problem sets and ways to make up for
lost points. Therefore getting 80% of the problem set questions right on
your own will be much better to both your understanding and grade than
getting 100% of the questions through gathering hints from others without
true understanding.
• Sharing questions or solutions with anyone outside this course, including
posting on outside websites, is a violation of the honor code policy. Collab-
orating with anyone except students currently taking this course or using
material from past years from this or other courses is a violation of the
honor code policy.
• The submitted PDF should be typed and in the same format and pagina-
tion as ours. Please include the text of the problems and write Solution
X: before your solution. (This is easy to do if you use our markdown tem-
plate.) Please mark in gradescope the pages where the solution to each
question appears. Points will be deducted if you submit in a different
format.
By writing my name here I affirm that I am aware of all policies and
abided by them while working on this problem set:
Your name: (Write name and HUID here)
Collaborators: (List here names of anyone you discussed problems or ideas
for solutions with)

1
Questions
Please solve the following problems. Some of these might be harder than the
others, so don’t despair if they require more time to think or you can’t do them
all. Just do your best. Also, you should only attempt the bonus questions if
you have the time to do so. If you don’t have a proof for a certain statement,
be upfront about it. You can always explain clearly what you are able to prove
and the point at which you were stuck. Also, for a non bonus question, you can
always simply write “I don’t know” and you will get 15 percent of the credit
for this problem.
The Piazza board for this course will be active even before the course starts. If
you are stuck on this problem set, you can use Piazza to send a private message
to all instructors under the e-office-hours folder.
This problem set has a total of 50 points and 11 bonus points. A grade of
50 or more on this problem set is considered a perfect grade. If you get stuck
in any questions, you might find the resources in the CS 121 background page
helpful.
Problem 0 (5 points): Read fully the Mathematical Background Chap-
ter ( pdf format html format ) from the textbook on the website https://intr
otcs.org. This is probably the most important exercise in this problem set!!
Solution 0: (Write “I certify that I fully read the mathematical background
chapter”.)

Logical operations, sets, and functions


These questions assume familiarity with strings, functions, relations, sets, and
logical operators. We use an indexing from zero convention, and so given a
length 𝑛 binary string 𝑥 ∈ {0, 1}𝑛 , we denote coordinates of 𝑥 by 𝑥0 , … , 𝑥𝑛−1 .
We use [𝑛] to denote the set {0, 1, … , 𝑛 − 1}.
Question 1 (3 points): Write a logical expression 𝜑(𝑥) involving the variables
𝑥0 , 𝑥1 , 𝑥2 and the operators ∧ (AND), ∨ (OR), and ¬ (NOT), such that 𝜑(𝑥) is
true if and only if the majority of the inputs are False.
Solution 1:
Question 2: Use the logical quantifiers ∀ (for all), ∃ (exists), as well as ∧, ∨, ¬
and the arithmetic operations +, ×, =, >, < to write the following:
Question 2.1 (3 points): An expression 𝜓(𝑛, 𝑘) such that for every natural
numbers 𝑛, 𝑘, 𝜓(𝑛, 𝑘) is true if and only if 𝑘 divides 𝑛.
Solution 2.1:
Question 2.2 (3 points bonus): An expression 𝜑(𝑛) such that for every
natural number 𝑛, 𝜑(𝑛) is true if and only if 𝑛 is a power of three.
Solution 2.2:

2
Question 3: In this question, you need to describe in words sets that are
defined using a formula with quantifiers. For example, the set 𝑆 = {𝑥 ∈ ℕ ∶
∃𝑦∈ℕ 𝑥 = 2𝑦} is the set of even numbers.
Question 3.1 (3 points): Describe in words the following set 𝑆:

𝑆 = {𝑥 ∈ {0, 1}100 ∶ ∀𝑖∈{0,…,98} 𝑥𝑖 = 𝑥𝑖+1 }

(Recall that, as written in the mathematical background chapter, we use zero-


based indexing in this course, and so a string 𝑥 ∈ {0, 1}100 is indexed as
𝑥0 𝑥1 ⋯ 𝑥99 .)
Solution 3.1:
Question 3.2 (3 points): Describe in words the following set 𝑇 :

𝑇 = {𝑥 ∈ {0, 1}∗ ∶ |𝑥| > 1 and ∀𝑖∈{2,…,|𝑥|−1} ∀𝑗∈{2,…,|𝑥|−1} 𝑖 ⋅ 𝑗 ≠ |𝑥|}

Solution 3.2:
Question 4: This question deals with sets, their cardinalities, and one to one
and onto functions. You can cite results connecting these notions from the
course’s textbook, MIT’s “Mathematics for Computer Science” or any other
discrete mathematics textbook.
Question 4.1 (4 points): Define 𝑆 = {0, 1}6 and 𝑇 as the set
{𝑛 ∈ [100] | 𝑛 is prime }. Prove or disprove: There is a one to one
function from 𝑆 to 𝑇 .
Solution 4.1:
Question 4.2 (4 points): Let 𝑛 = 100, 𝑆 = [𝑛] × [𝑛] × [𝑛] and 𝑇 = {0, 1}𝑛 .
Prove or disprove: There is an onto function from 𝑇 to 𝑆.
Solution 4.2:
3
Question 4.3 (4 points): Let 𝑛 = 100, let 𝑆 = {0, 1}𝑛 and 𝑇 be the set of
all functions mapping {0, 1}𝑛 to {0, 1}. Prove or disprove: There is a one to
one function from 𝑆 to 𝑇 .
Solution 4.3:
Question 5.1 (5 points): Prove that for every finite sets 𝐴, 𝐵, 𝐶, |𝐴∪𝐵∪𝐶| ≤
|𝐴| + |𝐵| + |𝐶|.
Solution 5.1:
Question 5.2 (5 points bonus): Prove that for every finite sets 𝐴, 𝐵, 𝐶,
|𝐴 ∪ 𝐵 ∪ 𝐶| ≥ |𝐴| + |𝐵| + |𝐶| − |𝐴 ∩ 𝐵| − |𝐵 ∩ 𝐶| − |𝐴 ∩ 𝐶|.
Solution 5.2:

3
Graphs
Thee following two questions assume familiarity with basic graph theory. If you
need to look up or review any terms, the CS 121 background page contains
several freely available online resources on graph theory. This material also
appears in Chapters 13,14,16 and 17 of the CS 20 textbook “Essential Discrete
Mathematics for Computer Science” by Harry Lewis and Rachel Zax.
Question 6.1 (5 points): Prove that if 𝐺 is a directed acyclic graph (DAG)
on 𝑛 vertices, if 𝑢 and 𝑣 are two vertices of 𝐺 such that there is a directed path
of length 𝑛 − 1 from 𝑢 to 𝑣 then 𝑢 has no in-neighbors.1
Solution 6.1:
Question 6.2 (5 points): Prove that for every undirected graph 𝐺 of 1000
vertices, if every vertex has degree at most 4, then there exists a subset 𝑆 of at
least 200 vertices such that no two vertices in 𝑆 are neighbors of one another.
Solution 6.2:

Big-O Notation
Question 7: For each pair of functions 𝑓, 𝑔 below, state whether or not 𝑓 =
𝑂(𝑔) and whether or not 𝑔 = 𝑂(𝑓).
Question 7.1 (3 points): 𝑓(𝑛) = 𝑛(log 𝑛)3 and 𝑔(𝑛) = 𝑛2 .
Solution 7.1:
Question 7.2 (3 points): 𝑓(𝑛) = 𝑛log 𝑛 and 𝑔(𝑛) = 𝑛2 .
Solution 7.2:
𝑛
Question 7.3 (3 points bonus): 𝑓(𝑛) = (⌈0.2𝑛⌉ ) (where (𝑛𝑘) is the number of
𝑘-sized subsets of a set of size 𝑛) and 𝑔(𝑛) = 20.1𝑛 .2
Solution 7.3:

1 Hint: You can use the topological sorting theorem shown in the mathematical background

chapter.
2 Hint: one way to do this is to use Stirling’s approximation.

You might also like