You are on page 1of 7

Discrete Mathematics and Functional Programming

(MATHFUN, U21274)
2017/18

Assessment details
Your mark for the MATHFUN unit will be made up of the following components:

• Coursework [10%]: the portfolio for the Discrete Mathematics part

• Coursework [30%]: Functional Programming (dr Matthew Poole)

• Final exam [60%]: 2 hours closed book exam covering both parts: Discrete Math-
ematics (75%) and Functional Programming (25%), all questions are compulsory.

The portfolio for the Discrete Mathematics part


Introduction
This document gives details of the coursework for the Discrete Mathematics part of the
MATHFUN unit (10%). The assessment for this part will take the form of a portfolio
containing your solutions to the attached exercises.
Hand out date: TB1, Week 9 (also available on Moodle)

Your portfolio should be submitted to the CAM office by the deadline of:
4pm, February 12, 2018 (Monday)

Aim of this assignment


The aim of this assignment is to provide practical experience in solving simple mathe-
matical exercises and using mathematical notation.

Assessment details
All exercises in the portfolio will be marked (maximum 100 marks for the portfolio). The
exercises labelled [harder] are designed for those students who have completed the other
exercises and would like a further challenge (without solving the harder exercises you
can’t get 90+ %).

Information to the submission


• Please write your solutions coherently and use mathematical notation correctly, e.g.
do not forget to use {}, when a result is a set.

• It is very important to show your workings, not just the result. You can always get
partial marks even if your final result is not correct.

1
• You may get 0 for an exercise if only a result is given without giving a reasonable
explanation. You always need to answer a question “Why?”. Take your time to
practise with these skills, you find them useful in logical arguing :-) This is com-
pletely different approach to many other courseworks.

• Please number the pages to help the marker.

• If you write your solutions by hand, please write legibly. If you can’t find a good
editor for writing maths notation and would like to use the best and the most
interesting one, then LATEX is recommended,
see http://en.wikibooks.org/wiki/LaTeX/Introduction, http://miktex.org/ or the
on-line version https://www.writelatex.com.
It may be a good idea to learn more about this option right now!

Sources of help
The main source of guidance for solving the exercises is at the tutorials. Please also
feel free to discuss the exercises with other students or use Moodle for a discussion, but
the work you submit must be the result of your own effort. Copying the work of your
colleagues is not acceptable! It is fairly easy to spot when a student has done this.
If you would like further guidance outside of the tutorials, the Maths Café or addi-
tional support tutors are recommended.
Any questions and problems (e.g. if you think a question is ambiguous) can be dealt with
by email (janka.chlebikova@port.ac.uk). If any general issues arise, I will use time in
lectures and/or Moodle to point these out.

Important
The portfolio is an individual assignment, and so the work you submit for assessment
must be your own. Any attempt to pass off someone else’s work as your own is plagiarism,
which is a serious academic offence. Any suspected cases of plagiarism will be dealt with
in accordance with University regulations.
All assessments (if possible) should be anonymous including all coursework. Therefore
you must not identify your work using your name. Please, use only your student ID to
identify your work.

Janka Chlebı́ková, October 2017

2
Exercise 1. Let A = {x, y, z}. (i) Give three elements from the Cartesian product
P (A) × A. (ii) How many elements are in the Cartesian product P (A) × A? Justify your
answer.

Exercise 2. In each of the following statements replace ‘?’ by a value such that the
statement is true. If there is no solution give a reason. If there are more than one
solutions, give all of them.

(i) {?, ?, ?} ∈ {1, 2, 3, {5, 6, 7}}

(ii) {{?, ?}} ⊆ {1, 2, {3, 4}}

(iii) {?, ?} ⊂ {1, 2, 3, {4, 5}}

Exercise 3. Let A, B, and C be sets. Is it always true that

A ∪ (B ∩ C) = (A ∪ B) ∩ C ?

