Discrete Mathematics Formula Sheet

Counting principles, permutations and combinations, binomial coefficients, Euclidean GCD, and modular inverses used in CS theory and cryptography.

Core Equations & Variable Definitions

Permutations & Combinations

P(n, r) = \frac{n!}{(n - r)!}, \quad \binom{n}{r} = \frac{n!}{r!(n - r)!}

Permutations count ordered arrangements; combinations ignore order.

Binomial Theorem

(a + b)^n = \sum_{k=0}^{n} \binom{n}{k} a^{n-k} b^k

Coefficients match row n of Pascals triangle.

Bezouts Identity & Modular Inverse

ax + by = \gcd(a, b), \quad a \cdot a^{-1} \equiv 1 \pmod m

Modular inverse exists if and only if gcd(a, m) = 1.

Eulers Totient & Fermats Little Theorem

a^{p-1} \equiv 1 \pmod p \quad (\text{prime } p \nmid a)

Used for fast modular exponentiation and RSA key computation.

Interactive Discrete Mathematics Calculators

Common Exam Questions

When does a modular multiplicative inverse exist?

The inverse of a modulo m exists if and only if a and m are coprime, meaning gcd(a, m) = 1. You compute it with the Extended Euclidean Algorithm.

What is the difference between P(n, r) and C(n, r)?

Use permutations P(n, r) when sequence order matters (like rankings or passwords), and combinations C(n, r) when selecting an unordered subset (like committees).

How do you compute a^b mod m without integer overflow?

Use binary exponentiation (repeated squaring), reducing modulo m after every multiplication so intermediate values stay smaller than m^2.