Discrete Mathematics : Recitations

Contents

Session 1: Propositional logic

Conditionals everywhere

ExpressionEquivalent expression
$p \rightarrow q$$\equiv \sim p \lor q$
$p$ implies $q$$\equiv p \rightarrow q$
(Contrapositive of $p \rightarrow q$)$\equiv \sim q \rightarrow \sim p$
(Converse of $p \rightarrow q$)$\equiv q \rightarrow p$
(Inverse of $p \rightarrow q$)$\equiv \sim p \rightarrow \sim q$
$p$ is sufficient for $q$$\equiv p \rightarrow q$
$p$ is not sufficient for $q$$\equiv \sim (p \rightarrow q)$
$p$ is necessary for $q$$\equiv q \rightarrow p$
$p$ is not necessary for $q$$\equiv \sim (q \rightarrow p)$
$p$ if $q$$\equiv q \rightarrow p$
$p$ only if $q$$\equiv p \rightarrow q$
$p$ if and only if $q$$\equiv p \leftrightarrow q$
$p$ when/whenever $q$$\equiv q \rightarrow p$
$p$ unless $q$$\equiv \sim q \rightarrow p$
$p$ follows from $q$$\equiv q \rightarrow p$
$p$, provided that $q$$\equiv q \rightarrow p$

Construct the truth table for $(p \oplus q) \leftrightarrow (\sim q \rightarrow \sim r)$.

Solution

$p$$q$$r$$p \oplus q$$\sim q$$\sim r$$\sim q \rightarrow \sim r$$(p \oplus q) \leftrightarrow (\sim q \rightarrow \sim r)$
$T$$T$$T$$F$$F$$F$$T$$F$
$T$$T$$F$$F$$F$$T$$T$$F$
$T$$F$$T$$T$$T$$F$$F$$F$
$T$$F$$F$$T$$T$$T$$T$$T$
$F$$T$$T$$T$$F$$F$$T$$T$
$F$$T$$F$$T$$F$$T$$T$$T$
$F$$F$$T$$F$$T$$F$$F$$T$
$F$$F$$F$$F$$T$$T$$T$$F$

Use truth tables to check whether the following expressions are equivalent: $\sim p \rightarrow (q \land r)$ and $\sim p \lor (q \lor r)$.

Solution

$p$$q$$r$$\sim p$$q \land r$$q \lor r$$\sim p \rightarrow (q \land r)$$\sim p \lor (q \lor r)$
$T$$T$$T$$F$$T$$T$$T$$T$
$T$$T$$F$$F$$F$$T$$T$$T$
$T$$F$$T$$F$$F$$T$$T$$T$
$T$$F$$F$$F$$F$$F$$T$$F$
$F$$T$$T$$T$$T$$T$$T$$T$
$F$$T$$F$$T$$F$$T$$F$$T$
$F$$F$$T$$T$$F$$T$$F$$T$
$F$$F$$F$$T$$F$$F$$F$$T$

The 7th and 8th columns are different at rows 4, 6, 7, and 8.
So, $\sim p \rightarrow (q \land r) \not\equiv \sim p \lor (q \lor r)$.

Write the logical form of the argument. If it is valid, identify the rule of inference that guarantees its validity. Otherwise, state whether the converse or the inverse error is made.

Subproblem 1.
If Jules solved this problem correctly, then Jules obtained the answer 2.
Jules obtained the answer 2.
$\therefore$ Jules solved this problem correctly.

Subproblem 2.
This real number is rational or it is irrational.
This real number is not rational.
$\therefore$ This real number is irrational.

Subproblem 3.
If I go to the movies, I won't finish my homework.
If I don't finish my homework, I won't do well on the exam tomorrow.
$\therefore$ If I go to the movies, I won't do well on the exam tomorrow.

Subproblem 4.
If this number is larger than 2, then its square is larger than 4.
This number is not larger than 2.
$\therefore$ The square of this number is not larger than 4.

Solution (Subproblem 1)

Let $p$ denote ''Jules solved this problem correctly'' and $q$ denote ''Jules obtained the answer 2''.
Logical form: \begin{align*} & p \rightarrow q \\ & q \\ & \therefore p \end{align*} Invalid (Converse error). A conditional is not equivalent to its converse. When $p$ is false and $q$ is true, both premises are true but the conclusion is false.

Solution (Subproblem 2)

Let $p$ denote ''This real number is rational'' and $q$ denote ''This real number is irrational''.
Logical form: \begin{align*} & p \lor q \\ & \sim p \\ & \therefore q \end{align*} Valid (Elimination).

Solution (Subproblem 3)

Let $p$ denote ''I go to the movies'', $q$ denote ''I finish my homework'', and $r$ denote ''I do well on the exam tomorrow''.
Logical form: \begin{align*} & p \rightarrow \sim q \\ & \sim q \rightarrow \sim r \\ & \therefore p \rightarrow \sim r \end{align*} Valid (Transitivity). Here $\sim q$ plays the role of the middle statement in the rule.

Solution (Subproblem 4)

Let $p$ denote ''This number is larger than 2'' and $q$ denote ''The square of this number is larger than 4''.
Logical form: \begin{align*} & p \rightarrow q \\ & \sim p \\ & \therefore \sim q \end{align*} Invalid (Inverse error). A conditional is not equivalent to its inverse. When $p$ is false and $q$ is true, both premises are true but the conclusion is false. (For example, the number $-3$ is not larger than 2, but its square, 9, is larger than 4.)

Use a truth table to determine whether the following argument form is valid. Indicate which columns represent the premises and which represent the conclusion, and include a sentence explaining how the truth table supports your answer.
$p$
$p \rightarrow q$
$\sim q \lor r$
$\therefore r$

Solution

PremisesConclusion
$p$$q$$r$$\sim q$$p$$p \rightarrow q$$\sim q \lor r$$r$
$T$$T$$T$$F$$T$$T$$T$$T$
$T$$T$$F$$F$$T$$T$$F$$F$
$T$$F$$T$$T$$T$$F$$T$$T$
$T$$F$$F$$T$$T$$F$$T$$F$
$F$$T$$T$$F$$F$$T$$T$$T$
$F$$T$$F$$F$$F$$T$$F$$F$
$F$$F$$T$$T$$F$$T$$T$$T$
$F$$F$$F$$T$$F$$T$$T$$F$

A row in which all the premises are true is a critical row. An argument form is valid if the conclusion is true in every critical row.
Only row 1 (the highlighted row) is a critical row, and the conclusion $r$ is true in it.
So, the argument form is valid.

Session 2: Propositional logic

Use a truth table to determine whether the following argument form is valid. Indicate which columns represent the premises and which represent the conclusion, and include a sentence explaining how the truth table supports your answer.
$p \lor q$
$p \rightarrow \sim q$
$p \rightarrow r$
$\therefore r$

Solution

PremisesConclusion
$p$$q$$r$$\sim q$$p \lor q$$p \rightarrow \sim q$$p \rightarrow r$$r$
$T$$T$$T$$F$$T$$F$$T$$T$
$T$$T$$F$$F$$T$$F$$F$$F$
$T$$F$$T$$T$$T$$T$$T$$T$
$T$$F$$F$$T$$T$$T$$F$$F$
$F$$T$$T$$F$$T$$T$$T$$T$
$F$$T$$F$$F$$T$$T$$T$$F$
$F$$F$$T$$T$$F$$T$$T$$T$
$F$$F$$F$$T$$F$$T$$T$$F$

A row in which all the premises are true is a critical row. An argument form is invalid if the conclusion is false in at least one critical row.
Rows 3, 5, and 6 are critical rows. In row 6 ($p$ is false, $q$ is true, and $r$ is false), all the premises are true but the conclusion $r$ is false.
So, the argument form is invalid.

Use the valid argument forms (rules of inference) to deduce the conclusion from the premises, giving a reason for each step. Assume all variables are statement variables.
(a) $\sim p \lor q \rightarrow r$
(b) $s \lor \sim q$
(c) $\sim t$
(d) $p \rightarrow t$
(e) $\sim p \land r \rightarrow \sim s$
(f) $\therefore \sim q$

Solution

By the precedence of the logical operators, (a) is $(\sim p \lor q) \rightarrow r$ and (e) is $(\sim p \land r) \rightarrow \sim s$.

1. \begin{align*} & p \rightarrow t && \text{by (d)} \\ & \sim t && \text{by (c)} \\ & \therefore \sim p && \text{by modus tollens} \end{align*}

2. \begin{align*} & \sim p && \text{by the conclusion of (1)} \\ & \therefore \sim p \lor q && \text{by generalization} \end{align*}

3. \begin{align*} & (\sim p \lor q) \rightarrow r && \text{by (a)} \\ & \sim p \lor q && \text{by the conclusion of (2)} \\ & \therefore r && \text{by modus ponens} \end{align*}

