Math Flashcards

(24 cards)

1
Q

What is the formula for permutations (ordered selection of k from n)?

A

P(n, k) = n! / (n-k)! — order matters.

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

What is the formula for combinations (unordered selection of k from n)?

A

C(n, k) = n! / (k! × (n-k)!) — order doesn’t matter. Also written as “n choose k”.

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

What is the difference between a permutation and a combination?

A

Permutation: order matters (arrangements). Combination: order doesn’t matter (selections).

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

What is the pigeonhole principle?

A

If n items are placed into m containers and n > m, at least one container must hold more than one item.

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

What is Pascal’s triangle relationship to combinations?

A

Each entry equals C(n, k). Each entry = sum of the two above: C(n, k) = C(n-1, k-1) + C(n-1, k).

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

How many ways can you arrange n distinct objects?

A

n! (n factorial) — the number of permutations of n items.

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

What is counting with repetition? (combinations)

A

Choosing k items from n with repetition allowed (order doesn’t matter): C(n+k-1, k).

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

What is conditional probability P(A|B)?

A

P(A|B) = P(A ∩ B) / P(B) — probability of A given that B occurred.

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

What is expected value?

A

E[X] = Σ x · P(X = x) — the probability-weighted average of all possible outcomes.

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

What is modular arithmetic?

A

Arithmetic where numbers wrap around at a modulus m: a mod m is the remainder of a ÷ m. Example: 7 mod 3 = 1.

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

How does the Euclidean algorithm compute GCD?

A

Recursive: gcd(a, b) = gcd(b, a mod b), base case: gcd(a, 0) = a.

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

What is LCM in terms of GCD?

A

LCM(a, b) = (a × b) / GCD(a, b).

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

What are the key powers of 2 to memorize?

A

2^10 = 1,024 (~1K) · 2^20 ≈ 1M · 2^30 ≈ 1B · 2^32 ≈ 4B

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

What does XOR do at the bit level?

A

Returns 1 if bits differ, 0 if same. Key properties: a XOR a = 0, a XOR 0 = a, commutative and associative.

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

How do you check if a number is a power of 2 using bit manipulation?

A

n > 0 && (n & (n - 1)) == 0 — powers of 2 have exactly one bit set, so subtracting 1 clears it and all lower bits become 1.

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

How do you isolate the lowest set bit of an integer n?

A

n & (-n) — two’s complement makes -n flip all bits and add 1, so the AND isolates the lowest set bit.

17
Q

What is a left bit shift (<<) equivalent to?

A

Multiplying by 2 per shift: n << k = n × 2^k (for non-negative n with no overflow).

18
Q

What is a right bit shift (>>) equivalent to?

A

Dividing by 2 per shift (integer division): n >> k = ⌊n / 2^k⌋.

19
Q

What is mathematical induction?

A

Base case: prove for n=0 (or n=1). Inductive step: assume true for n, prove for n+1. Concludes the statement holds for all n ≥ base.

20
Q

What is proof by contradiction?

A

Assume the negation of what you want to prove; derive a logical contradiction; conclude the original statement must be true.

21
Q

What is proof by contrapositive?

A

Instead of proving P → Q, prove the equivalent ¬Q → ¬P — sometimes easier.

22
Q

What is a primality test for a number n?

A

Check divisibility by all integers from 2 to √n. If none divide n evenly, n is prime. O(√n).

23
Q

What is log₂(n) approximately equal to for powers of 2?

A

log₂(1024) = 10, log₂(1M) ≈ 20, log₂(1B) ≈ 30 — log₂ = number of bits needed to represent n.

24
Q

What is the relationship between log base 2 and log base 10?

A

log₂(n) = log₁₀(n) / log₁₀(2) ≈ log₁₀(n) × 3.32.