You are on page 1of 8

DISCRETE MATHEMATICS

November 3, 2016
PARTIAL EXAM

Put your name, surname, and NIA in all sheets.


Do different exercises on separate sheets.
You are not allowed to use calculators or cell phones.
Plagiarism will have as a consequence a 0 grade for the term.

1. (2 points)
a) Prove the sequent: (p q) ` p.
Solution: We give two possible demonstrations. First possibility:
1.
2.
3.
4.
5.
6.

(p q)
p
p q

p
p

Premise
Assumption
i1 2
e 3, 1
i 2-4
5

1.
2.
3.
4.
5.

(p q)
p
p q

Premise
Assumption
i1 2
e 3, 1
RAA 2-4

Second possibility:

b) Using the rules of Natural Deductions, prove that p p (p q) is a theorem, that is, prove
` p p (p q).
Solution: We give two possible solutions. First possibility:
1. p
2. p (p q)
3. p p (p q)

Assumption
i1 1
i 1-2

1.
2.
3.
4.

Assumption
i2 1
i1 2
i 1-3

Second possibility:
p
pq
p (p q)
p p (p q)

2. (2 points)
a) Prove that A B C = A B C.

Solution: This exercise asks for a proof of a generalization of one of De Morgans laws for sets
from two sets to three. We can prove that in two different ways:
/ A B C, which means that x fails to be in at least one
I) Suppose x A B C. Then x
of these three sets. In other words, x
/ A or x
/ B or x
/ C. This is equivalent to saying that
x A or x B or x C. Therefore x A B C, as desired. Conversely, if x A B C,
then x A or x B or x C. This means x
/ A or x
/ B or x
/ C, so x cannot be in the
intersection of A, B and C. Since x
/ A B C, we conclude that x A B C, as desired.
II) The following
identical.
A B C A
1 1 1 0
1 1 0 0
1 0 1 0
1 0 0 0
0 1 1 1
0 1 0 1
0 0 1 1
0 0 0 1

membership table gives the desired equality, since columns five and nine are
B
0
0
1
1
0
0
1
1

C
0
1
0
1
0
1
0
1

ABC
0
1
1
1
1
1
1
1

ABC
1
0
0
0
0
0
0
0

ABC
0
1
1
1
1
1
1
1

b) Prove that (A \ B) (B \ A) A B.
Solution: We give the proof in two differet ways:
I) Let x (A \ B) (B \ A) arbitrary. We proceed by cases:
Case 1: x A \ B. Then x A i x
/ B. Hence, x
/ A B, which is equivalent to x A B.
Case 2: x B \ A. Then x B i x
/ A. Hence, x
/ A B and so x A B.
Therfore, in both cases x A B. Therefore, since x is arbitrary, we conclude that (A \ B)
(B \ A) A B.
II) The following membership table gives the inclusion that we want to show since when we
have a 1 in the column of the set (A \ B) (B \ A) there is also a 1 in the column of the set
A B.
A
1
1
0
0

B
1
0
1
0

A\B
0
1
0
0

B\A
0
0
1
0

(A \ B) (B \ A)
0
1
1
0

AB
1
0
0
0

AB
0
1
1
1

3. (2 points)
a) Translate each of these statements into logical expressions using quantifiers, predicates and
variables.
(a) There is one student in class who could not study for the exam. Specify the universe of
discourse.
Solution:
First possibility - Universe of discourse: students in the class.
E(x) is the predicate student x could study for the exam. Then, the formula is xE(x).

Second possibility - Universe of discourse: students at university.


C(x) is the predicate student x is in this class.
E(x) is the predicate student x could study for the exam. Then, the formula is x(C(x)
E(x)).
(b) Every human being is mortal. Consider the set of living beings as the universe of discourse.
Solution:
Universe of discourse: set of living beings.
H(x) is the predicate x is a human being.
M(x) is the predicate x is mortal. Then, the formula is x(H(x) M (x)).
b) Let P (b, c) be the predicate Equation bx = c has only one solution x R, where b and c are
any real numbers. Provide a counterexample that shows that the next statement is not true:
bcP (b, c).
Solution:
The counterexample is b = 0, for which the equation turns into
0 = c.
In this case, either there is no solution (c 6= 0), or there is an infinite number of solutions (if
c = 0). For all the other values of b, equation bx = c has a unique solution : x = c/b, so only
one counterexample exists.
4. (2 points)
a) Prove that for every integer n, at least one of the integers n, n + 2, n + 4 is divisible by 3. Hint:
Try a proof by cases.
Solution: By the Division Theorem, we can split the proof in 3 cases
n = 3k. In this case, n is divisible by 3.
n = 3k + 1. In this case, n + 2 = 3k + 3 is divisible by 3.
n = 3k + 2. In this case n + 4 = 3k + 6 is divisible by 3.
b) What are the solutions of the linear congruence 4x 2 (mod 7)?
Solution: Since gcd(4,7)=1, 4 has a multiplicative inverse mod 7. we observe that 42 = 8 1
(mod 7). We can conclude that the multiplicative inverse of 4 is 2. Now we proceed to solve
the linear congruence:
4x 2 (mod 7)
2 4x 2 2
x4