4. \begin{align*} & \sim p && \text{by the conclusion of (1)} \\ & r && \text{by the conclusion of (3)} \\ & \therefore \sim p \land r && \text{by conjunction} \end{align*}

5. \begin{align*} & (\sim p \land r) \rightarrow \sim s && \text{by (e)} \\ & \sim p \land r && \text{by the conclusion of (4)} \\ & \therefore \sim s && \text{by modus ponens} \end{align*}

6. \begin{align*} & s \lor \sim q && \text{by (b)} \\ & \sim s && \text{by the conclusion of (5)} \\ & \therefore \sim q && \text{by elimination} \end{align*}

Thus, $\sim q$ follows from the premises.

Use the valid argument forms (rules of inference) to deduce the conclusion from the premises, giving a reason for each step. Assume all variables are statement variables.
(a) $\sim p \rightarrow r \land \sim s$
(b) $t \rightarrow s$
(c) $u \rightarrow \sim p$
(d) $\sim w$
(e) $u \lor w$
(f) $\therefore \sim t$

Solution

By the precedence of the logical operators, (a) is $\sim p \rightarrow (r \land \sim s)$.

1. \begin{align*} & u \lor w && \text{by (e)} \\ & \sim w && \text{by (d)} \\ & \therefore u && \text{by elimination} \end{align*}

2. \begin{align*} & u \rightarrow \sim p && \text{by (c)} \\ & u && \text{by the conclusion of (1)} \\ & \therefore \sim p && \text{by modus ponens} \end{align*}

3. \begin{align*} & \sim p \rightarrow (r \land \sim s) && \text{by (a)} \\ & \sim p && \text{by the conclusion of (2)} \\ & \therefore r \land \sim s && \text{by modus ponens} \end{align*}

4. \begin{align*} & r \land \sim s && \text{by the conclusion of (3)} \\ & \therefore \sim s && \text{by specialization} \end{align*}

5. \begin{align*} & t \rightarrow s && \text{by (b)} \\ & \sim s && \text{by the conclusion of (4)} \\ & \therefore \sim t && \text{by modus tollens} \end{align*}

Thus, $\sim t$ follows from the premises.

Session 3: Predicate logic

Write a negation for the statement.
$\forall x\in\mathbb{R}$, if $x(x+1)>0$ then $x>0$ or $x<-1$.

Solution

\begin{align*} \sim\bigl(\forall x\in\mathbb{R},\ x(x+1)>0\rightarrow(x>0\lor x<-1)\bigr) &\equiv \exists x\in\mathbb{R},\ x(x+1)>0\land\sim(x>0\lor x<-1)\\ &\equiv \exists x\in\mathbb{R},\ x(x+1)>0\land x\le 0\land x\ge -1. \end{align*}

Negation: There is a real number $x$ such that $x(x+1)>0$ and $-1\le x\le 0$.

Write a negation for the statement.
$\forall$ integers $a$, $b$, and $c$, if $a-b$ is even and $b-c$ is even, then $a-c$ is even.

Solution

Let $E(n)$ mean that $n$ is even.

\begin{align*} \sim\bigl(\forall a,b,c\in\mathbb{Z},\ (E(a-b)\land E(b-c))\rightarrow E(a-c)\bigr) &\equiv\exists a,b,c\in\mathbb{Z},\ E(a-b)\land E(b-c)\land\sim E(a-c). \end{align*}

Negation: There exist integers $a$, $b$, and $c$ such that $a-b$ and $b-c$ are even, but $a-c$ is odd.

Rewrite the statement in if-then form.
Earning a grade of C− in this course is a sufficient condition for it to count toward graduation.

Solution

If you earn a grade of C− in this course, then it counts toward graduation.

A sufficient condition is the hypothesis: $P\rightarrow Q$.

Rewrite the statement in if-then form.
Being on time each day is a necessary condition for keeping this job.

Solution

If you keep this job, then you are on time each day.

A necessary condition is the conclusion: $Q\rightarrow P$.

Use the facts that the negation of a $\forall$ statement is an $\exists$ statement and that the negation of an if-then statement is an and statement to rewrite the statement without using the word necessary or sufficient.
Being divisible by 8 is not a necessary condition for being divisible by 4.

Solution

Let $D_4(n)$ mean $4\mid n$ and $D_8(n)$ mean $8\mid n$, with domain $\mathbb{Z}$.

\begin{align*} \sim(\forall n,\ D_4(n)\rightarrow D_8(n))&\equiv\exists n,\ D_4(n)\land\sim D_8(n). \end{align*}

There is an integer that is divisible by 4 but not divisible by 8.

Use the facts that the negation of a $\forall$ statement is an $\exists$ statement and that the negation of an if-then statement is an and statement to rewrite the statement without using the word necessary or sufficient.
Having a large income is not a sufficient condition for a person to be happy.

Solution

Let $L(p)$ mean that person $p$ has a large income and $H(p)$ mean that $p$ is happy.

\begin{align*} \sim(\forall p,\ L(p)\rightarrow H(p))&\equiv\exists p,\ L(p)\land\sim H(p). \end{align*}

There is a person who has a large income but is not happy.

(a) Rewrite the statement in English without using the symbol $\forall$ or $\exists$ or variables and expressing your answer as simply as possible, and (b) write a negation for the statement.
$\forall$ color $C$, $\exists$ an animal $A$ such that $A$ is colored $C$.

Solution

(a) For every color, there is an animal of that color.

(b) There is a color that no animal has.

Let $R(C,A)$ mean that animal $A$ is colored $C$.

\begin{align*} \sim(\forall C,\exists A,\ R(C,A))&\equiv\exists C,\forall A,\sim R(C,A). \end{align*}
(a) Rewrite the statement in English without using the symbol $\forall$ or $\exists$ or variables and expressing your answer as simply as possible, and (b) write a negation for the statement.
$\exists$ a book $b$ such that $\forall$ person $p$, $p$ has read $b$.

Solution

(a) There is a book that everyone has read.

(b) For every book, there is someone who has not read it.

Let $R(p,b)$ mean that person $p$ has read book $b$.

\begin{align*} \sim(\exists b,\forall p,\ R(p,b))&\equiv\forall b,\exists p,\sim R(p,b). \end{align*}
(a) Rewrite the statement in English without using the symbol $\forall$ or $\exists$ or variables and expressing your answer as simply as possible, and (b) write a negation for the statement.
$\forall$ odd integer $n$, $\exists$ an integer $k$ such that $n=2k+1$.

Solution

(a) Every odd integer is one more than twice some integer.

(b) There is an odd integer that is not one more than twice any integer.

Let $O$ be the set of odd integers.

\begin{align*} \sim(\forall n\in O,\exists k\in\mathbb{Z},\ n=2k+1)&\equiv\exists n\in O,\forall k\in\mathbb{Z},\ n\ne 2k+1. \end{align*}
(a) Rewrite the statement in English without using the symbol $\forall$ or $\exists$ or variables and expressing your answer as simply as possible, and (b) write a negation for the statement.
$\forall x\in\mathbb{R}$, $\exists$ a real number $y$ such that $x+y=0$.

Solution

(a) Every real number has a real number that can be added to it to give zero.

(b) There is a real number whose sum with every real number is nonzero.

\begin{align*} \sim(\forall x\in\mathbb{R},\exists y\in\mathbb{R},\ x+y=0)&\equiv\exists x\in\mathbb{R},\forall y\in\mathbb{R},\ x+y\ne 0. \end{align*}
State whether the argument is valid or invalid. Justify your answer.

All healthy people eat an apple a day.
Keisha eats an apple a day.
$\therefore$ Keisha is a healthy person.

Solution

Let $H(x)$ mean that $x$ is healthy, $A(x)$ mean that $x$ eats an apple a day, and $k$ denote Keisha.

\begin{align*} &\forall x,\ H(x)\rightarrow A(x)\\ &A(k)\\ &\therefore H(k) \end{align*}

Invalid (Converse error). Keisha could eat an apple a day without being healthy. Both premises would be true and the conclusion false.

State whether the argument is valid or invalid. Justify your answer.

All freshmen must take a writing course.
Caroline is a freshman.
$\therefore$ Caroline must take a writing course.

Solution

Let $F(x)$ mean that $x$ is a freshman, $W(x)$ mean that $x$ must take a writing course, and $c$ denote Caroline.

\begin{align*} &\forall x,\ F(x)\rightarrow W(x)\\ &F(c)\\ &\therefore W(c) \end{align*}

Valid (Universal modus ponens). The universal statement applies to Caroline.

State whether the argument is valid or invalid. Justify your answer.

