Final Exam

Final Exam

Part A

Question 1

In Company, there are 55 members of staff. Each member posts a greeting card to all the members. How many greeting cards where posted by them?

Each person posts to 54 people. Therefore:

55 * 54 = 2970

Question 2

Which of the following represents the set:

{1,12,13,14,15,16,17,18,19,110}\{−1, \frac{1}{2}, \frac{−1}{3},\frac{1}{4},\frac{−1}{5},\frac{1}{6},\frac{−1}{7},\frac{1}{8},\frac{−1}{9},\frac{1}{10} \}

(1)nn:nZ and 0n10}\frac{(-1)^n}{n} : n \in Z \text{ and } 0 \leq n \leq 10 \}

Question 3

Let RR be a relation on the set of positive integers with n R mn divides mn \ R \ m \rightarrow n \text{ divides } m

Which of the following statements is true about this relation RR?

  • It is reflexive. xS\forall x \in S, x R xx \ R \ x. A number always divides itself.
  • It is NOT symmetric. xS\forall x \in S, If x R yx \ R \ y, then y R xy \ R \ x is NOT true. For example, 2 / 4 is true, but 4 / 2 is false.
  • It is transitive. x,yS\forall x,y \in S if x R yx \ R \ y and y R zy \ R \ z then x R zx \ R \ z. If 2 / 4 and 4 / 8 then 2 / 8. If 3 / 6 and 6 / 60 then 3/ 60.

Therefore the answer is reflexive, transitive and NOT symmetric.

Question 4

Which of the following are not functions?

The trick to this will be to find the ones that have invalid input in the range.

a. f:RRf : R \rightarrow R f(x)=11+x2f(x) = \frac{1}{1 + x^2}

This is a function. As there are no negative numbers returned xR\forall x \in R, x2x^2, so it will never divide by 0.

b. f:RRf : R \rightarrow R f(x)=loge(x)f(x) = log_e(x)

This is NOT a function, as the range is invald when x0x \leq 0

c. f:RRf : R \rightarrow R f(x)=11x2f(x) = \frac{1}{1 - x^2}

This is NOT a function, as the range is invalid when x=1x = 1, 111=10\frac{1}{1-1} = \frac{1}{0}

d. f:QQf: Q \rightarrow Q f(x)=x2f(x) = \frac{x}{2}

This is a function. There isn't any number in the set of rational numbers that can't be divided by 2.

Question 5

Which degree sequence cannot represent a simple graph?

We know that for a simple graph, the degree of each vertex of G is at most equal to n1n-1.

Therefore: 2,4,3,32, 4, 3, 3 is not a simple graph.

Question 6

Let pp and qq be two propositions. Which one of the following logical expression is equivalent to ¬(pq)\neg (p \rightarrow q)

p q ¬p\neg p ¬q\neg q pqp \rightarrow q ¬(pq)\neg (p \rightarrow q) p¬qp \lor \neg q p¬qp \land \neg q ¬pq\neg p \land q ¬pq\neg p \lor q
0 0 1 1 1 0 1 0 0 1
0 1 1 0 1 0 0 0 1 1
1 0 0 1 0 1 1 1 0 0
1 1 0 0 1 0 1 0 0 1

Question 7

What is the number of edges in a complete graph K10K_{10}?

Number of edges in complete graph = KN=N(N1)/2K_N = N(N-1)/2

\begin{align} &= 10 * 9 / 2 \\ &= 90 / 2 \\ &= 45 \end{align}

Question 8

In how many ways a committee of 5 members can be selected from 6 men and 5 women, consisting of 3 men and 2 woman?

Number of ways we can select 3 men from 6 men (given order is not important):

n!k!(nk)!\frac{n!}{k!(n-k)!} 6!3!3!=20\frac{6!}{3! 3!} = 20

Number of ways we can select 2 woman from 5 woman:

5!2!3!=10\frac{5!}{2!3!} = 10

Using the multiplication principle, we get 20 * 10 = 200

Question 9

In how many ways can a football team of 11 be selected from a squad of 15 players?

15!11!4!=1365\frac{15!}{11!4!} = 1365

Question 10

Consider the following predicate logic statement:

xD\forall x \in D, yD\exists y \in D, (P(x)Q(x)R(x))(P(x) \land Q(x) \rightarrow R(x))

Which one of the predicate logic statements below is equivalent to the negation of the original statement?

¬(xD\neg (\forall x \in D, yD\exists y \in D, (P(x)Q(x)R(x)))(P(x) \land Q(x) \rightarrow R(x)))

(xD(\exists x \in D, yD\forall y \in D, ¬(P(x)Q(x)R(x)))\neg (P(x) \land Q(x) \rightarrow R(x)))

We can simplify that, knowing that the negation of PQP \rightarrow Q is P¬QP \land \neg Q

(xD(\exists x \in D, yD\forall y \in D, P(x)Q(x)¬R(x)))P(x) \land Q(x) \land \neg R(x)))

Part B

Question 1

a. List the elements of the following sets

