S is the appropriate support of an rv
1_{p(X)} = \begin{cases} 1 & \text{if } p(X) = \text{true} \\ 0 & \text{otherwise} \\ \end{cases}
E(1_{p(X)}) = P[p(x) = \text{true}]
For a, b \in \mathbb Z and wlog assume b \ne 0. d = gcd(a, b) is the greatest common divisor of a and b iff for any c \in \mathbb Z that divides both a and b it also divides d.
In other words, gcd(a, b) = \max\{k \in \mathbb Z : k \mid a \land k \mid b\}
Properties (a, b, c \ne 0)
int gcd(int m, int n) {
if (n == 0) return m;
return gcd(n, m % n);
}
a \in \mathbb Z is congruent to b \in \mathbb Z modulo n \in \mathbb N_+ when a \equiv b \pmod n \implies \exists_{k \in \mathbb Z} a = b + k \cdot n
Linear congruence: given a, b, n \in \mathbb Z, a \cdot x \equiv b \pmod n. There isn’t always a solution:
a^{-1} \bmod n is an integer called the multiplicative inverse of a modulo n. It is defined as a \cdot a^{-1} \equiv 1 \pmod n.
For two integers a and b it computes gcd(a, b) and integers u and v such that a \cdot u + b \cdot v = gcd(a, b)
A group is a set G together with a mapping \odot: G \times G \to G such that
Example: (\mathbb Z, +), (\mathbb Q \setminus\{0\}, \times)
Order of a group is |G|.
Order of an element a \in G in a finite group is the smallest positive integer d such that a^d = 1. In other words, ord(a) = \min\{d : a^d = 1 \land d \ge 1\}.
If H is a subgroup of Z and H \ne \{0\} then H = nZ = \{\cdots, -2n, -n, 0, n, 2n, \cdots\} where n is the smallest positive element of H. a^i = 1 \iff n \text{ divides } i.
\{i \in \Z : \forall_{a \in G} a^i = 1\} = \lambda \Z. \lambda is the group exponent. (\forall_{a \in G} a^i = 1) \iff (\lambda \text{ divides } i). \forall_{a \in G} ord(a) | \lambda \land \lambda | |G|.
The group exponent is the least common multiple (lcm) of all ord(x).
A group where \odot is commutative, \forall_{a, b \in G} a \odot b = b \odot a
Let G be a finite group. Then \forall_{g \in G} ord(g) \mid |G|.
This implies g^{|G|} = 1 and g^n = g^{n \bmod |G|} for n \in \mathbb Z.
If there exists an element g in a finite group G such that for all h \in G we can write h = g^i for some i \in \mathbb Z then we call G a cyclic group and g a generator of G. Then ord(g) = |G|. All cyclic groups are Abelian.
If |G| is prime then all elements except the neutral element are generators.
For g \in G, \langle g \rangle = \{\cdots, g^{-2}, g^{-1}, g^{0}, g^{1}, g^{2}, \cdots\} spans a subgroup
i \mapsto g^i is a group isomorphism between Z_n and \langle g \rangle.
Given an abelian group G and a subgroup H the set of equivalence classes of G / H for the relation of congruence modulo H is a quotient group.
If group G has prime order then all elements except 1 are generators.
A ring is an Abelian group (R, +) together with a second mapping \cdot: R \times R \to R such that \cdot is a closure, associative, has a neutral element and is distributive.
A commutative ring is a ring where \cdot is commutative. For instance, (\mathbb Z, +, \times) is a commutative ring.
Given a commutative ring (R, +, \cdot) we call I \subseteq R and ideal of R if I itself is a ring with respect to the original operations and if additionally a \cdot i \in I for every a \in R and i \in I.
For a ring R we denote R^* the set of elements having a multiplicative inverse. Those elements are called units. R^* is a group with multiplication.
A field is a commutative ring (K, +, \times) such that
Example: (\mathbb R, +, \times)
Given two groups (G, \odot) and (H, \boxdot), f: G \to H is a group homomorphism if for all g, g' \in G we have f(g \odot g') = f(g) \boxdot f(g'). If f is also a bijection then f is a group isomorphism. \forall_{a \in G_1} f(a) \text{ neutral in } G_2 \implies a \text{ neutral in } G_1 \iff f \text{ is injective}.
For a prime p and an a \in \mathbb Z such that gcd(a, p) = 1 we have a^{p-1} \equiv 1 \pmod p
For n \in \mathbb N_+ and an a \in \mathbb Z such that gcd(a, n) = 1 we have a^{\varphi(n)} \equiv 1 \pmod n
Where \varphi(n) returns the amount of coprimes to n smaller than n.
\varphi(n) = \begin{cases} p^{\alpha - 1}(p - 1) & \text{ if } n = p^\alpha \text{ with p prime and }\alpha \ge 1 \\ \prod_{i = 1}^r \varphi(p_i^{\alpha_i}) & \text{ for } n = \prod_{i = 1}^r p_i^{\alpha_i} \text{ with } p_1, \cdots, p_r \text{ pairwise different primes} \\ \end{cases}