Either prove the statement or find a counterexample.

Exercise 4. How many elements are in the set {(a, b) | (a, b) ∈ N×N and 1 ≤ a ≤ b ≤ n}
for n ≥ 1, n ∈ N? Justify your answer.
If you do not know how to solve it for variable n, solve the exercise for n = 5.

Exercise 5. There is a group of 191 students of which 10 are taking operating systems,
databases, and discrete mathematics; 36 are taking operating systems and databases; 20
are taking operating systems and discrete mathematics; 18 are taking discrete mathemat-
ics and databases; 65 are taking operating systems; 76 are taking databases; and 63 are
taking discrete mathematics. Clearly explain your solutions.

(i) How many are taking discrete mathematics or operating systems (or both) but not
databases?

(ii) How many are taking none of the three subjects?

Exercise 6.[hard in general case] Let n > 3, n ∈ N and A = {1, 2, 3, . . . , n}.

(i) How many subsets of A contain the elements 1 and 2?

(ii) How many subsets B of A have the property that B ∩ {1, 2} = ∅?

(iii) How many subsets B of A have the property that B ∪ {1, 2} = A?

Clearly explain your answers. If you do not know how to solve it for variable n, solve the
exercise for n = 5.

3
Exercise 7. Let A = {1, 2, 3, 4, 5, 6}. In each case (i)-(iii) give an example of a relation
on the set A with the given properties. The relations can be described by listing the
ordered pairs or by a formula. Clearly explain your solutions. If such a relation doesn’t
exist, give a reason.

(i) Give an example of a relation on the set A with at most five elements which is
reflexive, but not transitive.

(ii) Give an example of a relation on the set A with at most 3 elements which is not
reflexive, but is symmetric and transitive.

(iii) Give an example of an equivalence on the set A. Can you describe such an equiva-
lence by a formula?

Exercise 8. [hard] Let A = {1, 2, 3, 4, 5, 6} and S = P (A) be the power set of A. For
a, b ∈ S, let R be defined such that (a, b) ∈ R if a and b have the same number of elements.
Is R an equivalence relation on S? If R is an equivalence, how many equivalence classes
are there? Justify your answers.

Exercise 9. In the questions below you can describe the relations/functions either by
drawing a diagram, by a formula, or by listing the ordered pairs. Explain your solutions.
(i) Give an example of two sets A and B and a relation R from A to B which is not a
function.

(ii) [hard] Find a set A, |A| = 4 and define a bijective function between A and P (A)?
If such a set doesn’t exist give a reason.

Exercise 10. Let f : N → N be defined as f (x) = 3x + 2 for every x ∈ N. Calculate the


following and write down either value or a function. Show your working.
(i) (f ◦ f )(x) = f (f (x)) =

(ii) Compose the function f n-times recurrently (f ◦ f ◦ f · · · f ◦ f )(x) =


| {z }
n

Exercise 11.

(i) Give an example of a function f : N → N which is total and injective, but not
surjective. If such a function doesn’t exist, give a reason.
Define the inverse function of the function f . If such a function doesn’t exist, give
a reason.

(ii) Give an example of a function f : N → N which is partial, injective, and surjective.


If such a function doesn’t exist, give a reason.

4
Exercise 12. Determine whether the following statement is a tautology, a contingency
or a contradiction. Give a reason for your answer:
(p → q) ∧ (¬p → p) → q

Exercise 13. Verify the following equivalence by writing an equivalence proof. That
is, start on one side and use known equivalences to get to the other side.

(p → q) ∧ (p ∨ q) ≡ q

Exercise 14. Write each of the following statements in symbolic form and determine
whether they are logically equivalent. Include a truth table and a few words of explana-
tion.
“If you paid full price, you didn’t buy it at Crown Books. You didn’t buy it at Crown
Books or you paid full price.”

