Discrete Math Flashcards

1
Q

Geometric Sequence

A
  • a sequence of numbers where each number (after the first) is found by multiplying the previous number by some fixed value (common ratio)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

nth term

Geometric Sequence

A
  • Defines the nth term in a geometric sequence
  • In general, use formala starting at 1

Starting at 0

ar<span>n</span>

Starting at 1

arn-1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Geometric Series

A
  • Sum of the first n terms
  • In general, use formala starting at 1

Starting at 0

a(1 - rn+1)

(1 - r)

Starting at 1

a(1 - rn)

(1 - r)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Prime Number

A

A natural numbers that is:

  1. Greater than 1
  2. Only divisible by itself and 1
  • cannot be negative
  • must have exactly two factors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Composite Number

A
  • a natural, non-prime number
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Trial Division

A
  • Used to find factors of a number N

Steps

  1. Create an output list
  2. Loop from 1 - √N (inclusive)
  3. Check if N%i == 0
  4. If so, add i, and its cofactor to output list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

cofactor

A
  • factors always exist in pairs
  • given factor a, the cofactor is the other factor b s.t. a*b=c
  • cofactor may be same as factor (62 == 36)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Sieve of Eratosthenes

A
  • Ancient algorithm for finding all prmes less than some number

Steps

  • Create a boolean array from 0 to N
  • Set all entries to True (mark every number as prime)
  • Set 0, 1 to false (they aren’t prime)
  • Start looping from 2 to root N
  • Find all multiples of i (starting at i^2), mark as false (they are composite)
  • Use indices to get primality of a number

Complexity

Time

O( n log log n)

Space

O(n)

*Time complexity is based on fancy math

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Prime Factorization

A
  • Writing the factors of a number with only primes
  • Only one possible prime factorization of a number
  • Often written with exponents

Steps

  1. Start looping from 2 to √N
  2. At each i, while n%i ==0
  3. Divide n by i
  4. Increase count (number of i’s in n)
  5. Return to outer loop
  6. If N != 1 after loop, N must be a prime number
  7. Add N (frequency 1) to the output
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

GCD

Euclidean Algorithm

A
  • gcd is the largest number that evenly divides two numbers
  • euclidean algorithm fast technique for finding gcd of a numbers a and b
  • usually implemented recursively
  • generally assume (or position) a > b
  • note: if two numbers (a, b) share a factor, then their difference (a-b) also shares a factor
  • ergo, if two numbers (a, b) share a factor, then their remainder (a%b) also shares a factor

Steps

  1. Assuming a > b
  2. If b == 0, return a
  3. Otherwise, return gcd(b, a%b)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

cardinality

[set theory]

A
  • The cardinality of a set is the number of elements in a set
  • Syntax is the same as for absolute value

Syntax:

If set A has 5 elements, then:

|A| = cardinality of A = 5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

intersection

(set theory)

A
  • A ∩ B are the elements in both A and B
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

union

[set theory]

A
  • A ∪ B is the elements in X or Y
  • Combination of the two sets
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

symmetric difference

[set theory]

A
  • A ∆ B are the elements that A and B don’t share
  • Everything other than the overlap in a venn diagram
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

complement

[set theory]

A
  • all the things that are not in A

2 definitions

  1. relative complement (difference)
  2. absolute complement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

relative complement

[set theory]

A
  • A\B is the relative complement of B in A
  • everything in A with B taken out
  • also written as A - B, the difference of sets A and B
17
Q

absolute complement

[set theory]

A
  • A’ is everything in the universe that isn’t in A
18
Q

induction

A
  • mathentical proof technique used to show that something is true for all positive integer numbers greater than or equal to some integer N

3 steps

  1. Base Case
    • Prove the statement for the first term
  2. Construct Inductive Hypothesis
    • Assume something is true for every case n <= k
  3. Prove k+1 holds
    • If the first step is true, and an arbtrary step is true, then the entire statement must be true
19
Q

irrational number

A
  • a number that cannot be expressed by a ratio of two integers
  • decimal never repeats
  • ex: pi
20
Q

Subtraction/Division

A

Given (x-a)

  • how many a’s are in x
  • x/a is the number of times you can subtract a from x and keep x positive (while x >= 0)