(mod 7)

(mod 7)

so its solutions are all integers of the form x = 4 + 7k, k Z.


5. (2 points)

a) Prove using induction that 1 21 + 2 22 + 3 23 + . . . + n 2n = (n 1)2n+1 + 2 for all positive


integers n.
Solution: Let P (n) be the statement 1 21 + 2 22 + 3 23 + . . . + n 2n = (n 1)2n+1 + 2. We
will prove using induction that P (n) is true for all positive integers n.
BASIS: P (1) is true because 1 21 = (1 1)21+1 + 2 = 2.
INDUCTION: Let us assume that P (k) is true. We must show that P (k + 1) is also true.
I.H.

1 21 + 2 22 + 3 23 + . . . + k 2k + (k + 1) 2k+1 =

= (k 1)2k+1 + 2 + (k + 1) 2k+1 = 2k 2k+1 + 2 = k 2k+2 + 2


b) We define set S recursively as follows:
BASIS STEP: 2 S, 7 S
RECURSIVE STEP: if x S and y S then x y S
Prove that 0 S, 1 S and 10 S.
Solution:
Step 0: 2 S, 7 S
Step 1: 2 2 = 0 S, 7 2 = 5 S, 2 7 = 5 S
Step 2: 5 (5) = 10 S, 5 2 = 3 S, etc.
Step 3: 3 2 = 1 S, etc.

`
MATEMATICA
DISCRETA
3 de novembre de 2016
EXAMEN PARCIAL

Poseu el nom i el NIA a tots els fulls.


Feu els exercicis en fulls separats.
s de calculadores ni mo
` bils.
No es permet lu
En cas de c`
opia de qualsevol tipus saplicar`
a com a sanci
o el suspens de leix.

1. (2 punts)
a) Demostreu el seq
uent: (p q) ` p.
Solution: Donem dues demostracions possibles. Primera possibilitat:
1.
2.
3.
4.
5.
6.

(p q)
p
p q

p
p

Premissa
Assumpcio
i1 2
e 3, 1
i 2-4
5

1.
2.
3.
4.
5.

(p q)
p
p q

Premissa
Assumpcio
i1 2
e 3, 1
RAA 2-4

Segona possibilitat:

b) Demostreu, fent servir les regles dinfer`encia, que p p (p q) es un teorema, es a dir, proveu
` p p (p q).
Solution: Donem tambe dues demostracions possibles. Primera possibilitat:
1. p
2. p (p q)
3. p p (p q)

Assumpcio
i1 1
i 1-2

1.
2.
3.
4.

Assumpcio
i2 1
i1 2
i 1-3

Segona possibilitat:
p
pq
p (p q)
p p (p q)

2. (2 punts)
a) Demostreu que A B C = A B C.

Solution: En aquest exercici es demana una prova duna generalitzacio duna de les lleis de
De Morgan per conjunts. Es generalitza veient que tambe es v`alida per a tres conjunts. Donem
dues possibles demostracions:
I) Suposem que x A B C. Aleshores x
/ A B C, que vol dir que x com a mnim
no hi es en algun daquests tres conjunts. En altres paraules, x
/ Aox
/ Box
/ C. Aix`
o
es equivalent a dir que x A o x B o x C. Per tant, x A B C, com volem veure.
Recprocament, si x A B C, aleshores x A o x B o x C. Aix`o vol dir que x
/Ao
x
/ Box
/ C, i aix x no pot estar en la interseccio dA, B i C. Donat que x
/ A B C,
podem concloure que x A B C, tal com volem.
II) La taula de pertinyenca seg
uent dona la igualtat que volem demostrar, ja que les columnes
cinc i nou s
on id`entiques.
A
1
1
1
1
0
0
0
0

B
1
1
0
0
1
1
0
0

C
1
0
1
0
1
0
1
0

A
0
0
0
0
1
1
1
1

B
0
0
1
1
0
0
1
1

C
0
1
0
1
0
1
0
1

ABC
0
1
1
1
1
1
1
1

ABC
1
0
0
0
0
0
0
0

ABC
0
1
1
1
1
1
1
1

b) Demostreu que (A \ B) (B \ A) A B.
Solution: Donem dues possibles demostracions:
I) Sigui x (A \ B) (B \ A) arbitrari. Procedirem per casos:
Cas 1: x A \ B. Aleshores x A i x
/ B. Per tant, x
/ A B, que equival a dir que
x A B.
Cas 2: x B \ A. Aleshores x B i x
/ A. Per tant, x
/ A B i tambe x A B.
Aix, en els dos casos x A B. Per tant, com que x es arbitrari, podem concloure que
(A \ B) (B \ A) A B.
II) La taula de pertinyenca seg
uent dona la contencio que volem demostrar, ja que sempre que
hi ha un 1 a la columna del conjunt (A \ B) (B \ A) tambe hi ha un 1 a la columna de A B.
A
1
1
0
0

B
1
0
1
0

A\B
0
1
0
0

B\A
0
0
1
0

(A \ B) (B \ A)
0
1
1
0

AB
1
0
0
0

AB
0
1
1
1

3. (2 punts)
a) Traduir cadascuna daquestes proposicions en expressions l`ogiques fent servir quantificadors,
predicats i variables.
1) Hi ha un estudiant a la classe que no va poder estudiar per lexamen. Especifiqueu lunivers
del discurs.