If a graph has no edges, then it has a vertex of degree zero.
This graph has at least one edge.
$\therefore$ This graph does not have a vertex of degree zero.

Solution

Let $N(g)$ mean that graph $g$ has no edges and $Z(g)$ mean that $g$ has a vertex of degree zero. Let $g_0$ be this graph.

\begin{align*} &\forall g,\ N(g)\rightarrow Z(g)\\ &\sim N(g_0)\\ &\therefore\sim Z(g_0) \end{align*}

Invalid (Inverse error). A graph with one edge connecting two vertices and a third isolated vertex has an edge and also a vertex of degree zero.

State whether the argument is valid or invalid. Justify your answer.

If a product of two numbers is $0$, then at least one of the numbers is $0$.
For a particular number $x$, neither $(2x+1)$ nor $(x-7)$ equals $0$.
$\therefore$ The product $(2x+1)(x-7)$ is not $0$.

Solution

Let $P(a,b)$ mean $ab=0$ and $Q(a,b)$ mean $a=0\lor b=0$. Set $a=2x+1$ and $b=x-7$.

\begin{align*} &\forall a,b,\ P(a,b)\rightarrow Q(a,b)\\ &\sim Q(2x+1,x-7)\\ &\therefore\sim P(2x+1,x-7) \end{align*}

Valid (Universal modus tollens). By De Morgan’s law, neither factor being zero is exactly $\sim(a=0\lor b=0)$.

State whether the argument is valid or invalid. Justify your answer.

If a number is even, then twice that number is even.
The number $2n$ is even, for a particular number $n$.
$\therefore$ The particular number $n$ is even.

Solution

Let $E(x)$ mean that $x$ is even, with domain $\mathbb{Z}$.

\begin{align*} &\forall x\in\mathbb{Z},\ E(x)\rightarrow E(2x)\\ &E(2n)\\ &\therefore E(n) \end{align*}

Invalid (Converse error). Take $n=1$. Then $2n=2$ is even, but $n=1$ is not even.

Rewrite the statement “No good cars are cheap” in the form “$\forall x$, if $P(x)$ then $\sim Q(x)$.” Indicate whether the following argument is valid or invalid, and justify your answer.

No good car is cheap.
A Rimbaud is a good car.
$\therefore$ A Rimbaud is not cheap.

Solution

Let the domain be cars. Let $G(x)$ mean that $x$ is good and $C(x)$ mean that $x$ is cheap. The statement becomes “For every car $x$, if $x$ is good, then $x$ is not cheap.” Let $r$ denote the Rimbaud in the argument.

\begin{align*} &\forall x,\ G(x)\rightarrow\sim C(x)\\ &G(r)\\ &\therefore\sim C(r) \end{align*}

Valid (Universal modus ponens). Apply the universal statement to the Rimbaud.

Indicate whether the argument is valid or invalid. Support your answer by drawing a diagram.

All teachers occasionally make mistakes.
No gods ever make mistakes.
$\therefore$ No teachers are gods.

Solution

Let $T$, $M$, and $G$ be the sets of teachers, those who make mistakes, and gods, respectively.

\begin{align*} T&\subseteq M,\\ G\cap M&=\varnothing,\\ \therefore T\cap G&=\varnothing. \end{align*}

Valid. Teachers lie inside the set of those who make mistakes, while gods lie outside it. Therefore, no teacher can be a god.

Make mistakesTeachersGods
Teachers are inside the set of those who make mistakes. Gods are outside that set.
Indicate whether the argument is valid or invalid. Support your answer by drawing a diagram.

No college cafeteria food is good.
No good food is wasted.
$\therefore$ No college cafeteria food is wasted.

Solution

Let $C$, $G$, and $W$ be the sets of college cafeteria food, good food, and wasted food, respectively.

\begin{align*} C\cap G&=\varnothing,\\ G\cap W&=\varnothing. \end{align*}

Invalid. The premises do not imply $C\cap W=\varnothing$. Cafeteria food and wasted food can overlap outside the set of good food. The marked item $x$ in the diagram is cafeteria food that is not good and is wasted, making both premises true and the conclusion false.

Not good foodCafeteriafoodWastedxGood food
Cafeteria food and wasted food overlap outside good food. The marked item x is both cafeteria food and wasted.

Session 4: Proof techniques

Prove that for every integer $n$, if $n$ is odd, then $3n+5$ is even.

Proof

Direct proof.
Formal statement: $\forall$ integer $n$, if $n$ is odd, then $3n+5$ is even.
Suppose $n$ is odd. Then: \begin{align*} & 3n + 5 \\ &= 3(2k+1) + 5 && \text{(defn. of odd, } n = 2k+1 \text{ for integer } k \text{)}\\ &= 6k + 8 && \text{(simplifying)}\\ &= 2(3k+4) && \text{(taking 2 as common factor)}\\ &= 2p && \text{(} p = 3k+4 \text{ and mult. and add. are closed on integers)}\\ &= \text{even} && \text{(defn. of even)}\\ \end{align*}

Prove that if $a$ and $b$ are any odd integers, then $a^2 + b^2$ is even.

Proof

Direct proof.
Formal statement: $\forall$ integers $a, b$, if $a$ and $b$ are odd, then $a^2 + b^2$ is even.
Suppose $a$ and $b$ are odd. Then: \begin{align*} & a^2 + b^2 \\ &= (2m+1)^2 + (2n+1)^2 && \text{(defn. of odd; } a = 2m+1, b = 2n+1 \text{)}\\ &= 4m^2 + 4m + 1 + 4n^2 + 4n + 1 && \text{(expand)}\\ &= 2(2m^2 + 2m + 2n^2 + 2n + 1) && \text{(taking 2 as common factor)}\\ &= 2p && \text{(} p = 2m^2 + 2m + 2n^2 + 2n + 1 \text{ is an integer)}\\ &= \text{even} && \text{(defn. of even)}\\ \end{align*}

Prove that if an integer greater than $4$ is a perfect square, then the immediately preceding integer is not prime.

Proof

Direct proof.
Formal statement: $\forall$ integer $n \gt 4$, if $n$ is a perfect square, then $n-1$ is not prime.
Suppose $n \gt 4$ is a perfect square. Then: \begin{align*} & n = k^2 \text{ for some integer } k \ge 0 && \text{(defn. of perfect square; take } k \ge 0 \text{)}\\ & \implies k^2 \gt 4 && \text{(} n \gt 4 \text{)}\\ & \implies k \ge 3 && \text{(} k \text{ is a nonnegative integer)}\\ \end{align*} Now consider $n - 1$. \begin{align*} & n - 1 \\ &= k^2 - 1 && \text{(} n = k^2 \text{)}\\ &= (k-1)(k+1) && \text{(difference of two squares)}\\ &= \text{composite} && \text{(} 1 \lt k-1 \lt n-1 \text{ and } 1 \lt k+1 \lt n-1 \text{; see below)}\\ \end{align*} We have $1 \lt k-1$ and $1 \lt k+1$ since $k \ge 3$. Also, $k-1 \lt (k-1)(k+1) = n-1$ since $k+1 \gt 1$, and $k+1 \lt (k-1)(k+1) = n-1$ since $k-1 \gt 1$. So $n-1$ is a product of two natural numbers that are strictly between $1$ and $n-1$. Hence $n-1$ is composite, and so it is not prime.

Prove or disprove. For all real numbers $a$ and $b$, if $a^2 > b^2$, then $a>b$.

Solution

False!
Counterexample: $a = -3$ and $b = 2$.
In this example, $a^2 = 9 \gt 4 = b^2$ but $a \lt b$.

Rationals and irrationals

ExpressionResultProof technique
rational + rationalrationalDirect proof
rational + irrationalirrationalContradiction
irrational + irrationalrational or irrationalExamples: $\sqrt{2} + (-\sqrt{2}) = 0$ and $\frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}} = \sqrt{2}$
rational $\times$ rationalrationalDirect proof
rational $\times$ irrationalrational or irrationalExamples $0 \times \sqrt{2} = 0$ and $1 \times \sqrt{2} = \sqrt{2}$
irrational $\times$ irrationalrational or irrationalExamples $\sqrt{2} \times \sqrt{2} = 2$ and $\sqrt{2} \times \sqrt{3} = \sqrt{6}$
nonzero rational $\times$ irrationalirrationalContradiction
rational$^{\text{rational}}$rational or irrationalExamples $1^1 = 1$ and $2^{1/2} = \sqrt{2}$

Session 5: Proof techniques

Prove that for all positive real numbers $r$ and $s$, $\sqrt{r + s} \neq \sqrt{r} + \sqrt{s}$.

Proof

