DarthDemono's Notes for ELTE

Sample Exam Solutions Spring 2026

25 min read

Discrete Mathematics — Lecture Exam Sample (Spring 2026) — Worked Solutions

All notation matches the lecture slides. Answers chosen to be the simplest correct ones for the exam.


Part 1 — Short questions (18 marks)

1. Two properties of inclusive or (∨) — (1 mark)

Any two of the following (definition excluded):

  • Commutativity: p∨q⇔q∨pp \lor q \Leftrightarrow q \lor p
  • Associativity: p∨(q∨r)⇔(p∨q)∨rp \lor (q \lor r) \Leftrightarrow (p \lor q) \lor r
  • Idempotence: p∨p⇔pp \lor p \Leftrightarrow p
  • De Morgan: ¬(p∨q)⇔¬p∧¬q\lnot(p \lor q) \Leftrightarrow \lnot p \land \lnot q
  • Distributivity: p∨(q∧r)⇔(p∨q)∧(p∨r)p \lor (q \land r) \Leftrightarrow (p \lor q) \land (p \lor r)

2. Cartesian product — (2 marks)

(a) The Cartesian product of two sets AA and BB is the set of all ordered pairs whose first component is from AA and whose second component is from BB:

A×B={(a,b)∣a∈A∧b∈B}.A \times B = \{(a,b) \mid a \in A \land b \in B\}.

(b) For A={1,2,3}A = \{1,2,3\}, B={a,b,c}B = \{a,b,c\}:

A×B={(1,a),(1,b),(1,c),(2,a),(2,b),(2,c),(3,a),(3,b),(3,c)}.A \times B = \{(1,a),(1,b),(1,c),(2,a),(2,b),(2,c),(3,a),(3,b),(3,c)\}.

3. Composition of two binary relations — (1 mark)

Let RR and SS be binary relations. Their composition S∘RS \circ R is the relation defined by

(x,z)∈S∘R  ⟺  ∃y: (x,y)∈R ∧ (y,z)∈S.(x,z) \in S \circ R \iff \exists y:\ (x,y) \in R \ \land\ (y,z) \in S.

(That is, RR is applied first, then SS.)


4. Transitivity — (2 marks)

(a) A binary relation R⊆X×XR \subseteq X \times X is transitive if for all x,y,z∈Xx,y,z \in X:

((x,y)∈R ∧ (y,z)∈R)⇒(x,z)∈R.\big((x,y) \in R \ \land\ (y,z) \in R\big) \Rightarrow (x,z) \in R.

(b) Example on A={a,b,c,d,e}A = \{a,b,c,d,e\}: the empty relation R=∅R = \varnothing is transitive; or, for a non-trivial one,

R={(a,b),(b,c),(a,c)}.R = \{(a,b),(b,c),(a,c)\}.

Check: the only "chained" pair is (a,b),(b,c)(a,b),(b,c), and indeed (a,c)∈R(a,c) \in R. (The identity relation {(a,a),(b,b),(c,c),(d,d),(e,e)}\{(a,a),(b,b),(c,c),(d,d),(e,e)\} also works.)


5. Equivalence relation — (2 marks)

(a) A binary relation ∼\sim on a set is an equivalence relation if it is reflexive, symmetric and transitive.

(b) Example: X=ZX = \mathbb{Z} and a∼b  ⟺  a−ba \sim b \iff a - b is even (i.e. congruence mod 2). This is reflexive, symmetric and transitive. (Simpler finite example: X={1,2,3}X = \{1,2,3\} with ∼\sim = equality, ∼={(1,1),(2,2),(3,3)}\sim = \{(1,1),(2,2),(3,3)\}.)


6. Surjective function — (2 marks)

(a) A function f:X→Yf: X \to Y is surjective (onto) if every element of YY is the image of at least one element of XX:

∀y∈Y ∃x∈X: f(x)=y.\forall y \in Y\ \exists x \in X:\ f(x) = y.

(b) Example f:{a,b,c,d}→{1,2,3}f: \{a,b,c,d\} \to \{1,2,3\} hitting all of {1,2,3}\{1,2,3\}:

f(a)=1,f(b)=2,f(c)=3,f(d)=3.f(a)=1,\quad f(b)=2,\quad f(c)=3,\quad f(d)=3.

7. Complex numbers — (2 marks)

