15-151: Mathematical Foundations for Computer Science
Homework 1 Solutions
Setty Questions
For several homework problems in this course we will ask you to use our own custom programming
language, whic
15-151: Mathematical Foundations for Computer Science
Homework 3
(due Wednesday, September 18)
Directions: Write up carefully argued solutions to the following problems. The rst task is to be
complete
15-151: Mathematical Foundations for Computer Science
Homework 7
(due Wednesday, October 23)
Directions: Write up carefully argued solutions to the following problems. The rst task is to be
complete a
15-151: Mathematical Foundations for Computer Science
Homework 8
(due Wednesday, October 30)
Directions: Write up carefully argued solutions to the following problems. The rst task is to be
complete a
15-151: Mathematical Foundations for Computer Science
Homework 2 (due Wednesday, September 11)
Directions: Write up carefully argued solutions to the following problems. The rst task is to be
complete
15-151: Mathematical Foundations for Computer Science
Homework 5
(due Monday, October 7)
Directions: Write up carefully argued solutions to the following problems. The rst task is to be
complete and c
15-151: Mathematical Foundations for Computer Science
Test 2 (Practice)
Name:
Andrew ID:
15-151 Section (circle one):
A
B
C
15-152 Section (circle one):
A
B
C
D
INSTRUCTIONS:
Write your NAME, ANDREW
15-151: Mathematical Foundations for Computer Science
Test 1
Name:
Andrew ID:
15-151 Section (circle one):
A
B
C
15-152 Section (circle one):
A
B
C
D
INSTRUCTIONS:
Write your NAME, ANDREW ID, and SEC
15-151: Mathematical Foundations for Computer Science
Homework 4
(due Wednesday, September 25)
Directions: Write up carefully argued solutions to the following problems. The rst task is to be
complete
Definition 1.1.1. A real number is a point on the infinite number line. To abbreviate
the expression x is a real number, we write x R (LATEX code: x \in \mathbbcfw_R).1
Definition 1.1.3. An integer is
Homework 1
The Curious Case of the Lying TAs
(a) Here, we are proving whether the two inhabitants are students or TAs based on the statement.
The statement at least one of us in a TA can either be tru
Sets Workshop
Consider Cardinality
(a) The set A := cfw_1, 2, 3 has a cardinality of 3.
(b) The set B := cfw_, cfw_, cfw_.cfw_, cfw_, cfw_, cfw_, . has innite cardinality.
Minus Minus Minus
Propositio
Homework 8.5
Counting in Two Ways
Here, we are proving that, for some a, n N, a > 0, that
n
ai = an+1 1
(a 1)
i=0
using a counting in two ways argument. We will show that both ways count the amount of
Homework 10
Battle of the Greggorys
(a)
def greggory(n): /The very first time this function is called, n = 0
gk = FlipCoin(p) /Gregs shot
gr = FlipCoin(q) /Gregorys shot
winner = "
if gk = HEADS: /If
Homework 5
All Your Base (Case) are Belong to Us
Here, we are proving that fn = gn for all n N by strong induction on n.
Base Case
Note that it is given that f0 = g0 = 1, f1 = g1 = 5, and f2 = g2 = 10
Homework 6
Great Times
Dene g : R3 R2 by g(x, y, z) = (xz, yz). Here, we are showing that g is surjective and neither
injective nor bijective
Injective: For g to be injective, we know that (x, y, z, a
Homework 4
Obvious Induction Question
Here, we are proving that n! < nn for n N \ cfw_0, 1 by induction on n. Let P (n) = n! < nn .
Base Case
When n = 2, we know that P (2) is true because:
2! < 22
2<
Homework 2
Same Dierence
Here, we are proving that the union on any two non-empty sets A and B, such that |A B| 2
can be expressed as a union of two disjoint, non-empty sets. A and B can fall into thr
Homework 3
Forall easy problems, exists a reason
(a) Here we are disproving that (x Z). (y R). 2x > y. We can do this by proving that the
statements negation, (x Z). (y R). 2x y. Let x Z be arbitrary
Homework 7
Direction is Relative
(a) If the graph has no loops, then E is not a reexive relation. The graph having loops would
imply that all edges of the form (vi , vi ) for some vi V , where i is so
Homework 8
n now, theyre gon
(a) Here, we are showing the number dierent p-gons that can be made using the given points. We
will call this number Pn , and we can reduce the problem to showing:
2pPn =