i. {xxZ(x2=6)}\{x | x \in Z \land (x ^2 = 6)\}

\emptyset

ii. {xxZ(x2=9)}\{x | x \in Z \land (x ^2 = 9) \}

{3}\{ 3 \}

iii. {xxN(xmod2=1)(x<10)}\{x | x \in \mathbb{N} \land (x \mod 2 = 1) \land (x < 10) \}

{1,3,5,7,9}\{1, 3, 5, 7, 9\}

b. Let AA and BB be two sets such that A=B=n|A| = |B| = n and AB=1|A \cap B| = 1. Find:

i. AB|A \cup B|

\begin{align} |A \cup B| &= |A| + |B| - |A \cap B|\\ &= n + n - 1 \\ &= 2n - 1 \end{align}

ii. P(AB)|P(A \cup B)|

We know that P(S)=2S|P(S)| = 2^{|S|}. Therefore, P(AB)=22n1|P(A \cup B)| = 2^{2n-1}

c. Prove the following set identities, using either Venn Diagrams or the rules of sets. Show your working.

i. (AB)(AB)=A(A \cap B) \cup (A \cap B) = A

The set identity (AB)(AB)=A(A \cap B) \cup (A \cap B) = A is not correct.

It can be simplified based on absorption rule: (AB)=A(A \cap B) = A

It would only be correct when B=AB = A

This venn diagram shows that (AB)(AB)A(A \cap B) \cup (A \cap B) \neq A

final-exam-part-b-venn1

ii. (AB)CAC(A - B) - C \subseteq A - \overline{C}

This statement is FALSE.

This Venn Diagram shows that (AB)C⊈AC(A - B) - C \not \subseteq A - \overline{C}

final-exam-part-b-venn2

iii. (AC)(CB)=(A - C) \cap (C - B) = \emptyset

This Venn Diagram proves that this set identity is TRUE.

final-exam-part-b-venn3

d. Let pp, qq and rr be three propositions for which pp and qq are T and rr is false. Determine the truth value for each of the following.

i. p(rq)p \rightarrow (r \rightarrow q)

T(FT)T \rightarrow (F \rightarrow T) TTT \rightarrow T TT

ii. (pr)¬q(p \oplus r) \rightarrow \neg q

T¬TT \rightarrow \neg T TFT \rightarrow F FF

iii. p(rq)p \land (r \rightarrow q)

T(FT)T \land (F \rightarrow T) TTT \land T TT

e. The universe of discourse is the set of all positive integers, Z+\mathbb{Z}^{+}

What are the truth values for each of the following?

i. xy(xy)\exists x \forall y (x \leq y)

True

When x=1x = 1, xyx \leq y is true for all yZ+y \in Z^{+}

ii. xy(x+y=0)(xy=0)\exists x \exists y (x + y = 0) \lor (x \cdot y = 0)

False.

These are no positive integers that can be added to make zero, or multiplied to make zero. This would only be true if the universe of discourse included 0 or negative numbers.

iii. xy(xyx+y)\forall x \forall y (x \cdot y \geq x + y)

False.

When x=1x = 1 and y=1y = 1, xy=1x \cdot y = 1 and x+y=2x + y = 2, 1≱21 \not \geq 2

f. Re-write the following statements without any negations on quantifiers.

i. ¬xP(x)\neg \exists x P(x)

x¬P(x)\forall x \neg P(x)

ii. ¬x¬yP(x,y)\neg \exists x \neg \exists y P(x, y)

x¬¬yP(x,y)\forall x \neg \neg \exists y P(x, y)

x¬y¬P(x,y)\forall x \neg \forall y \neg P(x, y) xy¬¬P(x,y)\forall x \exists y \neg \neg P(x, y) xy¬P(x,y)\forall x \exists y \neg P(x, y)

iii. ¬xyP(x,y)\neg \exists x \forall y P(x, y)

xy¬P(x,y)\forall x \exists y \neg P(x, y)

g. Decide whether the following arguments are valid or not. State the Rule of Inference or fallacy userd.

Note: I assume this parent question description is wrong, based on the questions below it.

i. Let AA, BB, and CC be three sets. Prove by contradiction that if ABCA \cap B \subseteq C and xBx \in B then x∉ACx \not \in A - C

To prove by contradiction, we start on the assumption that the statement we want to prove is false, and show this leads to false proposition.

Assume that ABCA \cap B \subseteq C and xBx \in B then xACx \in A - C

From set difference, we have xAx \in A and x∉Cx \not \in C. Since xBx \in B, we have xABx \in A \cap B Therefore, we have xABx \in A \cap B and x∉Cx \not \in C, which contradicts the assumption that ABCA \cap B \subseteq C

Therefore, our assumption that xACx \in A - C must be false. This proves that ABCA \cap B \subseteq C and xBx \in B then x∉ACx \not \in A - C

ii. Suppose that I want to purchase a tablet computer. I can choose either a large or a small screen; a 64GB, 128GB or 256 GB storage capacity and black, while, gold or silve cover.