(a) Any four (definitions excluded), e.g.:

  • z‾‾=z\overline{\overline{z}} = z
  • z+w‾=z‾+w‾\overline{z+w} = \overline{z} + \overline{w}
  • z⋅w‾=z‾⋅w‾\overline{z \cdot w} = \overline{z}\cdot\overline{w}
  • z⋅z‾=∣z∣2z \cdot \overline{z} = |z|^2
  • ∣z‾∣=∣z∣|\overline{z}| = |z|
  • ∣z⋅w∣=∣z∣⋅∣w∣|z \cdot w| = |z|\cdot|w|
  • z+z‾=2 Re(z)z + \overline z = 2\,\mathrm{Re}(z)

(b) For z=−3−2iz = -3 - 2i:

∣z∣=(−3)2+(−2)2=9+4=13,z‾=−3+2i.|z| = \sqrt{(-3)^2 + (-2)^2} = \sqrt{9+4} = \sqrt{13}, \qquad \overline{z} = -3 + 2i.

8. Permutations with repetition (statement) — (1 mark)

The number of permutations with repetition of mm different kinds of objects, with repetition numbers k1,k2,…,kmk_1, k_2, \ldots, k_m (i.e. kik_i copies of the ii-th kind), is

n!k1! k2!⋯km!,where n=k1+k2+⋯+km is the total number of objects.\frac{n!}{k_1!\, k_2! \cdots k_m!}, \qquad \text{where } n = k_1 + k_2 + \cdots + k_m \text{ is the total number of objects.}

9. Binomial theorem — (2 marks)

(a) For any real numbers x,yx, y and any n∈Nn \in \mathbb{N}:

(x+y)n=∑k=0n(nk)xky n−k,(x+y)^n = \sum_{k=0}^{n} \binom{n}{k} x^k y^{\,n-k},

where (nk)\binom{n}{k} is the binomial coefficient "nn choose kk".

(b)

(x+y)6=(60)y6+(61)xy5+(62)x2y4+(63)x3y3+(64)x4y2+(65)x5y+(66)x6(x+y)^6 = \binom{6}{0}y^6 + \binom{6}{1}x y^5 + \binom{6}{2}x^2 y^4 + \binom{6}{3}x^3 y^3 + \binom{6}{4}x^4 y^2 + \binom{6}{5}x^5 y + \binom{6}{6}x^6
=y6+6xy5+15x2y4+20x3y3+15x4y2+6x5y+x6.= y^6 + 6x y^5 + 15 x^2 y^4 + 20 x^3 y^3 + 15 x^4 y^2 + 6 x^5 y + x^6.

10. Two properties of binomial coefficients — (1 mark)

Any two of:

  • Symmetry: (nk)=(nn−k)\dbinom{n}{k} = \dbinom{n}{n-k}
  • Pascal's identity: (n+1k+1)=(nk)+(nk+1)\dbinom{n+1}{k+1} = \dbinom{n}{k} + \dbinom{n}{k+1}
  • ∑k=0n(nk)=2n\displaystyle\sum_{k=0}^{n}\binom{n}{k} = 2^n

11. Pigeonhole principle — (1 mark)

If n+1n+1 items are put into nn containers, then there is at least one container that contains at least two items.


12. Definition of an undirected graph — (1 mark)

A triple G=(φ,E,V)G = (\varphi, E, V) is an (undirected) graph if EE and VV are sets with V≠∅V \neq \varnothing, V∩E=∅V \cap E = \varnothing, and

