357 lines
12 KiB
Markdown
357 lines
12 KiB
Markdown
# ECE 108: Discrete Math 1
|
|
|
|
An **axiom** is a defined core assumption of the mathematical system held to be true without proof.
|
|
|
|
!!! example
|
|
True is not false.
|
|
|
|
A **theorem** is a true statement derived from axioms via logic or other theorems.
|
|
|
|
!!! example
|
|
True or false is true.
|
|
|
|
A **proposition/statement** must be able to have the property that it is exclusively true or false.
|
|
|
|
!!! example
|
|
The square root of 2 is a rational number.
|
|
|
|
An **open sentence** becomes a proposition if a value is assigned to the variable.
|
|
|
|
!!! example
|
|
$x^2-x\geq 0$
|
|
|
|
## Truth tables
|
|
|
|
A truth table lists all possible **truth values** of a proposition, containing independent **statement variables**.
|
|
|
|
!!! example
|
|
| p | q | p and q |
|
|
| --- | --- | --- |
|
|
| T | T | T |
|
|
| T | F | F |
|
|
| F | T | F |
|
|
| F | F | F |
|
|
|
|
## Logical operators
|
|
|
|
!!! definition
|
|
- A **compound statement** is composed of **component statements** joined by logical operators AND and OR.
|
|
|
|
The **negation** operator is equivalent to logical **NOT**.
|
|
|
|
$$\neg p$$
|
|
|
|
The **conjunction** operaetor is equivalent to logical **AND**.
|
|
|
|
$$p\wedge q$$
|
|
|
|
The **disjunction** operator is equivalent to logical **OR**.
|
|
|
|
$$p\vee q$$
|
|
|
|
### Proposation relations
|
|
|
|
!!! definition
|
|
A **tautology** is a statement that is always true, regardless of its statement variables.
|
|
|
|
The **implication** sign requires that if $p$ is true, $q$ is true, such that *$p$ implies $q$*. The first symbol is the **hypothesis** and the second symbol is the **conclusion**.
|
|
|
|
$$p\implies q$$
|
|
|
|
| $p$ | $q$ | $p\implies q$ |
|
|
| --- | --- | --- |
|
|
| T | T | T |
|
|
| T | F | F |
|
|
| F | T | T |
|
|
| F | F | F |
|
|
|
|
The **inference** sign represents the inverse of the implication sign, such that $p$ **is implied by** $q$. It is equivalent to $q\implies p$.
|
|
|
|
$$p\impliedby q$$
|
|
|
|
The **if and only if** sign requires that the two propositions imply each other — i.e., that the state of $p$ is the same as the state of $q$. It is equivalent to $(p\implies q)\wedge (p\impliedby q)$.
|
|
|
|
$$p\iff q$$
|
|
|
|
The **logical equivalence** sign represents if the truth values for both statements are **the same for all possible variables**, such that the two are **equivalent statements**.
|
|
|
|
$$p\equiv q$$
|
|
|
|
$p\equiv q$ can also be defined as true when $p\iff q$ is a tautology.
|
|
|
|
!!! warning
|
|
$p\equiv q$ is *not a proposition* itself but instead *describes* propositions. $p\iff q$ is the propositional equivalent.
|
|
|
|
## Common theorems
|
|
|
|
The **double negation rule** states that if $p$ is a proposition:
|
|
|
|
$$\neg(\neg p)\equiv p$$
|
|
|
|
!!! tip "Proof"
|
|
Note that:
|
|
|
|
| $p$ | $\neg p$ | $\neg(\neg p)$ |
|
|
| --- | --- | --- |
|
|
| T | F | T |
|
|
| F | T | F |
|
|
|
|
Because the truth values of $p$ and $\neg(\neg p)$ for all possible truth values are equal, by definition, it follows that $p\equiv\neg(\neg p)$.
|
|
|
|
!!! warning
|
|
Proofs must include the definition of what is being proven, and any relevant evidence must be used to describe why.
|
|
|
|
The two **De Morgan's Laws** allow distributing the negation operator in a dis/conjunction if the junction is inverted.
|
|
|
|
$$
|
|
\neg(p\vee q)\equiv(\neg p)\wedge(\neg q) \\
|
|
\neg(p\wedge q)\equiv(\neg p)\vee(\neg q)
|
|
$$
|
|
|
|
An implication can be expressed as a disjunction. As long as it is stated, it can used as its definition.
|
|
|
|
$$p\implies \equiv (\neg p)\vee q$$
|
|
|
|
Two **converse** propositions imply each other:
|
|
|
|
$$p\implies q\text{ is the converse of }q\implies p$$
|
|
|
|
A **contrapositive** is the negatated converse, and is **logically equivalent to the original implication**. This allows proof by contrapositive.
|
|
|
|
$$\neg p\implies\neg q\text{ is the contrapositive of }q\implies p$$
|
|
|
|
### Operator laws
|
|
|
|
Both **AND** and **OR** are commutative.
|
|
|
|
$$
|
|
p\wedge q\equiv q\wedge p \\
|
|
p\vee q\equiv q\vee p
|
|
$$
|
|
|
|
Both **AND** and **OR** are associative.
|
|
|
|
$$
|
|
(p\wedge q)\wedge r\equiv p\wedge(q\wedge r) \\
|
|
(p\vee q)\vee r\equiv p\vee(q\vee r)
|
|
$$
|
|
|
|
Both **AND** and **OR** are distributive with one another.
|
|
|
|
$$
|
|
p\wedge(q\vee r)\equiv(p\wedge q)\vee(p\wedge r) \\
|
|
p\vee(q\wedge r)\equiv(p\vee q)\wedge(p\vee r)
|
|
$$
|
|
|
|
!!! tip "Proof"
|
|
$$
|
|
\begin{align*}
|
|
(\neg p\vee\neg r)\wedge s\wedge\neg t&\equiv\neg(p\wedge r\vee s\implies t) \\
|
|
\tag*{definition of implication} &\equiv \neg (p\wedge r\vee[\neg s\vee t]) \\
|
|
\tag*{DML} &\equiv\neg(p\wedge r)\wedge\neg[(\neg s)\vee t)] \\
|
|
\tag*{DML} &\equiv(\neg p\vee\neg r)\wedge\neg[(\neg t)\vee t] \\
|
|
\tag*{DML} &\equiv(\neg p\vee\neg r)\wedge\neg(\neg s)\wedge\neg t \\
|
|
\tag*{double negation} &\equiv(\neg p\vee\neg r)\wedge s\wedge\neg t
|
|
\end{align*}
|
|
$$
|
|
|
|
### Quantifiers
|
|
|
|
A **quantified statement** includes a **quantifier**, **variable**, **domain**, and **open sentence**.
|
|
|
|
$$
|
|
\underbrace{\text{for all}}_\text{quantifier}\ \underbrace{\text{real numbers}\overbrace{x}^\text{variable}\geq 5}_\text{domain}, \underbrace{x^2-x\geq 0}_\text{open sentence}
|
|
$$
|
|
|
|
The **universal quantifier** $\forall$ indicates "for all".
|
|
|
|
$$\forall x\in S,P(x)$$
|
|
|
|
!!! example
|
|
All real numbers greater than or equal to 5, defined as $x$, satisfy the condition $x^2-x\geq 0$.
|
|
|
|
$$\forall x\in\mathbb R\geq 5,x^2-x\geq 0$$
|
|
|
|
The **existential quantifier** $\exists$ indicates "there exists at least one".
|
|
|
|
$$\exists x\in S, P(x)$$
|
|
|
|
!!! example
|
|
There exists at least one real number greater than or equal to 5, defined as $x$, satisfies the condition $x^2-x\geq 0$.
|
|
|
|
$$\exists x\in\mathbb R\geq 5,x^2-x\geq 0$$
|
|
|
|
Quantifiers can also be negated and nested. The opposite of "for each ... that satisfies $P(x)$" is "there exists ... that does **not** satisfy $P(x)$".
|
|
|
|
$$\neg(\forall x\in S,P(x))\equiv\exists x\in S,\neg P(x)$$
|
|
|
|
Nested quantifiers are **evaluated in sequence**. If the quantifiers are the same, they can be grouped together per the commutative and/or associative laws.
|
|
|
|
$$\forall x\in\mathbb R,\forall y\in\mathbb R\equiv \forall x,y\in\mathbb R$$
|
|
|
|
!!! warning
|
|
This means that the order of the quantifiers is relevant if the quantifiers are different:
|
|
|
|
$\forall x\in\mathbb R,\exists y\in\mathbb R,x-y=1$ is **true** as setting $y$ to $x-1$ always fulfills the condition.
|
|
|
|
$\exists y\in\mathbb R,\forall x\in\mathbb R, x-y=1$ is **false** as when $x$ is selected first, it is impossible for every value of $y$ to satisfy the open sentence.
|
|
|
|
## Proof techniques
|
|
|
|
There are a variety of methods to prove or disprove statements.
|
|
|
|
- **Deduction**: a chain of logical inferences from a starting assumption to a conclusion
|
|
- **Case analysis**: exhausting all possible cases (e.g., truth table)
|
|
- **Contradiction**: assuming the conclusion is false, which follows that a core assumption is false, therefore the conclusion must be true
|
|
- **Contrapositive**: is equivalent to the original statement
|
|
- **Counterexample**: disproves things
|
|
- **Induction**: Prove for a small case, then prove that that applies for all cases
|
|
|
|
Implications can be proven in two simple steps:
|
|
|
|
1. It is assumed that the hypothesis is true (the implication is always true when it is false)
|
|
2. Proving that it follows that the conclusion is true
|
|
|
|
!!! example "Proving implications"
|
|
Prove that if $n+7$ is even, $n+2$ is odd.
|
|
|
|
$\text{Proof:}$
|
|
|
|
$\text{Assume }n+7\text{ is an even number. It follows that for some }k\in\mathbb Z$
|
|
|
|
$$
|
|
\begin{align*}
|
|
n+7&=2k \\
|
|
\text{s.t.} n+2&=2k-5 \\
|
|
&=2(k-3)+1
|
|
\end{align*}
|
|
$$
|
|
|
|
$\text{which is of the form }2z+1,z\in\mathbb Z,\text{ thus } n+2\text{ is odd.}$
|
|
|
|
!!! example "Proof by contradiction"
|
|
Prove that there is no greatest integer.
|
|
|
|
$\text{Proof:}$
|
|
|
|
$\text{ Let }n\in\mathbb Z\text{ be given and assume }\overbrace{\text{for the sake of contradiction}^\text{FTSOC}}\text{ that }n\text{ is the largest integer. Note that }n+1\in\mathbb Z\text{ and }n+1>n.\text{ This contradicts the initial assumption that }n\text{ is the largest integer, therefore there is no largest integer.}$
|
|
|
|
### Formal theorems
|
|
|
|
An **even number** is a multiple of two.
|
|
|
|
$$\boxed{n\ \text{is even}\iff\exists k\in\mathbb Z,n=2k}$$
|
|
|
|
An **odd number** is a multiple of two plus one.
|
|
|
|
$$\boxed{n\text{ is odd}\iff\exists k\in\mathbb Z,n=2k+1}$$
|
|
|
|
A number is **divisible** by another $m|n$ if it can be part of its product.
|
|
|
|
$$\boxed{n\text{ is divisible by } m\iff\exists k\in\mathbb Z,n=mk}$$
|
|
|
|
A number is a **perfect square** if it is the square of an integer.
|
|
|
|
$$n\text{ is a perfect square}\iff \exists k\in\mathbb Z,n=k^2$$
|
|
|
|
### Induction
|
|
|
|
!!! definition
|
|
- A proof **without loss of generality** (WLOG) indicates that the roles of variables do not matter — so long as the symbols CTRL-H'd, the proof remains exactly the same. For example, "WLOG, let $x,y\in\mathbb Z$ st. $x<y$."
|
|
|
|
Induction is a proof technique that can be used if the open sentence $P(n)$ depends on the parameter $n\in\mathbb N$. Because induction works in discrete steps, it generally cannot be applied domains of all real numbers.
|
|
|
|
To do so, the following must be proven:
|
|
|
|
- $P(1)$ must be true (the base case)
|
|
- $P(k+1)$ must be true for all $P(k)$, assuming $P(k)$ is true (the inductive case)
|
|
|
|
!!! warning
|
|
The statement **cannot** be assumed to be true, so one side must be derived into the other side.
|
|
|
|
!!! tip "Proof"
|
|
This should more or less be exactly followed. For the statement $\forall n\in\mathbb Z,n!>2^n$:
|
|
|
|
> We use mathematical induction on $n$, where $P(n)$ is the statement $n!>2^n$.
|
|
>
|
|
> **Base case**: Our base case is $P(4)$. Note that $4!=24>16=2^4$, so the base case holds.
|
|
>
|
|
> **Inductive step**: Let $k\geq 4$ for an arbitrary natural number and assume that $k!>2^k$. Multiplying by $k+1$ gives
|
|
>
|
|
> $$(k+1)k^2>(k+1)2^k$$
|
|
>
|
|
> By definition $(K=1)k!=(k+1)!$. Since $k\geq 4$, $k+1>2$ and thus $(k+1)2^k>2\cdot 2^k=2^{k+1}$. Putting this together gives
|
|
>
|
|
> $$(k+1)!>2^{k+1}$$
|
|
>
|
|
> Thus $P(k+1)$ is true and by the Principle of Mathematical Induction (POMI), $P(n)$ is true for all $n\geq 4$.
|
|
|
|
Induction can be applied to the whole set of integers by proving the following:
|
|
|
|
- $P(0)$
|
|
- if $i\geq 0, P(i)\implies P(i+1)$
|
|
- if $i\leq 0, P(i)\implies P(i-1)$
|
|
|
|
Alternatively, some steps can be skipped in **strong induction** by proving that if for $k\in\mathbb N$, $P(i)$ holds for all $i\leq k$, so $P(k+1)$ holds. In other words, by assuming that the statement is true for all values before $k$. If strong induction is true, regular induction must also be true, but not vice versa.
|
|
|
|
## Sets
|
|
|
|
!!! definition
|
|
- A **set** is an unordered collection of distinct objects.
|
|
- An **element/member** of a set is an object in that set.
|
|
- A **multiset** is an unordered collection of objects.
|
|
|
|
Sets are expressed with curly brackets:
|
|
|
|
$$\{s_1, s_2,\dots\}$$
|
|
|
|
Numbers are defined as sets of recursively empty sets:
|
|
|
|
$$
|
|
\begin{align*}
|
|
0&:=\empty \\
|
|
1&:=\{\empty\} \\
|
|
2&:=\{\empty,\{\empty\}\}
|
|
\end{align*}
|
|
$$
|
|
|
|
### Special sets
|
|
|
|
- $\mathbb N$ is the set of **natural numbers** $\{1, 2, 3,\dots\}$
|
|
- $\mathbb W$ is the set of **whole numbers** $\{0, 1, 2,\dots\}$
|
|
- $\mathbb Z$ is the set of **integers** $\{\dots, -1, 0, 1, \dots\}$
|
|
- $\mathbb Z^+_0$ is the set of **positive integers, including zero** — these modifiers can be applied to the set of negative integers and real numbers as well
|
|
- $2\mathbb Z$ is the set of **even integers**
|
|
- $2\mathbb Z + 1$ is the set of **odd integers**
|
|
- $\mathbb Q$ is the set of **rational numbers**
|
|
- $\mathbb R$ is the set of **real numbers**
|
|
- $\empty$ or $\{\}$ is the **empty set** with no elements
|
|
|
|
### Set builder notation
|
|
|
|
!!! definition
|
|
- The **domain of discourse** is the context of the current problem, which may limit the universal set (e.g., if only integers are discussed, the domain is integers only)
|
|
|
|
$x$ is an element if $x$ is in $\mathcal U$ and $P(x)$ is true.
|
|
|
|
$$\{x\in\mathcal U|P(x)\}$$
|
|
|
|
!!! example
|
|
All even numbers: $A=\{n\in\mathbb Z,\exists k\in\mathbb Z,n=2k\}$
|
|
|
|
$f(x)$ is an element if $x$ is in $\mathcal U$, and $P(x)$ is true:
|
|
|
|
$$\{f(x)|\underbrace{x\in\mathcal U, P(x)}_\text{swappable, omittable}\}$$
|
|
|
|
!!! example
|
|
- All even numbers: $A=\{2k|k\in\mathbb Z\}$
|
|
- All rational numbers: $\mathbb Q=\{\frac a b | a,b\in\mathbb Z,b\neq 0\}$
|
|
|
|
The **complement** of a set is the set containing every element **not** in the set.
|
|
|
|
$$\overline S$$
|
|
|
|
The **universal set** is the set containing everything, and is the complement of the empty set.
|
|
|
|
$$\mathcal U=\overline\empty$$
|