Screen options = 2 Storage capacity options = 3 Cover colour options = 4

Total options = 2 * 3 * 4 = 24


Question 3

a. Explain the difference between a Euler path and an Euler cycle

A Euler path is a path in a graph that visited each edge exactly once. A Eyler cycle is a Euler path that visits each edge exactly once, but which ends at the same vertex.

The key difference is that a Euler path ends at different vertices, where a cycle ends at the same vertex.

b. Find the maximum nnumber of comparisons to be made to find any record in a binary search tree which holds 3000 records.

Assuming the tree is balanaced, the maximum number of comparisons to be made is equal to the height.

We calculate the height as h=ceil(log2(N+1))h = \text{ceil}(log_2 (N + 1))

h = 9

Therefore, there are 9 comparisons to be made to find any record in a balanaced BST.

c. Explain what is meant by the term "path"

A path is a trail (where no edge is repeated) where neither vertices nor edges are repeated.

d. The figure shows a network of cycle tracks. The number on each edge represents the length, in milse, of that track. Jay wishse sto cycle from A to I as part of a cycling holiday. She wishes to minimise the distance she travels.

Init.

Node Shortest path from A
A 0

Unvisited = {B, D, E, C, F, G, H, I}

Step 2.

Visit B.

Node Shortest path from A Previous vertex
A 0 A
B 23 A

Unvisited = {D, E, C, F, G, H, I}

Step 3.

Visit E.

Node Shortest path from A Previous vertex
A 0 A
B 23 A
E 23 + 27 B

Unvisited = {D, C, F, G, H, I}

Step 4.

Visit D

Node Shortest path from A Previous vertex
A 0 A
B 23 A
E 23 + 27 B
D 23 + 28 B

Unvisited = {D, C, F, G, H, I}

Step 5.

Visit C

Node Shortest path from A Previous vertex
A 0 A
B 23 A
E 23 + 27 B
D 23 + 28 B
C 39 A

Unvisited = {F, G, H, I}

Step 6.

Visit F

Node Shortest path from A Previous vertex
A 0 A
B 23 A
E 23 + 27 =50 B
D 23 + 28 = 51 B
C 39 A
F 51 + 21 = 83 D

Unvisited = {G, H, I}

Step 7.

Visit G

Node Shortest path from A Previous vertex
A 0 A
B 23 A
E 23 + 27 =50 B
D 23 + 28 = 51 B
C 39 A
F 51 + 21 = 83 D
G 51 +37 = 88 D

Unvisited = {H, I}

Step 7.

Visit G

Node Shortest path from A Previous vertex
A 0 A
B 23 A
E 23 + 27 =50 B
D 23 + 28 = 51 B
C 39 A
F 51 + 21 = 83 D
G 51 +37 = 88 D

Unvisited = {H, I}

Step 8.

Visit I

Node Shortest path from A Previous vertex
A 0 A
B 23 A
E 23 + 27 =50 B
D 23 + 28 = 51 B
C 39 A
F 51 + 21 = 83 D
G 51 +37 = 88 D
I 88 + 21 = 109 G

Unvisited = {H}

Shortest path: A -> B -> D -> G -> I


e) Given SS is the st of integers {2, 3, 4, 5, 6, 7, 8}. Let R be a relation defined on S by the following condition such that:

x,yS\forall x, y \in S, if x R yx \ R \ y then x mod 2 = y mod 2

i. Draw the digraph of R

final-exam-part-b-digraph

ii. Show that R is an equivalence relation.

  • R is reflexive. xS\forall x \in S, x R xx \ R \ x
  • R is symmetric. x,yS\forall x, y \in S, if x R yx \ R \ y, then y R xy \ R \ x
  • R is transitive. x,y,zS\forall x, y, z \in S, if x R yx \ R \ y AND y R zy \ R \ z then x R zx \ R \ z

Therefore RR is a equivalence relation.

iii. Find the equivalence classes for R.

  • {2,4,6,8}\{ 2, 4, 6, 8\}
  • {3,5,7,9}\{3, 5, 7, 9\}

iv. Is item R a partial order?

To be a partial order, R must reflexive, transitive and ANTI-symmetric. R is NOT anti-symmetric. x,y\forall x, y, if x R yx \ R \ y and y R xy \ R \ x it is NOT the case that x=yx = y for example 2R42 R 4 and 4R24 R 2 but 242 \neq 4

f. Let f:ABf : A → B and g:BCg : B → C be functions. Prove that if g o f is one-to-one , then f is one-to-one.

Proof

Since g o fg \ o \ f is one-to-one, we show that for all a,bAa, b \in A if aba \ne b then f(a)f(b)f(a) \ne f(b)

g o fg \ o \ f is a one-to-one function. So, given a,bAa, b \in A with aba \ne b then (gof)(a)(gof)(b)(gof)(a) \ne (gof)(b)

Therefore, g(f(a))g(f(b))g(f(a)) \ne g(f(b)).

Therefore, f(a)f(b)f(a) \ne f(b), which implies ff is a one to one function.