eifueo/docs/1b/ece108.md
2023-04-10 13:30:32 -04:00

31 KiB
Raw Blame History

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 Morgans 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-Hd, 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\]

Two sets are disjoint if they do not have any elements in common.

\[S\cup T=\empty\]

Set operations

A subset is inside another that is a superset.

\[ S\subseteq T \\ S\subseteq T\iff \forall x\in\mathcal U,(x\in S\implies x\in T) \]

A strict or proper subset is a subset that is not equal to its strict or proper superset.

\[S\subset T\]

Two sets are equal if they are subsets of each other.

\[S=T\equiv (S\subseteq T)\wedge (T\subseteq S)\]

The union of two sets is the set that contains any element in either set.

\[S\cup T=\{x\in\mathcal U|(x\in S)\vee(x\in T)\}\]

The intersection of two sets is the set that only contains elements in both sets.

\[S\cap T=\{x\in\mathcal U|(x\in S)\wedge(x\in T)\}\]

The difference of two sets is the set that contains elements in the first but not the second. The remainder is dropped.

\[S-T=S\backslash T\]

The complementary set is every element not in that set.

\[ \overline S=\{x:x\not\in S\} \\ \overline S=\mathcal U-S \]

The intersection and union operators have the same properties as AND and OR and so are equally commutative / associative.

De Morgans laws still hold with sets.

Intervals

An interval can be represented as a bounded set.

\[[a,b)=\{x\in\mathcal U|a\leq x\wedge x<b\}\]

\(\empty\) is any impossible interval.

Ordered pairs

!!! definition - A binary relation on two sets \(A, B\) is a subset of their Cartesian product. - An n-ary relation between \(n\) sets is a subset of their n-Cartesian product.

Also known as tuples, ordered pairs are represented by angle brackets.

\[\left<a,b\right> = \left<c,d\right>\iff (a=c)\wedge(b=d)\]

The Cartesian product of two sets is the set of all ordered pair combinations within the two sets.

\[A\times B=\{\left<a,b\right> | (a\in A)\wedge (b\in B)\}\]

It is effectively the cross product, so is not commutative, although distributing unions, intersections, and differences works as expected.

The n-Cartesian product of \(n\) sets expands the Cartesian product.

\[A\times B\times\dots\times Z=\{\left<a, b,\dots z\right>|a\in A, b\in B,\dots,z\in Z\}\]

Powersets

!!! definition - An index set \(I\) is the set containing all relevant indices.

A partition of a set \(S\) is a set of disjoint sets that create the original set when unioned.

\[S=\bigcup_{i\in I}A_i\]

!!! example \(\{\{1\},\{2,3\},\{4,\dots\}\}\) is a partition of \(\mathbb N\).

A powerset of a set \(A\) is the set of all possible subsets of that set.

\[\mathcal P(A)=\{X|X\subseteq A\}\]

The empty set is the subset of every set so is part of each powerset. The number of elements in a subset is equal to the the number of elements in the original set as a power of two.

\[\dim(\mathcal P(A))=2^{\dim(A)}\]

!!! example - \(\mathcal P(\empty)=\empty\) - \(\mathcal P(\{1,2\})=\{\empty, \{1\}, \{2\}, \{1, 2\}\}\)

By definition, any subset is an element in the powerset.

\[A\subseteq B\equiv A\in\mathcal P(B)\]

  • \(\empty\in\mathcal P(A)\)
  • \(A\in\mathcal P(A)\)
  • \(A\subseteq B\implies (\mathcal P(A)\subseteq \mathcal P(B))\)
  • \(A\in C\implies (C-A\subseteq C)\)

!!! example To prove \(A\subseteq B\implies \mathcalP(A)\subseteq \mathcal P(B)\):

**Proof:** Let $A\subseteq B$ and $X\in\mathcal P(A)$. By definition, since $X\in\mathcal P(A), X\subseteq A$. Since $A\subseteq B$, it follows that $X\subseteq B$. Thus by the definition of the powerset, $X\in\mathcal P(B)$.

Functions

!!! definition - A surjective function has an equal codomain and range.

A function a relation between two sets \(f:X\to Y\) such that each \(x\in X\) maps to a unique \(f(x)\in Y\).

\[ \begin{align*} f:\ &X\to Y \\ &x\longmapsto f(x) \end{align*} \]

!!! example Sample function with multiple cases and indices:

$$
\begin{align*}
f:\ &X\to Y \\
&x_i\longmapsto \begin{cases}
y_1 & i\in\{1,2\} \\
y_3 & i\in\{3,4,5\}
\end{cases}
\end{align*}
$$

The domain \(\text{dom}(f)\) is the input set.

\[X=\text{dom}(f)\]

The codomain \(\text{cod}(f)\) is the output set.

\[Y=\text{cod}(f)\]

The range \(\text{rang}(f)\) is the subset of \(Y\) that is actually mapped to by the domain.

\[ \begin{align*} \text{rang}(f)&=\{y\in Y|\exists x\in X,y=f(x)\} \\ &=\{f(x)|x\in X\} \end{align*} \]

The pre-image is the subset of the domain that maps to a specific subset \(B\) of the codomain.

\[\text{preimage}(f)=\{x\in X|\exists y\in B,y=f(x)\}\]

The image is the subset of the codomain that is mapped by a specific subset \(A\) of the domain.

\[\text{image}(f)=\{f(x)|\exists x\in A\}\]

!!! example For the function \(f: \mathbb R^+_0\to \mathbb R\) defined by \(x\longmapsto x^2\):

- the domain is $\mathbb R^+_0$
- the codomain is $\mathbb R$
- the range is $\mathbb R^+_0$
- the preimage for $\{1\}$ is $\{1,-1\}$
- the image for $0$ is $\{0\}$

Two functions \(f=g\) are equal if and only if:

  • their domains are equal
  • their codomains are equal
  • \(f(x)=g(x)\) for all \(x\in \text{dom}(f)\)

Function types

An injective function, injection, or one-to-one function is a function that maps only one \(y\)-value to each \(x\).

\[\forall x_1,x_2\in\text{dom}(f), \text{ if } f(x_1)=f(x_2),x_1=x_2\]

A surjective function, surjection, or onto is a function that has its codomain equal to its range. A surjection \(g:Y\to X\) exists if and only if an injection \(f:X\to Y\) exists.

\[ \forall y\in\text{cod}(f),\exists x\in\text{dom}(f), f(x)=y \\ \text{rang}(f)=\text{cod}(f) \]

A bijective function is both injective and surjective.

An inverse relation swaps the domain, codomain, and ordered pairs.