φ:E→{{v,v′}∣v,v′∈V}.\varphi: E \to \big\{\{v,v'\} \mid v, v' \in V\big\}.

Here VV is the set of vertices, EE the set of edges, and φ\varphi the incidence function, which assigns to each edge an unordered pair of vertices.


Part 2 — Proof questions (16 marks)

Scoring: statement 1 mark, proof 3 marks. For two/three statements the marks split evenly.

P1. Three properties of set union, with proofs — (4 marks)

I prove idempotence, associativity and the empty-set property. Each set proof reduces the statement to the corresponding logical law via the definition of ∪\cup.

(i) Idempotence: A∪A=AA \cup A = A.

x∈A∪A⇔(1)(x∈A∨x∈A)⇔(2)x∈A.x \in A \cup A \overset{(1)}{\Leftrightarrow} (x \in A \lor x \in A) \overset{(2)}{\Leftrightarrow} x \in A.
  1. (1) definition of ∪\cup; (2) idempotence of ∨\lor.

(ii) Associativity: A∪(B∪C)=(A∪B)∪CA \cup (B \cup C) = (A \cup B) \cup C.

x∈A∪(B∪C)⇔(1)x∈A∨x∈(B∪C)⇔(1)x∈A∨(x∈B∨x∈C)⇔(2)(x∈A∨x∈B)∨x∈C⇔(1)x∈(A∪B)∨x∈C⇔(1)x∈(A∪B)∪C. \begin{aligned} x \in A \cup (B \cup C) &\overset{(1)}{\Leftrightarrow} x \in A \lor x \in (B \cup C) \overset{(1)}{\Leftrightarrow} x \in A \lor (x \in B \lor x \in C)\\ &\overset{(2)}{\Leftrightarrow} (x \in A \lor x \in B) \lor x \in C \overset{(1)}{\Leftrightarrow} x \in (A \cup B) \lor x \in C\\ &\overset{(1)}{\Leftrightarrow} x \in (A \cup B) \cup C. \end{aligned}
  1. (1) definition of ∪\cup; (2) associativity of ∨\lor.

(iii) Empty set: A∪∅=AA \cup \varnothing = A.

x∈A∪∅⇔(1)(x∈A∨x∈∅)⇔(2)(x∈A∨F)⇔(3)x∈A.x \in A \cup \varnothing \overset{(1)}{\Leftrightarrow} (x \in A \lor x \in \varnothing) \overset{(2)}{\Leftrightarrow} (x \in A \lor F) \overset{(3)}{\Leftrightarrow} x \in A.
  1. (1) definition of ∪\cup; (2) definition of ∅\varnothing (no element lies in ∅\varnothing, so x∈∅x \in \varnothing is false FF); (3) property of ∨\lor (p∨F⇔pp \lor F \Leftrightarrow p).

(Commutativity A∪B=B∪AA \cup B = B \cup A via commutativity of ∨\lor is an equally valid third choice.)


P2. Associativity of the composition of binary relations — (4 marks)

Statement. Let R,S,TR, S, T be binary relations. Then composition is associative:

T∘(S∘R)=(T∘S)∘R,T \circ (S \circ R) = (T \circ S) \circ R,

where for relations P,QP, Q the composition is (x,z)∈Q∘P  ⟺  ∃y: (x,y)∈P∧(y,z)∈Q(x,z) \in Q \circ P \iff \exists y:\ (x,y)\in P \land (y,z)\in Q.

Proof. We show that an ordered pair belongs to the left-hand side exactly when it belongs to the right-hand side.

(x,w)∈T∘(S∘R)⇔(1)∃v: (x,v)∈S∘R ∧ (v,w)∈T⇔(1)∃v: (∃u: (x,u)∈R∧(u,v)∈S)∧(v,w)∈T⇔(2)∃u ∃v: (x,u)∈R ∧ (u,v)∈S ∧ (v,w)∈T⇔(2)∃u: (x,u)∈R ∧ (∃v: (u,v)∈S∧(v,w)∈T)⇔(1)∃u: (x,u)∈R ∧ (u,w)∈T∘S⇔(1)(x,w)∈(T∘S)∘R. \begin{aligned} (x,w) \in T \circ (S \circ R) &\overset{(1)}{\Leftrightarrow} \exists v:\ (x,v) \in S\circ R \ \land\ (v,w) \in T\\ &\overset{(1)}{\Leftrightarrow} \exists v:\ \big(\exists u:\ (x,u)\in R \land (u,v)\in S\big) \land (v,w)\in T\\ &\overset{(2)}{\Leftrightarrow} \exists u\,\exists v:\ (x,u)\in R \ \land\ (u,v)\in S \ \land\ (v,w)\in T\\ &\overset{(2)}{\Leftrightarrow} \exists u:\ (x,u)\in R \ \land\ \big(\exists v:\ (u,v)\in S \land (v,w)\in T\big)\\ &\overset{(1)}{\Leftrightarrow} \exists u:\ (x,u)\in R \ \land\ (u,w) \in T\circ S\\ &\overset{(1)}{\Leftrightarrow} (x,w) \in (T\circ S)\circ R. \end{aligned}
  1. (1) definition of composition; (2) reordering and regrouping the existential quantifiers and conjunctions (the order of the independent "intermediate" elements u,vu,v does not matter, and ∧\land is associative/commutative). Since the two relations contain exactly the same pairs, T∘(S∘R)=(T∘S)∘RT \circ (S \circ R) = (T \circ S) \circ R. ■\blacksquare

P3. Formula for the nthn^{\text{th}} roots of a complex number — (4 marks)

Statement. Let z=∣z∣(cos⁡φ+isin⁡φ)z = |z|(\cos\varphi + i\sin\varphi) be a complex number given in polar form and n∈N+n \in \mathbb{N}^+. The nthn^{\text{th}} roots of zz (the numbers ww with wn=zw^n = z) are exactly

wk=∣z∣n(cos⁡ ⁣(φn+2kπn)+isin⁡ ⁣(φn+2kπn)),k=0,1,…,n−1.w_k = \sqrt[n]{|z|}\left(\cos\!\Big(\tfrac{\varphi}{n} + \tfrac{2k\pi}{n}\Big) + i\sin\!\Big(\tfrac{\varphi}{n} + \tfrac{2k\pi}{n}\Big)\right), \qquad k = 0,1,\ldots,n-1.

Proof. Write a candidate root in polar form as w=∣w∣(cos⁡ψ+isin⁡ψ)w = |w|(\cos\psi + i\sin\psi). By De Moivre's formula,

wn=∣w∣n(cos⁡nψ+isin⁡nψ).w^n = |w|^n(\cos n\psi + i\sin n\psi).

Hence wn=zw^n = z is equivalent to

∣w∣n(cos⁡nψ+isin⁡nψ)=∣z∣(cos⁡φ+isin⁡φ).|w|^n(\cos n\psi + i\sin n\psi) = |z|(\cos\varphi + i\sin\varphi).

Two complex numbers in polar form are equal iff their absolute values are equal and their arguments differ by an integer multiple of 2π2\pi. Therefore this holds iff

∣w∣n=∣z∣ ⇔ ∣w∣=∣z∣n,andnψ=φ+2kπ  for some k∈Z ⇔ ψ=φn+2kπn.|w|^n = |z| \ \Leftrightarrow\ |w| = \sqrt[n]{|z|}, \qquad\text{and}\qquad n\psi = \varphi + 2k\pi \ \text{ for some } k\in\mathbb{Z} \ \Leftrightarrow\ \psi = \frac{\varphi}{n} + \frac{2k\pi}{n}.

The values k=0,1,…,n−1k = 0, 1, \ldots, n-1 give nn distinct arguments (they differ by less than 2π2\pi), and any other integer kk reproduces one of these (since the arguments repeat with period 2π2\pi in ψ\psi). Thus there are exactly the nn roots w0,…,wn−1w_0, \ldots, w_{n-1} given above. ■\blacksquare


P4. Number of combinations with repetition — (4 marks)

Statement. Let n∈N+n \in \mathbb{N}^+ and k∈Nk \in \mathbb{N}. The number of kk-combinations with repetition of an nn-element set (selections of kk elements, repetition allowed, order irrelevant) is

(n+k−1k).\binom{n+k-1}{k}.

Proof. Let A={a1,a2,…,an}A = \{a_1, a_2, \ldots, a_n\}. Any kk-combination with repetition is determined solely by how many times each element is chosen, so we may encode it as a 00–11 sequence:

1,1,…,1⏟number of a1’s, 0, 1,…,1⏟number of a2’s, 0, … ,0, 1,…,1⏟number of an’s.\underbrace{1,1,\ldots,1}_{\text{number of } a_1\text{'s}},\,0,\,\underbrace{1,\ldots,1}_{\text{number of } a_2\text{'s}},\,0,\ \ldots\ ,0,\,\underbrace{1,\ldots,1}_{\text{number of } a_n\text{'s}}.

The block of 11's before the first 00 tells how many a1a_1's were chosen, the next block how many a2a_2's, and so on. This sequence contains exactly kk ones (one per chosen element) and n−1n-1 zeros (the separators between the nn groups), so it has length n−1+kn - 1 + k. Conversely, every such sequence corresponds to exactly one combination with repetition.

The number of such sequences equals the number of ways to choose the kk positions for the 11's among the n+k−1n+k-1 positions, which is (n+k−1k)\dbinom{n+k-1}{k}. Hence the number of kk-combinations with repetition of AA is (n+k−1k)\dbinom{n+k-1}{k}. ■\blacksquare


Mark check

  • Part 1: 18 marks available — all answered (need ≥ 9 to pass).
  • Part 2: 16 marks available — all four proofs answered (need ≥ 7 to pass).
  • Reaching ≥ 29 total qualifies for grade 5.