Exercise 15. The following picture shows an arrangement of objects of various shapes
(circles, squares, triangles) drawn with various lines (solid, dashed, dotted), which are
located on a grid. The configuration can be described using logical operators such as
Triangle(x), meaning “x is a triangle”, Dashed(y), meaning “y is drawn in dashed style”,
and Above(x, y), meaning “x is above y (but possibly in a different column)”, . . . . Indi-
vidual objects has been given names such as a, b, or c.

a b

c d

e f

g h i

j k

Determine the truth or falsity of each of the following statements. The domain for all
variables in (i)–(iv) is the set of objects shown above. Clearly justify your answer.

(i) ∀u, Circle(u) → Dashed(u),

(ii) ∃z such that Triangle(z) ∧ Above(f, z).

(iii) ∀ circles x ∃ a square y such that x and y are draw in the same style (solid, dotted,
dashed).

5
Exercise 16. Let

• s(x) denote the statement “x is a student”,

• h(x) denote the statement “x is happy”.

Formalise each of the following statements. The domain for all variables is the set of all
people.

(i) “Some student is happy.”

(ii) “Not all students are happy.”

(iii) “Every student is happy.”

(iv) “There is a sad student.”

(v) “All students are sad.”

Exercise 17. Let D = E = {−2, −1, 0, 1, 2}. Determine the truth value of each statement
below and justify your answers.

(i) ∀x ∈ D ∃y ∈ E such that x + y = 2.

(ii) ∃x ∈ D such that ∀y ∈ E x ≥ y.

Exercise 18. Write a negation (formal or informal) for each of the following statements.
Be careful to avoid negations that are ambiguous.

(i) All dogs are friendly.

(ii) Some estimates are accurate.

(iii) ∀x ∈ R, if x2 ≥ 1 then x > 0.

Exercise 19. Give a direct proof of the fact that a2 − 5a + 6 is even for any integer a.

Exercise 20. Write down the contrapositive and the negation of the following implication.
“If x2 + x − 2 < 0, then x > −2 and x < 1.”

Exercise 21. Prove or disprove the following statement:

∀a ∈ Z ∀b ∈ N, if a < b then a2 < b2 .

6
Exercise 22. [hard] Rewrite the definition of a surjective function f : A → B using ∀
and ∃. Write down the negation of that definition; i.e. use ∀ and ∃ to express that ‘f is
not surjective’.

Exercise 23. Prove that for all integers n, n ≥ 1

1 + 3 + 5 + · · · + (2n − 1) = n2 .

Exercise 24. Draw all non-isomorphic graphs with four vertices and at most four edges.

Exercise 25.

(i) Give an example of a connected graph with at least five vertices that has an Eulerian
circuit but doesn’t have a Hamiltonian cycle.

(ii) Can you find/describe a graph with n vertices that has an Eulerian circuit, but
doesn’t have a Hamiltonian cycle?

Show that graphs from (i) and (ii) have the specified properties.

Exercise 26. Give an example of two connected graphs with the same degree sequences
that are not isomorphic. Give a reason why they are not isomorphic.

Exercise 27. Figure out all values of k ∈ N for which there exists a connected graph
with the sequence (5, 5, 5, 5, 5, 5, 5, 5, 5, k). In each case either draw a graph or explain
why such a graph doesn’t exist.

Exercise 28. Decide whether the answer to each individual question below is ‘True’ or
‘False’ and give a reason.

(i) The complete bipartite graph Km,n is an Eulerian graph for any m, n ≥ 2.

(ii) If G is a simple graph with at least two vertices, then it is always possible to find
two vertices of G with the same degree.

(iii) If the degree of each vertex in a connected graph G is at least 2, then G is Hamil-
tonian.

(iv) If G is Hamiltonian, then the degree of each vertex is at least 2.

Exercise 29. What is the largest possible number of vertices in a connected graph with
35 edges, all vertices having degree at least 3? Can you verify your result and find a graph
with such properties?

You might also like