\[ \begin{align*{ R^{-1}:Y&\to X \\ R(x)&\mapsto x \]

A function is invective or invertible if and only if it is bijective. All inversions are also bijective.

\[f^{-1^{-1}}=f\]

A composition maps the codomain of one to the domain of another function only if the first is a subset (\(Y_1\subseteq Y_2\)).

\[ \begin{align*} f&:X\to Y_1,x\mapsto f(x) \\ g&:Y_2\to Z,y\mapsto g(y) \\ gf&: X\to Z,x\mapsto g(f(x)) \end{align*} \]

Compositions are commutative but not associative.

  • \(h(gf)=(hg)f\)
  • \(hgf\neq hfg\)
  • \(f, g\) are injective \(\implies\) \(gf\) is injective
  • \(f, g\) are surjective \(\implies\) \(gf\) is surjective
  • \(gf\) is injective \(\implies\) \(f\) is injective
  • \(gf\) is surjective \(\implies\) \(g\) is surjective

The identity function is the function that returns its argument. Generally, a function composed with its inverse is the identity function.

\[ \begin{align*} I:X&\to X \\ x&\mapsto x \end{align*} \]

If \(f: X\to Y\) is bijective:

  • the identity on \(Y\) is \(f(f^{-1}(y))\)
  • the identity on \(X\) is \(f^{-1}(f(x))\)

If \(f: X\to Y\) and \(g: Y\to Z\) are bijective:

  • \(gf\) exists and is invertible
  • \(f^{-1}g^{-1}=(gf)^{-1}\) and exists

Cardinality

!!! definition - A countably infinite set is such that there exists a bijective function that maps the set to the set of natural numbers. - A countable set is a finite set or a countably infinite set. - An uncountable or uncountably infinite set is not countable.

The cardinality of a set is the number of elements in that set.

\[|S|\]

If two sets have a finite number of elements, their Cartesian product will have the same number of elements as the product of their elements.

\[|A|,|B|\in\mathbb N\implies|A\times B|=|A||B|\]

If two sets \(X\) and \(Y\) have finite cardinality and \(f:X\to Y\):

  • An injective function must have \(|X|\leq |Y|\).
  • A surjective function must have \(|X|\geq |Y|\).
  • A bijective function occurs if and only if \(|X|=|Y|\).

A set is finite if it is empty or it is mappable to a subset of the natural numbers. By definition, the set of natural numbers is infinite.

\[\exists n\in\mathbb N,\exists f\text{ is bijective}, f:S\to \mathbb N_n,|s|=n\]

Uncountable sets

The cardinality of countable sets is relative to the cardinality of the set of natural numbers.

\[|\mathbb N|=\aleph_0\]

By Contors theorem, the powerset of the natural numbers must have a larger cardinality than the set of natural numbers.

\[|X|=\aleph_0\implies|\mathcal P(X)|=2^{\aleph_0}>\aleph_0\]

The following can be taken for granted:

  • \(|\mathbb R|>|\mathbb N|\)
  • \(|\mathcal P(\mathbb N)|>|\mathbb N|\)
  • \(|\mathcal P(\mathbb N)|=|\mathbb R|\)

Relations

A binary relation \(R\) from sets \(A\) to \(B\) must be a subset of the two. A relation from \(A\) to \(A\) can be written as \(R\subseteq A^2\).

\[R\subseteq A\times B\].

!!! example - \(\forall x,y\in A,B,x<y\) is a subset. \(<\) is a binary relation.

For \(R\subseteq X\times Y\):

  • \(\text{dom}(R)=\{x\in X|\exists y\in Y,xRy\}\)
  • \(\text{cod}(R)=Y\)
  • \(\text{rang}(R)=\{y\in Y|\exists x\in X,xRy\}\)
  • The image of \(X_1\subseteq X\) under \(R\): \(R(X_1)=\{y\in Y|\exists x\in X_1xRy\}\)
  • The pre-image is: \(R^{-1}(Y_1)=\{x\in X|\exists y\in Y_1,xRy\}\)

Relations are trivially proven to be relations through subset analysis.

!!! example For the relation \(L\)R2={<x,y>R2|x<y}$:

Clearly it is a subset of $R^2$, so it is a relation.

- The domain is $\mathbb R$.
- The range is $\mathbb R$.
- $L(\{1,4\})=\{y>4|y\in\mathbb R\}$ (1 OR 4)
- $L^{-1}(\{-1,2\})=\{x\in\mathbb R|x<2\}$ (-1 OR 2)

The empty relation \(\empty\) is a relation on all sets.

The identity relation on all sets returns itself.

\[E=\{\left<a,a\right>|a\in A\}\]

The universal relation relates each element in the first set to every element to the second set.

\[U=A^2\]

The restriction of relation \(R\) to set \(B\) limits a previous relation on a superset \(A\) such that \(B\subseteq A\).

\[R\big|_B=R\cap B^2\]

Graphs are often used to represent relations. A node from \(4\to3\) can be represented as \(\left<3,4\right>\), much like an adjacency list.

Reflexivity

A reflexive relation \(R\subseteq X^2\) is such that every element in \(X\) is related to itself by the relation.

\[\forall x\in X,\left<x,x\right>\in R\]

An irreflexive relation is such that each element is not related to itself.

\[\forall x\in X,\left<x,x\right>\not\in R\]

Reflexivity is determined graphically by checking if the main diagonal of a truth table is true.

!!! example For the reflexive relation \(R\), \(A=\{1,2\},R=\{\left<1,1\right>,\left<2,2\right>\}\):

|$A\times A$ | 1 | 2 |
| --- | --- | --- |
| 1 | T | F |
| 2 | F | T |

!!! warning \(\empty\) is often vacuously true for most conditions.

If \(R\) is a non-empty relation on a non-empty set \(X\), \(R\) cannot be both reflexive and irreflexive.

Symmetry

A symmetric relation \(R\subseteq X^2\) is such that every relation goes both ways.

\[\forall x,y\in X^2,\left<x,y\right>\in R\iff\left<y,x\right>\in R\]

An asymmetric relation is such that no relation goes both ways.

\[\forall x,y\in X^2,\left<x,y\right>\in R\implies\left<y,x\right>\not\in R\]

An antisymmetric relation is such that no relation goes both ways, except if compared to itself, and that the relation relates identical items.

\[\forall x,y\in X^2,\left<x,y\right>\in R\wedge\left<y,x\right>\in R\implies x=y\]

Where \(x,y,z\) are elements in \(X\), and \(p,q,r\) are arbitrary proposition results (true/false):

  • Symmetric relations must be symmetrical across the main diagonal of a truth table.
\(X^2\) \(x\) \(y\) \(z\)
\(x\) ? \(p\) \(q\)
\(y\) \(\neg p\) ? \(r\)
\(z\) \(\neg q\) \(\neg r\) ?
  • Asymmetric relations must be oppositely symmetrical across the main diagonal. The main diagonal also must be false.
  • Antisymmetric relations must be false only if there is a true.

Transitivity

A transitive relation links related terms. For example, \(a<b\) and \(b<c\) implies \(a<c\).

\[\forall x,y,z\in X,\left<x,y\right>\in R\wedge\left<y,z\right>\in R\implies\left<x,z\right>\in R\]

Orders

!!! definition - A partial order is reflextive, antisymmetric, and transitive.

A partially ordered set (poset) is a set \(S\) partially ordered with relation \(R\).

\[\left<S,R\right>\text{ on } P=R_{S,P}\]

!!! example \(R_{\mathbb Z,\geq}\) is a poset. \(\left<\mathcal P(A),\subseteq\right>\) on \(A\) is also a poset.

A strict poset is irreflexive, asymmetric, and transitive.

A total order is a strict poset such that the relation is defined between every possible pair on the set.

\[\forall x,y\in S,xPy\wedge yPx\in\left<S,P\right>\]

Equivalence relations

An equivalence class is a criterion that determines whether two objects are equivalent. The original set must be the union of all equivalence classes.

!!! example The following are all in the equivalence class \(=_1\): \(\{1,\frac 2 2,\frac 3 3,\frac 4 4,...\right}\)

Combinatorics

!!! definition - and usually requires you to multiply sets together. - or usually requires you to add then subtract unions.

The number of ways to choose exactly one element from finite sets is the product of their dimensions.

\[|A_1||A_2|...|A_n|\]

!!! example The number of unique combinations (including order) from four dice is \(|6|^4\).

Ordered with replacement

These problems count order as separate permutations and replace an item after it is taken for the future. If there are \(n\) outcomes, and \(m\) events that take one of those outcomes:

\[P=n^m\]

To pick \(m\) items out of \(n\) elements:

\[P(n,m)=\frac{n!}{(n-m!)}\]

If there are duplicates that would otherwise result in an identical string, divide the result by \(m!\), where \(m\) is the number of repetitions for each duplicate \(n_1,n_2,...\).

\[{n\choose n_1!n_2!n_k!}=\frac{n!}{n_1!n_2!...n_k!}\]

!!! example The number of permutations of “ECE119” has two characters that have duplicates. Therefore, the number of possibilities is: \[\frac{6!}{2!2!}\]

Unordered with replacement

To rearrange \(n\) unique items, the number of possibilities is:

\[n!\]

To choose \(n\) items \(m\) times, regardless of order, the number of possibilities is:

\[{n\choose m}=\frac{n!}{(n-m)!m!}={n\choose(n-m),m}\]

Clearly \({n\choose m}=0\) if \(m>n\) or \(m<0\).

To choose \(k\) out of \(n\) items one time, multichoose can be used:

\[\left({n\choose k}\right)={n+k-1\choose k}={n-1+k\choose n-1,k}\]

Binomial coefficients

A slack variable is used to change inequalities into equalities.

!!! example If solving \(x+y\leq 7\), setting \(z=7-(x+y)\) to make everything the same domain (\(\mathbb Z^+_0\)) to use choose.

Pascals identity defines the choose operator recursively.

\[{n\choose m}={n-1\choose m-1}+{n-1\choose m}\]

The binomial theorem expands a binomial.

\[\forall a,b\in\mathbb R,(a+b)^n=\sum^n_{i=0}{n\choose i}a^{n-i}b^i\]

The sum of choosing integers is its power to 2. Therefore, a finite set with dimension \(n\) must have exactly \(2^n\) possible subsets.

\[\forall n\in\mathbb Z^+_0,\sum^n_{k=0}{n\choose k}=2^n\]

Inclusion-exclusion

The inclusion-exclusion principle removes duplicate counting.

\[|A\cup B|=|A|+|B|-|A\cap B|\]

This can be extended to 3+ sets, proven by a bijection to \(\mathbb N_{|A| + |B|+|A\cap B|}\):

\[|A\cup B\cup C|=|A| + |B| + |C| - (|A\cap B| + |A\cap C| + |B\cap C|)-|A\cap B\cap C|\]

If \(B\) is a subset of \(A\), the dimension of \(B\) is related to that of \(A\).

\[B\subseteq A\implies|B|=|A|-|\overline B|\]

Probability

!!! definition - An experiment is an event that has a number of outcomes. - Elementary events are the outcomes of an experiment compose the set of all events. - An event \(E\) is a subset of the sample space \(S\), which is the certain event. - The null event is the empty set. - Sets of events are mutually exclusive if they are disjoint. - Elementary events are equiprobable if they are equally probable. - A uniform probability distribution on \(S\) is such that all elementary events are equiprobable.

A probability distribution function (PDF) \(Pr\) converts the elements of the powerset of all outcomes to a real number — its probability.

\[Pr:\mathcal P(S)\to\mathbb R,0\leq P(A)\leq 1\]

A PDF must have, if \(S\) is the sample space:

  • \(\forall A\subseteq S,Pr\{A\}\geq 0\)
  • \(Pr\{S\}=1\)
  • The union of all mutually exclusive sets is the sample space

A discrete probability distribution is such that the sample space is a countable set.

For all \(A\subseteq S\), the probability of event \(A\) is the sum of the probabilities of all elementary events in \(A\).

  • \(Pr\{A\}=\sum_{e\in A}Pr\{\{e\}\}\)
  • \(Pr\{\empty\}=0\)
  • \(Pr\{A'\}=1-Pr\{A\}\)

Adding events together can never decrease their probability, and the sum of all probabilities must equal \(1\) such that \(\text{rang}(Pr)\subseteq[0,1]\).

\[A\subseteq B\subseteq S\implies Pr\{A\}\leq Pr\{B\}\]

The inclusion-exclusion principle also applies.

\[Pr\{A\cup B\}=Pr\{A\}+Pr\{B\}-Pr\{A\cup B\}\]

Named PDFs

!!! definition - An emperical PDF is collected from empirical data.

A Bernouilli trial is an event with exactly two options, pass \(P\) with probability \(p\), or fail \(F\) with probability \(q=1-p\). For the event \(X\):

\[ Pr\{X\}=\begin{cases} p &\text{if }X=\{P\} \\ 1-p&\text{if }X=\{F\} \end{cases} \]

For exactly two options for \(x\) (1 or 0):

\[Pr\{X=x\}=p^x(1-p)^{1-x}\]

Please see SL Math - Analysis and Approaches 2#Binomial distribution for more information.

A random variable is a function that assigns a real number to every item in the sample space. A discrete random variable is used if the sample space is discrete. The probability of all events that lead to a possible discrete random variable \(x\in\mathbb R\), where \(X\) is the function to transform those variables:

\[Pr\{X^{-1}(\{x\})\}\]

Thus the binomial distribution for \(r\) successes of \(n\) total tries, if they are independent, is:

\[Pr\{X=r\}{n\choose r}p^rq^{n-r}\]

Independence

Please see SL Math - Analysis and Approaches 2#Conditional probability for more information.

Two events are independent if they can be treated separately.

\[\text{independent}\iff Pr\{A\cap B\}=Pr\{A\}Pr\{B\}\]

Or, via the inclusion-exclusion theorem:

\[\text{independent}\iff Pr\{A\cup B\}=Pr\{A\}+Pr\{B\}-Pr\{A\}Pr\{B\}\]

Bayes theorem provides a general formula for conditional probability:

\[Pr\{A|B\}=\frac{Pr\{B|A\}}{Pr\{B\}}\]

Formally, this can be solved without \(Pr\{B\}\):

\[Pr\{A|B\}=\frac{Pr\{A\}Pr\{B|A\}}{Pr\{A\}Pr\{B|A\}+Pr\{\overline A\}Pr\{B|\overline A\}}\]

Expected value

The expected value, mean, or expectation of \(X\) is:

\[E[X]=\sum_{x\in\mathbb R}x\cdot Pr\{X=x\}=\sum_{s\in S}X(s)\cdot Pr\{\{s\}\}\]

This operation is linear, but multiplies using AND:

\[ E[X+Y]=E[X}+E[Y] \\ E[XY]=\sum_{x\in X,y\in Y}xy\cdotPr\{X=x\wedge y\=y\} \]

Thus if \(X\) and \(Y\) are independent:

\[E[XY]=E[X]E[Y]\]

An indicator random variable only has two possible outcomes: zero or one. Thus an indicator random variable \(X\) has an expected value equal to its probability:

\[E[X]=Pr\{X=1\}\]

The covariance of \(X\) and \(Y\) represents the direction of difference of \(X\) and \(Y\) from their means.

\[Cov[X,Y]=E[XY]-E[X]E[Y]\]