Class: CSE 16 Subject: computer-science discrete-math Date: 2024-10-14 Teacher: Prof. Musacchio
Counting
Factorial
- If is a non-negative integer, then is the number of lists of length n that can be made from n symbols, without repetition. Thus = 1 and = 1. If , then = n(n − 1)(n − 2) · · · 3 · 2 · 1.
Permutation
- a permutation of a set is an arrangement of all of the set’s elements in a row, that is, a list without repetition that uses every element of the set. For example, the permutations of the set = {1, 2, 3} are the six lists:
- 123, 132, 213, 231, 312, 321.
- a function in python is defined by jsvaskvn
k-permutation
- Assume a set called :
- a k-permutation is a non-repetitive list made from k elements of X .
General Formula
- if
- n is the set and k is how many we’re choosing
Other Formula
- if
Example
- You deal five cards off of a standard 52-card deck, and line them up in a row. How many such lineups are there that either consist of all red cards, or all clubs? Solution:
- There are 26 red cards. The number of ways to line up five of them is = 26 · 25 · 24 · 23 · 22 = 7, 893, 600.
- There are 13 club cards (which are black). The number of ways to line up five of them is = 13 · 12 · 11 · 10 · 9 = 154, 440.
- By the addition principle, the answer to our question is that there are + = 8, 048, 040 lineups that are either all red cards, or all club cards.