Solution:
Primera possibilitat - Univers del discurs: estudiants a la classe.
E(x) es el predicat estudiant x ha pogut estudiar per lexamen. Llavors, la formula es
xE(x).
Segona possibilitat - Univers del discurs: estudiants a la universitat.
C(x) es el predicat estudiant x es a la classe.
E(x) es el predicat estudiant x ha pogut estudiar per lexamen. Llavors, la formula es
x(C(x) E(x)).
2) Tots els humans s
on mortals. Preneu com a univers del discurs el conjunt dels essers vius.
Solution:
Univers del discurs: conjunt dels essers vius.
H(x) es el predicat x es un esser viu.
M(x) es el predicat x es mortal. Llavors, la formula es x(H(x) M (x)).
b) Sigui P (b, c) el predicat Lequacio bx = c te una u
nica solucio x R, on b i c son nombres
reals qualssevol. Doneu un contraexemple que demostri que la seg
uent proposicio es falsa:
bcP (b, c).

Solution:
El contraexemple es b = 0. En aquest cas, lequacio esdeve
0=c
, que, o be no te cap soluci
o (si c 6= 0), o be te infinites solucions (si c = 0). Per la resta de
valors de b, lequaci
o te una u
nica solucio: x = c/b, i per tant l
unic contraexemple possible es
b = 0.
4. (2 punts)
a) Proveu que per a cada n
umero enter n, almenys un dels enters n, n + 2, n + 4 es divisible per 3.
: Feu una demostraci
Indicacio
o per casos.
Solution: Pel teorema de la divisio entera, considerem 3 casos:
n = 3k. En aquest cas n ja es divisible per 3.
n = 3k + 1. En aquest cas n + 2 = 3k + 3 es divisible per 3.
n = 3k + 2. En aquest cas n + 4 = 3k + 6 es divisible per 3.
b) Quines s
on les solucions de la congru`encia lineal 4x 2 (mod 7)?
Solution: Com que mcd(4,7)=1, 4 te invers multiplicatiu m`odul 7. Observem que 4 2 = 8 1
(mod 7). Per tant, linvers multiplicatiu de 4 es 2. Podem ara resoldre la congru`encia:
4x 2

(mod 7)

2 4x 2 2

(mod 7)

x4

(mod 7)

i per tant les solucions s


on tots els enters congruents amb 4 m`odul 7, que es poden escriure de
la forma x = 4 + 7k, k Z.
5. (2 punts)
a) Demostreu per inducci
o que 1 21 + 2 22 + 3 23 + . . . + n 2n = (n 1)2n+1 + 2 per tot enter
positiu n.
Solution: Anomenem P (n) a la proposicio 1 21 + 2 22 + 3 23 + . . . + n 2n = (n 1)2n+1 + 2.
Demostrarem per inducci
o que P (n) es cert per tot n enter positiu.
BASE: P (1) es cert perque 1 21 = (1 1)21+1 + 2 = 2.
Suposem P (k) cert. Hem de veure que P (k + 1) es cert.
INDUCCIO:
H.I.

1 21 + 2 22 + 3 23 + . . . + k 2k + (k + 1) 2k+1 =

= (k 1)2k+1 + 2 + (k + 1) 2k+1 = 2k 2k+1 + 2 = k 2k+2 + 2


b) Definim el conjunt S recursivament de la forma seg
uent:
BASE: 2 S, 7 S
Si x S i y S aleshores x y S
RECURSIO:
Proveu que 0 S, 1 S i 10 S.
Solution:
Etapa 0: 2 S, 7 S
Etapa 1: 2 2 = 0 S, 7 2 = 5 S, 2 7 = 5 S
Etapa 2: 5 (5) = 10 S, 5 2 = 3 S, etc.
Etapa 3: 3 2 = 1 S, etc.

You might also like