Proof by contradiction.
Negation. Suppose there are positive real numbers $r$ and $s$ such that $\sqrt{r+s} = \sqrt{r} + \sqrt{s}$. \begin{align*} & \sqrt{r+s} = \sqrt{r} + \sqrt{s} \\ & \implies r + s = r + 2\sqrt{r}\sqrt{s} + s && \text{(squaring on both sides)}\\ & \implies 0 = 2\sqrt{r}\sqrt{s} && \text{(subtracting } r + s \text{ from both sides)}\\ & \implies \sqrt{r}\sqrt{s} = 0 && \text{(dividing by 2)}\\ & \implies \sqrt{r} = 0 \text{ or } \sqrt{s} = 0 && \text{(a product is zero only if a factor is zero)}\\ & \implies r = 0 \text{ or } s = 0 && \text{(squaring)}\\ \end{align*} Contradiction! Both $r$ and $s$ are positive. Hence, the proposition is true.

Proof 2

Proof by contraposition.
Contrapositive. If $\sqrt{r+s} = \sqrt{r} + \sqrt{s}$, then $r$ and $s$ are not both positive. \begin{align*} & \sqrt{r+s} = \sqrt{r} + \sqrt{s} \\ & \implies r + s = r + 2\sqrt{r}\sqrt{s} + s && \text{(squaring on both sides)}\\ & \implies \sqrt{r}\sqrt{s} = 0 && \text{(subtracting } r + s \text{ and dividing by 2)}\\ & \implies r = 0 \text{ or } s = 0 && \text{(a product is zero only if a factor is zero)}\\ & \implies r \text{ and } s \text{ are not both positive} && \text{(} 0 \text{ is not positive)}\\ \end{align*} Hence, the proposition is true.

Prove that if $n^2+3n-7$ is even, then $n$ is odd.

Proof

Proof by contradiction.
Negation. Suppose $n^2 + 3n - 7$ is even and $n$ is even. \begin{align*} & n \text{ is even} \\ & \implies n = 2k && \text{(defn. of even, } k \in \mathbb{Z} \text{)}\\ & \implies n^2 + 3n - 7 = 4k^2 + 6k - 7 && \text{(substitute } n = 2k \text{)}\\ & \implies n^2 + 3n - 7 = 2(2k^2 + 3k - 4) + 1 && \text{(take 2 common)}\\ & \implies n^2 + 3n - 7 \text{ is odd} && \text{(defn. of odd, } 2k^2 + 3k - 4 \in \mathbb{Z} \text{)}\\ \end{align*} Contradiction! $n^2 + 3n - 7$ is even, but an integer cannot be both even and odd. Hence, the proposition is true.

Proof 2

Proof by contraposition.
Contrapositive. If $n$ is even, then $n^2 + 3n - 7$ is odd. \begin{align*} & n \text{ is even} \\ & \implies n = 2k && \text{(defn. of even, } k \in \mathbb{Z} \text{)}\\ & \implies n^2 + 3n - 7 = 4k^2 + 6k - 7 && \text{(substitute } n = 2k \text{)}\\ & \implies n^2 + 3n - 7 = 2(2k^2 + 3k - 4) + 1 && \text{(take 2 common)}\\ & \implies n^2 + 3n - 7 \text{ is odd} && \text{(defn. of odd, } 2k^2 + 3k - 4 \in \mathbb{Z} \text{)}\\ \end{align*} Hence, the contrapositive is true, and so the proposition is true.

For integers $a$, $b$, $c$, if $a^2 + b^2 = c^2$, then $a$ is even or $b$ is even.

Proof

Proof by contraposition and division into cases.
Contrapositive. For integers $a$, $b$, $c$, if $a$ and $b$ are odd, then $a^2 + b^2 \ne c^2$.
Suppose $a$ and $b$ are odd. Consider \begin{align*} & a^2 + b^2 \\ &= (2m+1)^2 + (2n+1)^2 && \text{(defn. of odd; } a = 2m+1, b = 2n+1 \text{)}\\ &= 4m^2 + 4n^2 + 4m + 4n + 2 && \text{(expand)}\\ &= 4(m^2 + n^2 + m + n) + 2 && \text{(take common factor)}\\ &\equiv 2 \bmod 4 && \text{(remainder is 2 when divided by 4)}\\ \end{align*} Now let $c$ be any integer. We know $c = 2k$ or $c = 2k+1$ (quotient-remainder theorem). So we have two cases:

In both cases, $c^2 \not\equiv 2 \bmod 4$ (remainder is never 2 when divided by 4). But $a^2 + b^2 \equiv 2 \bmod 4$. So $a^2 + b^2 \ne c^2$. Hence, the contrapositive is true, and so the proposition is true.

Given two nonnegative numbers $a$ and $b$, the arithmetic mean (AM) is defined as $(a + b) / 2$ and the geometric mean (GM) is defined as $\sqrt{ab}$. Prove that for all nonnegative real numbers $a$ and $b$, the AM of the two numbers is never smaller than the GM.

Proof

Direct proof.
Formal statement. $\forall$ nonnegative real numbers $a$ and $b$, $\frac{a+b}{2} \ge \sqrt{ab}.$
Since $a,b \ge 0$, the expression $(\sqrt{a} - \sqrt{b})^2$ is well-defined and nonnegative. Thus, $(\sqrt{a} - \sqrt{b})^2 \ge 0.$
We have

\begin{align*} &(\sqrt{a} - \sqrt{b})^2 \ge 0\\ &\implies a - 2\sqrt{ab} + b \ge 0 && \text{(expand)}\\ &\implies a + b \ge 2\sqrt{ab} && \text{(rewrite)}\\ &\implies \frac{a+b}{2} \ge \sqrt{ab} && \text{(divide by 2)} \end{align*}

Therefore, the arithmetic mean of two nonnegative real numbers is never smaller than the geometric mean.

Proof 2

Proof by contradiction.
Negation: Suppose that there exist nonnegative real numbers $a$ and $b$ such that $\frac{a+b}{2} < \sqrt{ab}.$ Then \begin{align*} &\frac{a+b}{2} < \sqrt{ab} && \text{(supposition of negation)}\\ &\implies a + b < 2\sqrt{ab} && \text{(multiply by 2)}\\ &\implies a + b - 2\sqrt{ab} < 0 && \text{(rewrite)}\\ &\implies (\sqrt{a} - \sqrt{b})^2 < 0 && \text{(simplify)} \end{align*} However, for all real numbers, a square is always nonnegative, so $ (\sqrt{a} - \sqrt{b})^2 \ge 0, $ which is a contradiction. Therefore, our assumption is false, and it must be that $ \frac{a+b}{2} \ge \sqrt{ab} $ for all nonnegative real numbers $a$ and $b$.

For every integer $n$, the product of three consecutive integers $n(n+1)(n+2)$ is divisible by $6$.

Proof

Proof by division into cases.
Let $n$ be any integer. By the quotient-remainder theorem, when $n$ is divided by $3$, exactly one of the following three cases occurs:

Therefore, in every case, one of the integers $n$, $n+1$, and $n+2$ is divisible by $3$.
Next, by the quotient-remainder theorem, every integer is either even or odd. So we consider two cases:

We have, $ 2 \mid n(n+1)(n+2) \text{ and } 3 \mid n(n+1)(n+2). $ Since $\gcd(2,3)=1$, it follows that $ 6 \mid n(n+1)(n+2). $ Therefore, the product of three consecutive integers is divisible by $6$.

Session 6: Sequences

Prove that $\displaystyle\sum_{i=1}^{n-1} i(i+1) = \frac{n(n-1)(n+1)}{3}$, for every integer $n \ge 2$.

Proof

Let $P(n)$ denote ''$\displaystyle\sum_{i=1}^{n-1} i(i+1) = \frac{n(n-1)(n+1)}{3}$.''
Prove that $\displaystyle\sum_{i=1}^{n} i(i!) = (n+1)! - 1$, for every integer $n \ge 1$.

Proof

Let $P(n)$ denote ''$\displaystyle\sum_{i=1}^n i(i!) = (n+1)! - 1$.''
Prove that $\displaystyle \frac{1}{1^2} + \frac{1}{2^2} + \cdots + \frac{1}{n^2} < 2 - \frac{1}{n}$ for all natural numbers $n \ge 1$.

Proof

Let $P(n)$ denote $\displaystyle \sum_{i=1}^n \frac{1}{i^2} < 2 - \frac{1}{n}$ for $n \ge 2$.
Prove that $5^n - 1$ is divisible by $4$, for every integer $n \ge 0$.

Proof

Let $P(n)$ denote ''$5^{n} - 1$ is divisible by $4$.''
For any integer $n \ge 0$, $x^n - y^n$ is divisible by $x - y$, where $x$ and $y$ are any integers with $x \ne y$.

Proof

