Mid Term

(1a) Are the following expressiongs ¬p(qr)\neg p \to (q\to r) and q(pr)q \to (p \lor r) logically equivalent? Prove or Disprove.

Solution

Todo

(1b) Determine the truth value of the statement: ab(b2a)\exists a \forall b (b^2 \ges a) if the domain of the variable consists of the positive (non-zero) real numbers.

Solution

The statement is false. There are three cases:
case #1: a>1a>1, when b=1b=1, b2ab^2 \ges a is false.
case #2: a=1a=1, when b=0.5b=0.5, b2ab^2 \ges a is false.
case #3: 0<a<10<a<1, when b=ab=a, b2ab^2 \ges a is false.
No matter what value we choose for aa in its domain, there is alwasy some value for bb, that b2ab^2 \ges a is false.

Solution

Let pp be the statement ab(b2a)\exists a \forall b (b^2 \ges a) and ss be the statement ¬p\neg p.

s¬(ab(b2a))ab(b2<a)\begin{aligned} s &\equiv \neg(\exists a \forall b (b^2 \ges a))\\ &\equiv \forall a \exists b (b^2 < a)\\ \end{aligned}

For every aa, let b=a2b=\frac{\sqrt a}{2}, we have

b2=(a2)2b2=a4<a\begin{aligned} b^2 &= (\frac{\sqrt a}{2})^2\\ b^2 &= \frac{a}{4} < a \end{aligned}

Thus the statement ss is true, and the original statement pp is false.

(2a) Prove that: 23\sqrt[3]{2} is irrational.

Solution

Todo

(2b) Let k be interger. Prove: If k3k^3 is odd, then k2+1k^2 + 1 is even.

Solution

To prove the statment, we first need to prove that if k3k^3 is odd, then kk is odd.
(1) By contrapositive, the contraposition is: if kk is even, then k3k^3 is even.
Let k=k=, where nn is an integer. We have

k3=(2n)3=8n3=2(4n3)\begin{aligned} k^3 &=(2n)^3 \\ &=8n^3 = 2 \cdot (4n^3) \end{aligned}

The contraposition is true. Thus the statement that if k3k^3 is odd, then kk is odd, is proved.
(2) From (1), we know that kk is odd. Let k=2m+1k=2m+1,

k2+1=(2m+1)2+1=2(2m2+2m+1)\begin{aligned} k^2 + 1 &= (2m+1)^2 + 1\\ &= 2(2m^2+2m+1) \end{aligned}

k2+1k^2 + 1 is even.Thus the original statment is proved.

(3a) Let hh be a function from a set XX to a set YY. Let A and B be subsets of set XX. Prove: h(A)h(B)h(AB)h(A) \cup h(B) \subseteq h(A\cup B)

Solution

Let yh(A)h(B)y \in h(A) \cup h(B),
case #1: yh(A)y \in h(A), by defintion, (a1A)h(a1)=y\exists (a_1\in A) h(a_1) = y

yh(A)a1Aa1ABh(a1)h(AB)yh(AB)\begin{aligned} y \in h(A) &\To a_1 \in A\\ &\To a_1 \in A \cup B\\ &\To h(a_1) \in h(A \cup B)\\ &\To y \in h(A \cup B) \end{aligned}

case #2: yh(B)y \in h(B), by defintion, (a2B)h(a2)=y\exists (a_2\in B) h(a_2) = y

yh(A)a2Ba2ABh(a2)h(AB)yh(AB)\begin{aligned} y \in h(A) &\To a_2 \in B\\ &\To a_2 \in A \cup B\\ &\To h(a_2) \in h(A \cup B)\\ &\To y \in h(A \cup B) \end{aligned}

In both cases, we proved if yh(A)h(B)y \in h(A) \cup h(B), then yh(AB)y \in h(A\cup B). Thus. the original statement is proved.

(4a) How many bit strings of length 12 either start with 00 or end with 1111?

Solution

Strings start with 00: 2102^{10}.
Strings end with 1111: 282^{8}.
Strings start with 00 and end with 1111: 262^{6}
Because of double counting, by inclusion/exclusion principle, the number of strings either start with 00 or end with 1111 is 210+28262^{10} + 2^8 - 2^6.

(4b) How many one-to-one functions are there from a set of pp elements to a set of ss elements?

Solution

