Skip to content

Latest commit

 

History

History
36 lines (34 loc) · 4.45 KB

Discretemath.md

File metadata and controls

36 lines (34 loc) · 4.45 KB

Discrete Mathematics Cheat Sheet

Topic Formula/Command Example
Set Theory
Union of Sets union(A, B) A = {1, 2, 3}; B = {3, 4, 5};
Intersection of Sets intersect(A, B) A = {1, 2, 3}; B = {3, 4, 5};
Complement of a Set complement(A, U) A = {1, 2, 3}; U = {1, 2, 3, 4, 5};
Cartesian Product cartesian(A, B) A = {1, 2}; B = {'x', 'y'};
Combinatorics
Factorial factorial(n) n = 5;
Permutations nchoosek(n, k) n = 5; k = 3;
Combinations npermutek(n, k) n = 5; k = 2;
Probability
Probability of an Event P(event) = (number of favorable outcomes) / (total number of outcomes) favorable = 3; total = 6; P = favorable / total;
Expected Value (Discrete Random Variable) E(X) = Σ(x * P(X=x)) X = [1, 2, 3]; P = [0.2, 0.3, 0.5];
Graph Theory
Degree of a Vertex degree(vertex) vertex = 3;
Adjacency Matrix adjacency_matrix(graph) graph = [0, 1, 0; 1, 0, 1; 0, 1, 0];
Shortest Path (Dijkstra's Algorithm) Implement as needed
Number Theory
Greatest Common Divisor (GCD) gcd(a, b) a = 12; b = 18;
Least Common Multiple (LCM) lcm(a, b) a = 12; b = 18;
Prime Check Implement as needed n = 17;
Logic
Logical AND and(A, B) A = true; B = false;
Logical OR or(A, B) A = true; B = false;
Logical NOT not(A) A = true;
Proof Techniques
Proof by Contradiction Implement as needed
Mathematical Induction Implement as needed
Algorithms
Euclidean Algorithm (GCD) Implement as needed
Binary Search Implement as needed

Please note that for certain mathematical operations and proof techniques, MATLAB provides built-in functions and commands to use directly. For algorithms, you may need to implement them based on your specific requirements.