Let $P(n)$ denote ''$x^{n} - y^{n}$ is divisible by $x - y$, s.t. $x \ne y$.''
Prove that $n^3 - n$ is divisible by $6$, for each integer $n \ge 0$.

Proof

Let $P(n)$ denote ''$n^{3} - n$ is divisible by $6$.''

Session 7: Sequences

Suppose that $e_0, e_1, e_2, \ldots$ is a sequence defined as follows: $e_0 = 12$, $e_1 = 29$,
$e_k = 5e_{k-1} - 6e_{k-2}$ for each integer $k \ge 2$.
Prove that $e_n = 5 \cdot 3^n + 7 \cdot 2^n$ for every integer $n \ge 0$.

Proof

Let $P(n)$ denote ''$e_n = 5 \cdot 3^n + 7 \cdot 2^n$.''
Problem: Suppose $x \in \mathbb{R}^+$ and $(x + 1/x) \in \mathbb{Z}$. Prove using strong induction that $(x^n + 1/x^n) \in \mathbb{Z}$ for all natural numbers $n$.

Solution

Let $P(n)$ denote $(x^n + 1/x^n) \in \mathbb{Z}$ for $n \ge 1$.
Problem: Prove that breaking a chocolate bar with $n \ge 1$ pieces into individual pieces requires $n - 1$ breaks.

Solution

Let $P(n)$ denote ''Breaking a chocolate bar with $n$ pieces into individual pieces requires $n - 1$ breaks''.
chocolatebar: a bar of k+1 pieces split into a part with j pieces (j-1 breaks) and a part with k+1-j pieces (k-j breaks)
Let $c_0, c_1, c_2, \ldots$ be defined by the formula $c_n = 2^n - 1$, for every integer $n \ge 0$. Show that this sequence satisfies the recurrence relation $c_k = 2c_{k-1} + 1$, for every integer $k \ge 1$.

Solution

Let $k \ge 1$ be an integer. By the given formula, $c_{k-1} = 2^{k-1} - 1$. Then, \begin{align*} & 2 c_{k-1} + 1 \\ &= 2 (2^{k-1} - 1) + 1 && (\because \text{substitute } c_{k-1} = 2^{k-1}-1) \\ &= 2^{k} - 2 + 1 && (\because \text{simplify}) \\ &= 2^k - 1 \\ &= c_k && (\because \text{by the given formula}) \end{align*} So $c_k = 2c_{k-1}+1$ for every integer $k \ge 1$, and the sequence satisfies the given recurrence relation.

A sequence is defined recursively: $h_k = 2^k - h_{k-1}$, for each integer $k \ge 1$, $h_0 = 1$. Use iteration to guess an explicit formula for the sequence.

Solution

Session 8: Midterm

Cover the common mistakes from all topics for the midterm from Common Mistakes file.

Session 9: Sets

Prove that for all sets $A$ and $B$, $A \cup (A \cap B) = A$.

Proof

We need to prove:

  1. $A \cup (A \cap B) \subseteq A$
  2. $A \subseteq A \cup (A \cap B)$
  1. Prove that $A \cup (A \cap B) \subseteq A$.
    Suppose $x \in A \cup (A \cap B)$. Then \begin{align*} x \in A \cup (A \cap B) &\implies x \in A \text{ or } x \in A \cap B && \text{(defn. of union)}. \end{align*}
    • Case 1. $[x \in A.]$
      We already have $x \in A$.
    • Case 2. $[x \in A \cap B.]$
      \begin{align*} x \in A \cap B &\implies x \in A \text{ and } x \in B && \text{(defn. of intersection)}\\ &\implies x \in A. \end{align*}
    In both cases $x \in A$. Hence, $A \cup (A \cap B) \subseteq A$.
  2. Prove that $A \subseteq A \cup (A \cap B)$.
    Suppose $x \in A$. Then \begin{align*} x \in A &\implies x \in A \cup (A \cap B) && \text{(defn. of union)}. \end{align*} Hence, $A \subseteq A \cup (A \cap B)$.

Since both inclusions hold, $A \cup (A \cap B) = A$.

Prove that for all sets $A$, $B$, and $C$,
$A \times (B \cup C) = (A \times B) \cup (A \times C)$.

Proof

We need to prove:

  1. $A \times (B \cup C) \subseteq (A \times B) \cup (A \times C)$
  2. $(A \times B) \cup (A \times C) \subseteq A \times (B \cup C)$
  1. Prove that $A \times (B \cup C) \subseteq (A \times B) \cup (A \times C)$.
    Suppose $(a,b) \in A \times (B \cup C)$. Then \begin{align*} (a,b) \in A \times (B \cup C) &\implies a \in A \text{ and } b \in B \cup C && \text{(defn. of Cartesian product)}\\ &\implies b \in B \text{ or } b \in C && \text{(defn. of union)}. \end{align*}
    • Case 1. $[b \in B.]$
      Since $a \in A$, \begin{align*} a \in A \text{ and } b \in B &\implies (a,b) \in A \times B && \text{(defn. of Cartesian product)}\\ &\implies (a,b) \in (A \times B) \cup (A \times C) && \text{(defn. of union)}. \end{align*}
    • Case 2. $[b \in C.]$
      Since $a \in A$, \begin{align*} a \in A \text{ and } b \in C &\implies (a,b) \in A \times C && \text{(defn. of Cartesian product)}\\ &\implies (a,b) \in (A \times B) \cup (A \times C) && \text{(defn. of union)}. \end{align*}
    Hence, $A \times (B \cup C) \subseteq (A \times B) \cup (A \times C)$.
  2. Prove that $(A \times B) \cup (A \times C) \subseteq A \times (B \cup C)$.
    Suppose $(a,b) \in (A \times B) \cup (A \times C)$. Then \begin{align*} (a,b) \in (A \times B) \cup (A \times C) &\implies (a,b) \in A \times B \text{ or } (a,b) \in A \times C && \text{(defn. of union)}. \end{align*}
    • Case 1. $[(a,b) \in A \times B.]$
      \begin{align*} (a,b) \in A \times B &\implies a \in A \text{ and } b \in B && \text{(defn. of Cartesian product)}\\ &\implies a \in A \text{ and } b \in B \cup C && \text{(defn. of union)}\\ &\implies (a,b) \in A \times (B \cup C) && \text{(defn. of Cartesian product)}. \end{align*}
    • Case 2. $[(a,b) \in A \times C.]$
      \begin{align*} (a,b) \in A \times C &\implies a \in A \text{ and } b \in C && \text{(defn. of Cartesian product)}\\ &\implies a \in A \text{ and } b \in B \cup C && \text{(defn. of union)}\\ &\implies (a,b) \in A \times (B \cup C) && \text{(defn. of Cartesian product)}. \end{align*}
    Hence, $(A \times B) \cup (A \times C) \subseteq A \times (B \cup C)$.

Since both inclusions hold, $A \times (B \cup C) = (A \times B) \cup (A \times C)$.

Prove that for all sets $A$ and $B$, $(A \cap B) \cap (A \cap B^c) = \emptyset$.

Proof

Proof by contradiction. Suppose there is an element $x$ such that $x \in (A \cap B) \cap (A \cap B^c)$. Then

\begin{align*} x \in (A \cap B) \cap (A \cap B^c) &\implies x \in A \cap B \text{ and } x \in A \cap B^c && \text{(defn. of intersection)}\\ &\implies x \in B \text{ and } x \in B^c && \text{(defn. of intersection)}\\ &\implies x \in B \text{ and } x \notin B && \text{(defn. of complement)}. \end{align*}

This is a contradiction. Therefore, no such element exists, and $(A \cap B) \cap (A \cap B^c) = \emptyset$.

Give a counterexample to disprove the following statement: For all sets $A$, $B$, and $C$,
$(A \cup B) \cap C = A \cup (B \cap C)$.

Disproof

False! Counterexample: Let $U = \{1\}$, $A = \{1\}$, $B = \emptyset$, and $C = \emptyset$. Then

\begin{align*} (A \cup B) \cap C &= (\{1\} \cup \emptyset) \cap \emptyset\\ &= \emptyset,\\[4pt] A \cup (B \cap C) &= \{1\} \cup (\emptyset \cap \emptyset)\\ &= \{1\}. \end{align*}

Since $\emptyset \ne \{1\}$, the two sides are not equal. Therefore, the statement is false.

Give a counterexample to disprove the following statement: For all sets $A$, $B$, and $C$, if $A \nsubseteq B$ and $B \nsubseteq C$, then $A \nsubseteq C$.

Disproof

False! Counterexample: Let $U = \{1,2\}$, $A = \{1\}$, $B = \{2\}$, and $C = \{1\}$. Then