Let the set of pp elements be PP, and the set of ss elements be SS
case #1: when p>sp>s, there is no one-to-one function.
case #2: when psp \les s, there are ss ways to map p1p_1 to SS, there are (s1)(s-1) ways to map p2p_2 to SS, so on so forth, there are (sp+1)(s-p+1) ways to map ppp_p to SS. By product rule, the total of one-to-one functions is s(s1)(s2)(sp+1)s(s-1)(s-2) \cdots (s-p+1).

(5a) Prove that 133 divides 11k+2+122k111^{k+2} + 12^{2k-1} whenever kk is positive integer.

Solution

Todo

(5b) Prove that: 16n16^n is not O(15n)O(15^n).

Solution

By contradiction, the contradiction is: 16n16^n is O(15n)O(15^n).
(1) By definition of OO, c,k(16nC15n)n>k\exists c,k (16^n \les C\cdot 15^n) \forall n>k, then we have

16nC15nC(1615)n\begin{aligned} 16^n \les C\cdot 15^n\\ C \ges (\frac{16}{15})^n \end{aligned}

(2) Because 16151\dfrac{16}{15} \ges 1 and nn can be arbitraily large, limn(1615)n=\dlim_{n \to \infty}(\frac{16}{15})^n = \infty.
(3) There is no such constant CC, which statisfies C(1615)nC \ges (\frac{16}{15})^n.
(4) Thus the contradiction is false.
The original statment is true.

(6a) Let KK be a positive integer. Let nn be a positive integer. Let xx be integer. Prove that among any group of nx+1nx+1 (not necessarily consecutive) integers, there are at least (n+1)(n+1) with exactly the same reminder when they are divided by xx.

Solution

The possible reminders of a number divided by xx are 0,1,2,,x10, 1, 2, \cdots, x-1. The total of the reminders is xx.
Objects: nx+1nx+1 integers
Boxes: xx reminders
By the Piegeon Hole Principle, the number of integers with same reminders is at least

nx+1x=n+1x=n+1\lceil \frac{nx+1}{x} \rceil = \lceil n+ \frac{1}{x} \rceil = n+1

(6b) Let XX be a set with mm elements. Prove that the number of subsets is: 2m2^m

Solution

1. The number of subsets with nn elements is C(m,n)C(m, n) (combination), where 0nm0 \les n \les m.
2. The number of all subsets is

C(m,0)+C(m,1)++C(m,m)=n=0mC(m,n)C(m, 0) + C(m, 1) + \cdots + C(m, m) = \sum_{n=0}^m C(m, n)

3. Let x=1,y=1x=1, y=1

2m=(x+y)m=n=0mC(m,n)xnkyk=n=0mC(m,n)1nk1k=n=0mC(m,n)\begin{aligned} 2^m = (x+y)^m &= \sum_{n=0}^m C(m, n) x^{n-k} y^k\\ & = \sum_{n=0}^m C(m, n) 1^{n-k} 1^k\\ &= \sum_{n=0}^m C(m, n) \end{aligned}

According to (2) and (3), the statement is proved.

(7a) Suppose a password for a computer system must have at least 7, but no more than 11 characters where each character in the password is a lower case English letter, an upper case English letter, a binary digit, or one of the seven special characters (*, >, <, !, +, =, $). How many of these password contain at least one occurence of at least one of the seven special characters?

Solution

Ctotal=6111+6110+619+618+617Cnospecial=5411+5410+549+548+547Cspecial=CtotalCspecial\begin{aligned} C_{total} &= 61^{11}+ 61^{10} + 61^{9} + 61^{8} + 61^{7}\\ C_{nospecial} &= 54^{11}+ 54^{10} + 54^{9} + 54^{8} + 54^{7}\\ C_{special} &= C_{total} - C_{special} \end{aligned}

(7b) Assume strings of length 8 are formed with letters: ABCDEFGH. Calculate the numbers of strings that contain the substrings: AB and FGH

Solution

We can treat AB and FGH as two individual elements, then the answer can be given by the number of 5-permutations of a set of 5 elements. That is P(5,5)P(5, 5).

(8a) Give an example of a relation that both symmetric and anti-symmetric. Define the set and the relation.

Solution

1. Let the set be AA and A=A=\emptyset.
2. Let the relation be RR and RA×A=R \subseteq A \times A = \emptyset.
Because the assumption that there are elements in AA is false, the conclusion RR is symmetric and anti-symmetric is true.

(8b) Assume string of length 10 formed by letters M and/or W. Calculate the number of strings that contain at most four M s.

Solution