\begin{align*} A &\nsubseteq B && \text{(since } 1 \in A \text{ and } 1 \notin B\text{)},\\ B &\nsubseteq C && \text{(since } 2 \in B \text{ and } 2 \notin C\text{)},\\ A &\subseteq C && \text{(since } A = C = \{1\}\text{)}. \end{align*}

Both hypotheses are true, but the conclusion $A \nsubseteq C$ is false. Therefore, the statement is false.

Prove algebraically that for all sets $A$ and $B$, $((A^c \cup B^c)-A)^c = A$.

Proof

\begin{align*} &((A^c \cup B^c)-A)^c\\ &= ((A^c \cup B^c) \cap A^c)^c && \text{(set difference law)}\\ &= (A^c \cap (A^c \cup B^c))^c && \text{(commutative law)}\\ &= (A^c)^c && \text{(absorption law)}\\ &= A && \text{(double complement law)}. \end{align*}
Prove algebraically that for all sets $A$ and $B$,
$(A-B) \cup (B-A) = (A \cup B)-(A \cap B)$.

Proof

\begin{align*} &(A \cup B)-(A \cap B)\\ &= (A \cup B) \cap (A \cap B)^c && \text{(set difference law)}\\ &= (A \cup B) \cap (A^c \cup B^c) && \text{(De Morgan's law)}\\ &= ((A \cup B) \cap A^c) \cup ((A \cup B) \cap B^c) && \text{(distributive law)}\\ &= ((A \cap A^c) \cup (B \cap A^c)) \cup ((A \cup B) \cap B^c) && \text{(distributive law)}\\ &= (\emptyset \cup (B \cap A^c)) \cup ((A \cup B) \cap B^c) && \text{(complement law)}\\ &= (B \cap A^c) \cup ((A \cup B) \cap B^c) && \text{(identity law)}\\ &= (B \cap A^c) \cup ((A \cap B^c) \cup (B \cap B^c)) && \text{(distributive law)}\\ &= (B \cap A^c) \cup ((A \cap B^c) \cup \emptyset) && \text{(complement law)}\\ &= (B \cap A^c) \cup (A \cap B^c) && \text{(identity law)}\\ &= (B-A) \cup (A-B) && \text{(set difference law)}\\ &= (A-B) \cup (B-A) && \text{(commutative law)}. \end{align*}

Session 10: Functions

Fill the table with ✓ or ✗.
If a function is one-to-one or onto, then use ✓.
If a function is not one-to-one or not onto, then use ✗.

Solution

Function Sets (Domain and codomain) One-to-one function? Onto function?
$f(x) = x$ $f:\mathbb{R} \rightarrow \mathbb{R}$ ✓ ✓
$f(x) = x$ $f:\mathbb{Z} \rightarrow \mathbb{Z}$ ✓ ✓
$f(x) = x^2$ $f:\mathbb{R} \rightarrow \mathbb{R}$ ✗ ✗
$f(x) = x^2$ $f:\mathbb{Z} \rightarrow \mathbb{Z}$ ✗ ✗
$f(x) = x^3$ $f:\mathbb{R} \rightarrow \mathbb{R}$ ✓ ✓
$f(x) = x^3$ $f:\mathbb{Z} \rightarrow \mathbb{Z}$ ✓ ✗
$f(x) = 2^x$ $f:\mathbb{R} \rightarrow \mathbb{R}$ ✓ ✗
$f(x) = 2^x$ $f:\mathbb{N} \rightarrow \mathbb{N}$ ✓ ✗
$f(x) = 3^x$ $f:\mathbb{R} \rightarrow \mathbb{R}$ ✓ ✗
$f(x) = 3^x$ $f:\mathbb{N} \rightarrow \mathbb{N}$ ✓ ✗
$f(x) = \sqrt{x}$ $f:\mathbb{R}^{\ge 0} \rightarrow \mathbb{R}^{\ge 0}$ ✓ ✓
$f(x) = \sqrt{x}$ $f:\mathbb{N} \rightarrow \mathbb{R}^{\ge 0}$ ✓ ✗
$f(x) = \log_2(x)$ $f:\mathbb{R}^{+} \rightarrow \mathbb{R}$ ✓ ✓
$f(x) = \log_2(x)$ $f:\mathbb{N} \rightarrow \mathbb{R}^{\ge 0}$ ✓ ✗

Let $X = \{1,3,5\}$ and $Y = \{a,b,c,d\}$. Define $g:X\rightarrow Y$ by the following arrow diagram.
Function g maps 1, 3, and 5 to b XY 135 abcd g
  1. Write the domain of $g$ and the co-domain of $g$.
  2. Find $g(1)$, $g(3)$, and $g(5)$.
  3. What is the range of $g$?
  4. Is $3$ an inverse image of $a$? Is $1$ an inverse image of $b$?
  5. What is the inverse image of $b$? of $c$?
  6. Represent $g$ as a set of ordered pairs.

Solution

  1. The domain is $X=\{1,3,5\}$ and the co-domain is $Y=\{a,b,c,d\}$.
  2. $g(1) = b$, $g(3) = b$, $g(5) = b$.
  3. The range is $\{b\}$ because every input maps to $b$.
  4. $3$ is not an inverse image of $a$, since $g(3)=b\ne a$.
    $1$ is an inverse image of $b$, since $g(1)=b$.
  5. $g^{-1}(\{b\}) = \{1,3,5\}$, $g^{-1}(\{c\}) = \emptyset$.
  6. $g=\{(1,b),(3,b),(5,b)\}$.
Let $J_5 = \{0,1,2,3,4\}$, and define functions $f:J_5\rightarrow J_5$ and $g:J_5\rightarrow J_5$ as follows: For each $x\in J_5$, \begin{align*} f(x)&=(x+4)^2 \bmod 5, \text{ and}\\ g(x)&=(x^2+3x+1) \bmod 5. \end{align*} Is $f=g$? Explain.

Solution

Yes. For any $x\in J_5$,

\begin{align*} (x+4)^2 &=x^2+8x+16 && \text{(expand)}\\ &\equiv x^2+3x+1 \pmod 5 && \text{(since }8\equiv3,\ 16\equiv1\pmod 5\text{)}. \end{align*}

Thus $f(x)=g(x)$ for every $x\in J_5$. Since they have the same domain, co-domain, and output for each input, $f=g$.

Draw arrow diagrams for the Boolean functions defined by the following input/output tables.

InputOutput
$P$$Q$$R$
$1$$1$$0$
$1$$0$$1$
$0$$1$$0$
$0$$0$$1$

Solution

Each input is an ordered pair $(P,Q)$, and its output is $R$. The arrows are $ (1,1)\mapsto 0$, $(1,0)\mapsto 1$, $(0,1)\mapsto 0$, and $(0,0)\mapsto 1$.

Arrow diagram for Boolean function R InputOutput (1,1)(1,0)(0,1)(0,0) 01

The function can also be written as $F=\{((1,1),0),((1,0),1),((0,1),0),((0,0),1)\}$.

Let $S$ be the set of all strings of $0$’s and $1$’s, and define $L:S\rightarrow\mathbb{Z}^{\mathrm{nonneg}}$ by
$L(s)=$ the length of $s$, for every string $s\in S$.
  1. Is $L$ one-to-one? Prove or give a counterexample.
  2. Is $L$ onto? Prove or give a counterexample.

Proof

Part (a): Not one-to-one. Counterexample. Let $s_1=0$ and $s_2=1$. Then

\begin{align*} L(s_1)&=1,\\ L(s_2)&=1. \end{align*}

We have $L(s_1)=L(s_2)$ but $s_1\ne s_2$. Hence, $L$ is not one-to-one.

Part (b): Onto. Direct proof. Let $n\in\mathbb{Z}^{\mathrm{nonneg}}$. Choose $s$ to be the string of $n$ zeros (when $n=0$, take the empty string $\varepsilon$). Then

\begin{align*} L(s)&=n && \text{(defn. of length)}. \end{align*}

Every nonnegative integer is the length of some binary string. Hence, $L$ is onto.

Let $S$ be the set of all strings in $a$’s and $b$’s, and define $C:S\rightarrow S$ by
$C(s)=as$, for each $s\in S$.
($C$ is called concatenation by $a$ on the left.)
  1. Is $C$ one-to-one? Prove or give a counterexample.
  2. Is $C$ onto? Prove or give a counterexample.

Proof

Part (a): One-to-one. Direct proof. Suppose $s_1,s_2\in S$ and $C(s_1)=C(s_2)$. Then

\begin{align*} C(s_1)=C(s_2) &\implies as_1=as_2 && \text{(defn. of }C\text{)}\\ &\implies s_1=s_2 && \text{(remove the same initial }a\text{)}. \end{align*}

Hence, $C$ is one-to-one.

Part (b): Not onto. Counterexample. The string $b\in S$ has no inverse image under $C$. Every string $C(s)=as$ begins with $a$, so $C(s)\ne b$ for all $s\in S$. Hence, $C$ is not onto.

Define $S:\mathbb{Z}^+\rightarrow\mathbb{Z}^+$ by the rule: For each integer $n$, $S(n)=$ the sum of the positive divisors of $n$.
  1. Is $S$ one-to-one? Prove or give a counterexample.
  2. Is $S$ onto? Prove or give a counterexample.

Proof

Part (a): Not one-to-one. Counterexample. The distinct positive integers $6$ and $11$ have the same sum of positive divisors:

\begin{align*} S(6)&=1+2+3+6=12,\\ S(11)&=1+11=12. \end{align*}

Since $S(6)=S(11)$ but $6\ne11$, $S$ is not one-to-one.

Part (b): Not onto. Counterexample. The positive integer $2$ is not in the range of $S$. We have $S(1)=1$. If $n>1$, both $1$ and $n$ are distinct positive divisors of $n$, so

\begin{align*} S(n)&\ge 1+n\ge3. \end{align*}

Thus $S(n)\ne2$ for every $n\in\mathbb{Z}^+$. Hence, $S$ is not onto.

Define $G:\mathbb{R}\times\mathbb{R}\rightarrow\mathbb{R}\times\mathbb{R}$ as follows:
$G(x,y)=(2y,-x)$ for every $(x,y)\in\mathbb{R}\times\mathbb{R}$.
  1. Is $G$ one-to-one? Prove or give a counterexample.
  2. Is $G$ onto? Prove or give a counterexample.

Proof

Part (a): One-to-one. Direct proof. Suppose $G(x_1,y_1)=G(x_2,y_2)$. Then

\begin{align*} (2y_1,-x_1)&=(2y_2,-x_2) && \text{(defn. of }G\text{)}\\ \implies 2y_1&=2y_2 \text{ and } -x_1=-x_2 && \text{(equal ordered pairs)}\\ \implies y_1&=y_2 \text{ and } x_1=x_2 && \text{(simplify)}. \end{align*}

Hence $(x_1,y_1)=(x_2,y_2)$, so $G$ is one-to-one.

Part (b): Onto. Direct proof. Let $(u,v)\in\mathbb{R}\times\mathbb{R}$. Choose $(x,y)=(-v,u/2)\in\mathbb{R}\times\mathbb{R}$. Then

\begin{align*} G\left(-v,\frac{u}{2}\right) &=\left(2\cdot\frac{u}{2},-(-v)\right) && \text{(defn. of }G\text{)}\\ &=(u,v) && \text{(simplify)}. \end{align*}

Every element of the co-domain has an inverse image. Hence, $G$ is onto.

Session 11: Functions

Let $f: X \rightarrow Y$, $g: Y \rightarrow Z$, and $g \circ f : X \rightarrow Z$ be the functions. Given the properties of two functions, what can we say about the property of the third function?

Rule If and if Then
A. Closure $f$ is one-to-one $g$ is one-to-one $g \circ f$ is one-to-one.
$f$ is onto $g$ is onto $g \circ f$ is onto.
B. Cancellation $g \circ f$ is one-to-one $-$ $f$ is one-to-one.
$g \circ f$ is onto $-$ $g$ is onto.
C. Cancellation with a partner $g \circ f$ is one-to-one $f$ is onto $g$ is one-to-one.
$g \circ f$ is onto $g$ is one-to-one $f$ is onto.

The following functions are inverse to each other. Check that both compositions give the identity function.

$F:\mathbb{R} \rightarrow \mathbb{R}$ and $F^{-1}:\mathbb{R} \rightarrow \mathbb{R}$ are defined by \begin{align*} F(x)&=3x+2 \quad \text{and} \quad F^{-1}(y)=\frac{y-2}{3}, \end{align*} for every $y \in \mathbb{R}$.

Solution

Yes. We check both compositions.

\begin{align*} F^{-1}(F(x)) &= F^{-1}(3x+2) && \text{(defn. of }F\text{)}\\ &= \frac{(3x+2)-2}{3} && \text{(defn. of }F^{-1}\text{)}\\ &= x. \end{align*}

\begin{align*} F(F^{-1}(y)) &= F\left(\frac{y-2}{3}\right) && \text{(defn. of }F^{-1}\text{)}\\ &= 3\left(\frac{y-2}{3}\right)+2 && \text{(defn. of }F\text{)}\\ &= y. \end{align*}

Hence $F^{-1} \circ F = I_{\mathbb{R}}$ and $F \circ F^{-1} = I_{\mathbb{R}}$.

If $f:X \rightarrow Y$ and $g:Y \rightarrow Z$ are functions and $g \circ f$ is one-to-one, must $g$ be one-to-one? Prove or give a counterexample.

Solution

No. A counterexample shows that $g$ need not be one-to-one.

Let

\begin{align*} X&=\{1\}, & Y&=\{a,b\}, & Z&=\{0\}. \end{align*}

Define $f:X\rightarrow Y$ and $g:Y\rightarrow Z$ by

\begin{align*} f(1)&=a,\\ g(a)&=0, & g(b)&=0. \end{align*}

Then $g$ is not one-to-one because

\begin{align*} g(a)=g(b)=0 \quad \text{but} \quad a\ne b. \end{align*}

However, $g \circ f:X\rightarrow Z$ is one-to-one, because its domain $X=\{1\}$ has only one element. Explicitly,

\begin{align*} (g\circ f)(1)=g(f(1))=g(a)=0. \end{align*}

Therefore, even if $g \circ f$ is one-to-one, $g$ does not have to be one-to-one.

Let $3\mathbb{Z}=\{n\in\mathbb{Z}\mid n=3k,\text{ for some integer }k\}$. Prove that $\mathbb{Z}$ and $3\mathbb{Z}$ have the same cardinality.

Proof

Define $F:\mathbb{Z}\rightarrow 3\mathbb{Z}$ by $F(n)=3n$ for every $n\in\mathbb{Z}$.

We show that $F$ is a one-to-one correspondence.

One-to-one. Suppose $F(n_1)=F(n_2)$. Then

\begin{align*} F(n_1)=F(n_2) &\implies 3n_1=3n_2 && \text{(defn. of }F\text{)}\\ &\implies n_1=n_2. \end{align*}

So $F$ is one-to-one.

Onto. Let $m\in 3\mathbb{Z}$. Then, by the definition of $3\mathbb{Z}$, there exists an integer $k$ such that $m=3k$. Let $n=k$. Then

\begin{align*} F(n)=F(k)=3k=m. \end{align*}

So $F$ is onto.

Since $F$ is both one-to-one and onto, it is a one-to-one correspondence from $\mathbb{Z}$ to $3\mathbb{Z}$. Hence, $\mathbb{Z}$ and $3\mathbb{Z}$ have the same cardinality.

Let $S$ be the set of real numbers strictly between 0 and 1. That is, $S=\{x\in\mathbb{R}\mid 0<x<1\}$.

Let $U=\{x\in\mathbb{R}\mid 0<x<2\}$. Prove that $S$ and $U$ have the same cardinality.

Proof

Define $F:S\rightarrow U$ by $F(x)=2x$ for every $x\in S$.

We show that $F$ is a one-to-one correspondence.

One-to-one. Suppose $F(x_1)=F(x_2)$. Then

\begin{align*} F(x_1)=F(x_2) &\implies 2x_1=2x_2 && \text{(defn. of }F\text{)}\\ &\implies x_1=x_2. \end{align*}

So $F$ is one-to-one.

Onto. Let $y\in U$. Then $0<y<2$. Set $x=\dfrac{y}{2}$. Then

\begin{align*} 0<y<2 &\implies 0<\frac{y}{2}<1\\ &\implies x\in S. \end{align*}

Also,

\begin{align*} F(x)=F\left(\frac{y}{2}\right)=2\cdot\frac{y}{2}=y. \end{align*}

So $F$ is onto.

Since $F$ is both one-to-one and onto, it is a one-to-one correspondence from $S$ to $U$. Hence, $S$ and $U$ have the same cardinality.

Session 12: Relations

If Then
$R$ is reflexive $R^{-1}$ is reflexive
$R$ is symmetric $R^{-1}$ is symmetric
$R$ is transitive $R^{-1}$ is transitive
$R$ and $S$ are reflexive $R \cup S$ is reflexive
$R$ and $S$ are symmetric $R \cup S$ is symmetric
$R$ and $S$ are reflexive $R \cap S$ is reflexive
$R$ and $S$ are symmetric $R \cap S$ is symmetric
$R$ and $S$ are transitive $R \cap S$ is transitive
$R$ and $S$ are transitive $R^{-1} \cap S^{-1}$ is transitive
$R$ is an equivalence relation $R^{-1}$ is an equivalence relation
$R$ and $S$ are equivalence relations $R \cap S$ is an equivalence relation

Determine whether the relation is reflexive, symmetric, and transitive.
  1. Assume $R$ is a relation on $\mathbb{Z}$. For every $a, b \in \mathbb{Z}$, $a R b \Leftrightarrow |a - b| \le 1$
  2. Assume $R$ is a relation on $\mathbb{Z}$. For every $a, b \in \mathbb{Z}$, $a R b \Leftrightarrow ab > 0$
  3. Assume $R$ is a relation on $\mathbb{Z}$. For every $a, b \in \mathbb{Z}$, $a R b \Leftrightarrow ab \ge 0$
  4. Assume $R$ is a relation on $\mathbb{N}$. For every $a, b \in \mathbb{N}$, $a R b \Leftrightarrow \text{gcd}(a,b) > 1$
  5. Assume $R$ is a relation on $\mathbb{N}$. For every $a, b \in \mathbb{N}$, $a R b \Leftrightarrow a, b$ share a prime factor
  6. Assume $R$ is a relation on $\mathbb{N}$. For every $a, b \in \mathbb{N}$, $a R b \Leftrightarrow a \mid b$ or $b \mid a$

Solution

  1. Reflexive: Yes. For every $a\in\mathbb{Z}$,

    \begin{align*} |a-a| &= 0 \le 1. \end{align*}

    Symmetric: Yes. If $a\,R\,b$, then $|a-b|\le 1$, so

    \begin{align*} |b-a| &= |a-b| \le 1. \end{align*}

    Transitive: No. Take $a=0$, $b=1$, and $c=2$.

    \begin{align*} |0-1| &= 1 \le 1 && (0\,R\,1),\\ |1-2| &= 1 \le 1 && (1\,R\,2),\\ |0-2| &= 2 > 1 && (0\text{ is not related to }2). \end{align*}

    Thus $0\,R\,1$ and $1\,R\,2$, but $0$ is not related to $2$.

  2. Reflexive: No. At $a=0$, we have $a^2=0$, which is not positive. Hence $0$ is not related to itself.

    Symmetric: Yes. If $a\,R\,b$, then

    \begin{align*} ab > 0 &\implies ba > 0. \end{align*}

    Hence $b\,R\,a$.

    Transitive: Yes. Suppose $a\,R\,b$ and $b\,R\,c$. Then $ab>0$ and $bc>0$. Thus $a$ and $b$ have the same sign, and $b$ and $c$ have the same sign. So $a$ and $c$ have the same sign, giving

    \begin{align*} ac > 0. \end{align*}

    Hence $a\,R\,c$.

  3. Reflexive: Yes. For every $a\in\mathbb{Z}$,

    \begin{align*} a\cdot a &= a^2 \ge 0. \end{align*}

    Symmetric: Yes. If $a\,R\,b$, then

    \begin{align*} ab\ge 0 &\implies ba\ge 0. \end{align*}

    Transitive: No. Take $a=-1$, $b=0$, and $c=1$.

    \begin{align*} (-1)(0) &= 0 \ge 0 && ((-1)\,R\,0),\\ 0(1) &= 0 \ge 0 && (0\,R\,1),\\ (-1)(1) &= -1 < 0 && (-1\text{ is not related to }1). \end{align*}

    Hence the relation is not transitive.

  4. Reflexive: No. The element $1\in\mathbb{N}$ is not related to itself, since

    \begin{align*} \gcd(1,1)&=1. \end{align*}

    Symmetric: Yes, because

    \begin{align*} \gcd(a,b)&=\gcd(b,a). \end{align*}

    Transitive: No. Take $a=2$, $b=6$, and $c=3$.

    \begin{align*} \gcd(2,6) &= 2 >1 && (2\,R\,6),\\ \gcd(6,3) &= 3 >1 && (6\,R\,3),\\ \gcd(2,3) &= 1 && (2\text{ is not related to }3). \end{align*}

    Hence the relation is not transitive.

  5. Reflexive: No. The element $1\in\mathbb{N}$ has no prime factors, so $1$ does not share a prime factor with itself.

    Symmetric: Yes. If $a$ and $b$ share a prime factor, then $b$ and $a$ share that same prime factor.

    Transitive: No. Take $a=2$, $b=6$, and $c=3$.

    \begin{align*} 2\,R\,6 &\quad \text{(common prime factor: }2\text{)},\\ 6\,R\,3 &\quad \text{(common prime factor: }3\text{)}. \end{align*}

    But $2$ and $3$ share no prime factor, so they are not related.

  6. Reflexive: Yes, because every $a\in\mathbb{N}$ divides itself:

    \begin{align*} a\mid a. \end{align*}

    Symmetric: Yes. If $a\mid b$ or $b\mid a$, then the same disjunction holds with $a$ and $b$ interchanged.

    Transitive: No. Take $a=2$, $b=6$, and $c=3$.

    \begin{align*} 2\mid 6 &\implies 2\,R\,6,\\ 3\mid 6 &\implies 6\,R\,3. \end{align*}

    But neither $2\mid 3$ nor $3\mid 2$, so $2$ is not related to $3$.

Determine whether the relation is an equivalence relation.
If the relation is an equivalence relation, find all the equivalence classes.
  1. Assume $R$ is a relation on $\mathbb{Z}$. For every $a, b \in \mathbb{Z}$, $a R b \Leftrightarrow |a| = |b|$
  2. Assume $R$ is a relation on $\mathbb{R}$. For every $a, b \in \mathbb{R}$, $a R b \Leftrightarrow \lfloor a \rfloor = \lfloor b \rfloor$
  3. Assume $R$ is a relation on $\mathbb{N}$. For every $a, b \in \mathbb{N}$, $a R b \Leftrightarrow a$ and $b$ have the same number of digits

Solution

  1. Yes, $R$ is an equivalence relation.

    Reflexive: For every $a\in\mathbb{Z}$, $|a|=|a|$, so $a\,R\,a$.

    Symmetric: Suppose $a\,R\,b$. Then

    \begin{align*} |a|=|b| &\implies |b|=|a| &\implies b\,R\,a. \end{align*}

    Transitive: Suppose $a\,R\,b$ and $b\,R\,c$. Then

    \begin{align*} |a|=|b|,\quad |b|=|c| &\implies |a|=|c| &\implies a\,R\,c. \end{align*}

    The distinct equivalence classes are

    \begin{align*} [0]&=\{0\},\\ [n]&=\{n,-n\} \quad \text{for every integer }n>0. \end{align*}

    Thus they are $\{0\},\ \{1,-1\},\ \{2,-2\},\ldots$.

  2. Yes, $R$ is an equivalence relation.

    Reflexive: For every $a\in\mathbb{R}$, $\lfloor a\rfloor=\lfloor a\rfloor$, so $a\,R\,a$.

    Symmetric: Suppose $a\,R\,b$. Then

    \begin{align*} \lfloor a\rfloor=\lfloor b\rfloor &\implies \lfloor b\rfloor=\lfloor a\rfloor &\implies b\,R\,a. \end{align*}

    Transitive: Suppose $a\,R\,b$ and $b\,R\,c$. Then

    \begin{align*} \lfloor a\rfloor=\lfloor b\rfloor,\quad \lfloor b\rfloor=\lfloor c\rfloor &\implies \lfloor a\rfloor=\lfloor c\rfloor &\implies a\,R\,c. \end{align*}

    If $n=\lfloor a\rfloor$, then the class of $a$ is

    \begin{align*} [a]&=\{x\in\mathbb{R}\mid\lfloor x\rfloor=n\}\\ &=[n,n+1). \end{align*}

    The distinct equivalence classes are $[n,n+1)$ for every integer $n$.

  3. Yes, $R$ is an equivalence relation.

    Reflexive: Every natural number has the same number of digits as itself.

    Symmetric: If $a$ and $b$ have the same number of digits, then $b$ and $a$ have the same number of digits.

    Transitive: If $a$ and $b$ have the same number of digits, and $b$ and $c$ have the same number of digits, then $a$ and $c$ have the same number of digits.

    For each positive integer $k$, let $D_k$ be the class of $k$-digit natural numbers. Then

    \begin{align*} D_1&=\{1,2,\ldots,9\},\\ D_2&=\{10,11,\ldots,99\},\\ D_3&=\{100,101,\ldots,999\},\\ &\ \vdots\\ D_k&=\{10^{k-1},10^{k-1}+1,\ldots,10^k-1\}. \end{align*}

    These are all the distinct equivalence classes (taking $\mathbb{N}=\{1,2,3,\ldots\}$).

Session 13: Final

Cover the common mistakes from all topics for the final from Common Mistakes file.