Mathematics for Computer Science 201-N11 • CEGEP, Montreal

Corrected exercises: counting and probability (201-N11)

This is the corrected exercise set on counting and probability for Mathematics for Computer Science, 201-N11, the mathematics course taken by CEGEP students in computer science programs: counting configurations, choosing the right selection formula, and reasoning about conditional probabilities. This is the chapter you need as soon as you have to size a key space or analyze an algorithm.

Exercise 0.1 opens the set with ten counting problems to compute directly, as in textbook drill lists: a quotient of factorials, a permutation P(9,4)P(9,4), combinations such as (124)\binom{12}{4} and (2017)\binom{20}{17} by symmetry, strings with replacement, combinations with repetition, the anagrams of a word with repeated letters, the sum of a row of Pascal's triangle, a coefficient from the binomial theorem and an “at least” counted through the complement. Every line has its exact value to find, checked as you type it.

The thread of the set fits in one sentence: you never count by listing, you count by MULTIPLYING choices, and a probability on an equally likely sample space is just a quotient of two counts. The classic errors, confusing permutations with combinations or a conditional probability with its converse, are all counting mistakes.

Part A builds the tools, from the multiplication principle to the pigeonhole principle. Part B applies them where they really decide something: a screening test, a spam filter, the average-case analysis of a sort, the strength of a password and the size of a cryptographic hash. Every solution is on the page.

11 corrected exercises • 110 points • 150 minutes

This chapter is part of 201-N11, every chapter with its set and sheet Before you start Revision sheet: the traps and the method for this chapter

Self-checking set Type your answers and check them question by question: the page tells you right or wrong before you open the solution. With an account, every answer right on the first try earns points, and your right answers stay filled in when you come back.

Course recap

  • • MULTIPLICATION PRINCIPLE: kk steps offering n1,…,nkn_{1},\dots,n_{k} choices give n1×⋯×nkn_{1}\times\dots\times n_{k} outcomes, provided that the NUMBER of choices at each step does not depend on the previous ones.
  • • THE FOUR SELECTION MODELS for kk objects out of nn: ordered without replacement, n!(n−k)!\frac{n!}{(n-k)!}; ordered with replacement, nkn^{k}; unordered without replacement, (nk)=n!k!(n−k)!\binom{n}{k}=\frac{n!}{k!(n-k)!}; unordered with replacement, (n+k−1k)\binom{n+k-1}{k}. Test: if two results differ only in their order, are they the same result?
  • • PASCAL: (nk)=(n−1k−1)+(n−1k)\binom{n}{k}=\binom{n-1}{k-1}+\binom{n-1}{k}, and ∑k=0n(nk)=2n\sum_{k=0}^{n}\binom{n}{k}=2^{n}, which is the number of subsets of a set with nn elements.
  • • PIGEONHOLE PRINCIPLE: mm objects in nn pigeonholes put at least ⌈mn⌉\left\lceil\frac{m}{n}\right\rceil objects in the same pigeonhole. It is an EXISTENCE statement: it does not say which one, nor how many times.
  • • UNIFORM PROBABILITY: P(A)=favourable outcomespossible outcomesP(A)=\frac{\text{favourable outcomes}}{\text{possible outcomes}}, valid only if the elementary outcomes are equally likely. For an event of the form “at least one”, go through the COMPLEMENT.
  • • CONDITIONAL PROBABILITY AND BAYES: P(A∣B)=P(A∩B)P(B)P(A\mid B)=\frac{P(A\cap B)}{P(B)}, and the law of total probability P(A)=∑iP(A∣Bi)P(Bi)P(A)=\sum_{i}P(A\mid B_{i})P(B_{i}). Never confuse P(A∣B)P(A\mid B) with P(B∣A)P(B\mid A): on a screening test, the gap runs from 99 to 17 percent.
  • • INDEPENDENCE: P(A∩B)=P(A)P(B)P(A\cap B)=P(A)P(B). Two events of nonzero probability cannot be both independent and mutually exclusive.
  • • EXPECTED VALUE: E(X)=∑ixipiE(X)=\sum_{i}x_{i}p_{i}. Linear search: n+12\frac{n+1}{2} comparisons on average. Waiting for a success of probability pp: 1p\frac{1}{p} trials.
  • • BIRTHDAYS: the 50 percent collision threshold among NN values is reached at about 1.18N1.18\sqrt{N} draws. Consequence: the collision resistance of an nn-bit hash is only 2n/22^{n/2}.

Calculations: the counting problems to compute

Exercise 0.1: Counting with the four formulas: ten direct calculations

For each line, compute the number asked for, as an exact value. The lines without a sentence are expressions to evaluate; the others name the selection model or the object to count.

One method only: SIMPLIFY before multiplying. A quotient of factorials reduces by cancelling the smaller one, n!(n−k)!=n(n−1)⋯(n−k+1)\frac{n!}{(n-k)!}=n(n-1)\cdots(n-k+1); a binomial coefficient is computed by (nk)=n(n−1)⋯(n−k+1)k!\binom{n}{k}=\frac{n(n-1)\cdots(n-k+1)}{k!} with the smaller of the two possible values of kk, since (nk)=(nn−k)\binom{n}{k}=\binom{n}{n-k}; a sum of binomial coefficients is read off Pascal's triangle; and an “at least” is counted through the complement.

  • a) 11!8!\frac{11!}{8!}.
  • b) The number of permutations P(9,4)P(9,4), that is, of ordered lists of 44 distinct elements chosen from 99.
  • c) (124)\binom{12}{4}, by the formula.
  • d) (2017)\binom{20}{17}.
  • e) The number of strings of 55 symbols taken from an alphabet of 66, repetitions allowed.
  • f) The number of ways to choose 33 items from 55 types, unordered and with repetition.
  • g) The number of anagrams of the word COCORICO.
  • h) (101)+(102)+⋯+(1010)\binom{10}{1}+\binom{10}{2}+\dots+\binom{10}{10}.
  • i) The coefficient of x4x^{4} in the expansion of (2x−1)7(2x-1)^{7}.
  • j) The number of subsets with at least 22 elements of a set with 88 elements.

Type your answers, the page tells you right or wrong 0/10

a)
b)
c)
d)
e)
f)
g)
h)
i)
j)
Show the solution

Answers

  • a) 11×10×911\times 10\times 9; 990990
  • b) 9×8×7×69\times 8\times 7\times 6; 3,0243{,}024
  • c) 12×11×10×924\frac{12\times 11\times 10\times 9}{24}; 495495
  • d) (203)\binom{20}{3}; 1,1401{,}140
  • e) 656^{5}; 7,7767{,}776
  • f) (73)\binom{7}{3}; 3535
  • g) 8!3! 3!\frac{8!}{3!\,3!}; 1,1201{,}120
  • h) 210−12^{10}-1; 1,0231{,}023
  • i) (74)×24×(−1)3\binom{7}{4}\times 2^{4}\times(-1)^{3}; −560-560
  • j) 28−1−82^{8}-1-8; 247247

The move that decides everything: never compute a whole factorial when it simplifies. 20!20! has nineteen digits, whereas (2017)\binom{20}{17} comes down to three factors divided by 3!3!. The second move is to choose the model with two questions: does the order matter, and can we repeat?

a)

11!8!=11×10×9×8!8!=11×10×9=990\frac{11!}{8!}=\frac{11\times 10\times 9\times 8!}{8!}=11\times 10\times 9=990. Pitfall: simplifying the numbers themselves, as if 11!8!\frac{11!}{8!} were equal to (118)!\left(\frac{11}{8}\right)!, which makes no sense.

b)

P(9,4)=9!(9−4)!=9!5!=9×8×7×6=3,024P(9,4)=\frac{9!}{(9-4)!}=\frac{9!}{5!}=9\times 8\times 7\times 6=3{,}024: four decreasing factors starting from 99.

c)

(124)=12×11×10×94×3×2×1\binom{12}{4}=\frac{12\times 11\times 10\times 9}{4\times 3\times 2\times 1}. Simplify before multiplying: 124×3=1\frac{12}{4\times 3}=1 and 102=5\frac{10}{2}=5, hence 11×5×9=49511\times 5\times 9=495.

d)

By symmetry, (2017)=(203)=20×19×183×2×1=20×19×3=1,140\binom{20}{17}=\binom{20}{3}=\frac{20\times 19\times 18}{3\times 2\times 1}=20\times 19\times 3=1{,}140. Pitfall: applying the formula with k=17k=17, seventeen factors in the numerator and in the denominator, for the same result at the price of many possible errors.

e)

Ordered with replacement: each of the 55 positions has 66 choices, so 65=7,7766^{5}=7{,}776. Pitfall: taking 56=15,6255^{6}=15{,}625, by swapping the number of positions and the number of choices.

f)

Unordered with replacement: (n+k−1k)=(5+3−13)=(73)=7×6×56=35\binom{n+k-1}{k}=\binom{5+3-1}{3}=\binom{7}{3}=\frac{7\times 6\times 5}{6}=35. Pitfall: (53)=10\binom{5}{3}=10, which forbids repetition.

g)

COCORICO has 88 letters: C three times, O three times, R and I once each. 8!3! 3!=40,32036=1,120\frac{8!}{3!\,3!}=\frac{40{,}320}{36}=1{,}120. Pitfall: 8!=40,3208!=40{,}320, which counts as different the words obtained by swapping two C's or two O's.

h)

The complete row is worth ∑k=010(10k)=210=1,024\sum_{k=0}^{10}\binom{10}{k}=2^{10}=1{,}024; the term (100)=1\binom{10}{0}=1 is missing here, so the sum is 1,0231{,}023. Pitfall: answering 1,0241{,}024 without noticing that the sum starts at k=1k=1.

i)

Binomial theorem: the term in x4x^{4} is (74)(2x)4(−1)3=35×16x4×(−1)=−560x4\binom{7}{4}(2x)^{4}(-1)^{3}=35\times 16x^{4}\times(-1)=-560x^{4}. The coefficient is −560-560. Pitfall: forgetting the power of 22, which gives −35-35, or the sign of (−1)3(-1)^{3}, which gives 560560.

j)

Through the complement: a set with 88 elements has 28=2562^{8}=256 subsets; remove the empty set, (80)=1\binom{8}{0}=1, and the eight singletons, (81)=8\binom{8}{1}=8. That leaves 256−1−8=247256-1-8=247. Pitfall: removing only the singletons, which gives 248248.

Check: a binomial coefficient is always an integer, so a division that does not come out even signals a mistake; symmetry is checked on one case, (203)=(2017)\binom{20}{3}=\binom{20}{17}; and in i), the sum of the coefficients of (2x−1)7(2x-1)^{7} is (2−1)7=1(2-1)^{7}=1, which checks a full expansion.

Tick the exercises you have done or want to review: a free account, no password, keeps your ticks and your right answers from one visit to the next, tells you which chapter to tackle next and lets you ask for the exercise you are missing. Create your space, an email is enough.

Part A: the basics (/50)

Exercise 1: The multiplication principle: counting without listing

Counting the possibilities of a computer system is an everyday calculation: how many addresses, how many colours, how many passwords. The thread of the set: you never count by listing, you count by MULTIPLYING independent choices.

startS₁M₁D₁D₂M₂D₁D₂S₂M₁D₁D₂M₂D₁D₂S₃M₁D₁D₂M₂D₁D₂startersmainsdesserts
  • a) State the multiplication principle and read it off the tree in the figure.
  • b) How many 4-letter words can be formed with the 26-letter Latin alphabet, repetitions allowed?
  • c) How many IPv4 addresses are there, given that they have 32 bits? And IPv6 addresses, which have 128?
  • d) A true colour is coded on 24 bits, 8 per component. How many shades is that?
  • e) An identifier consists of 2 capital letters followed by 4 digits. How many are there? And if the two letters must be distinct?

Type your answers, the page tells you right or wrong 0/11

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) The product of the numbers of choices: 3×2×2=123 \times 2 \times 2 = 12 leaves
  • b) 264=456,97626^{4} = 456{,}976
  • c) 232=4,294,967,2962^{32} = 4{,}294{,}967{,}296 and 2128≈3.4×10382^{128} \approx 3.4 \times 10^{38}
  • d) 224=2563=16,777,2162^{24} = 256^{3} = 16{,}777{,}216 shades
  • e) 6,760,0006{,}760{,}000 with no constraint, 6,500,0006{,}500{,}000 with two distinct letters: 260,000260{,}000 fewer, or 3.8%3.8\%
a)

If an operation breaks down into kk successive steps offering n1,n2,…,nkn_{1},n_{2},\dots,n_{k} choices respectively, and if the number of choices at each step does not depend on the previous choices, then the total number of outcomes is the PRODUCT n1×n2×⋯×nkn_{1}\times n_{2}\times\dots\times n_{k}. On the figure, three starters each lead to two mains, and each of these six paths leads to two desserts: you read 3×2×2=123\times 2\times 2=12 leaves. The tree makes the condition for applying the principle visible: every node of a given level carries the same number of branches.

b)

Four positions, 26 choices each, independent: 264=456,97626^{4}=456{,}976 words. The result is written with thousands separators because the order of magnitude is the useful information: half a million, which a program lists in a fraction of a second.

c)

IPv4: 232=4,294,967,2962^{32}=4{,}294{,}967{,}296, about 4.3 billion, fewer than the world's population, which explains the exhaustion of the supply. IPv6: 2128≈3.4×10382^{128}\approx 3.4\times 10^{38}, a number of a different order altogether, around 102810^{28} addresses per person. Quadrupling the number of bits does not quadruple the number of addresses, it raises it to the fourth power: this is the point that the multiplication principle makes obvious.

d)

224=16,777,2162^{24}=16{,}777{,}216 shades, about 16.7 million. You can also see it as 2563256^{3}, each component taking 256 values: both expressions give the same number, since 256=28256=2^{8} and (28)3=224\left(2^{8}\right)^{3}=2^{24}.

e)

With no constraint: 26×26×104=676×10,000=6,760,00026\times 26\times 10^{4}=676\times 10{,}000=6{,}760{,}000 identifiers. With two DISTINCT letters, the second choice offers only 25 possibilities: 26×25×104=6,500,00026\times 25\times 10^{4}=6{,}500{,}000. The loss is 260,000260{,}000 identifiers, about 3.8 percent. Note that the multiplication principle still applies, even though the number of choices at the second step depends on the first: what matters is that this NUMBER is always the same, here 25, whichever letter was already taken.

Exercise 2: The four selection models

Almost every counting exercise comes down to selecting kk objects out of nn. Two questions are enough to choose the formula: does the order matter, and can we repeat?

ORDEREDUNORDEREDwithout replacementwith replacementpermutationsn! / (n-k)!combinationsn! / (k!(n-k)!)listsn^kwith repetitionC(n+k-1, k)choosing k objects from n: four cases
  • a) Recall the four formulas in the table and match each one with a typical question.
  • b) In how many ways can 5 candidates be ranked with no ties?
  • c) A 3-character password is made of distinct lowercase letters. How many are there? And if repetitions are allowed?
  • d) How many distinct lottery tickets are there when choosing 6 numbers out of 49?
  • e) A build menu accepts 4 independent Boolean options. How many configurations are there? And if exactly 2 of them must be turned on?

Type your answers, the page tells you right or wrong 0/12

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) Permutations n!(n−k)!\frac{n!}{(n-k)!}, strings nkn^{k}, combinations (nk)\binom{n}{k}, and (n+k−1k)\binom{n+k-1}{k} for unordered with replacement
  • b) 5!=1205! = 120
  • c) 26×25×24=15,60026 \times 25 \times 24 = 15{,}600 without repetition, 263=17,57626^{3} = 17{,}576 with
  • d) (496)=13,983,816\binom{49}{6} = 13{,}983{,}816
  • e) 24=162^{4} = 16 configurations, of which (42)=6\binom{4}{2} = 6 have exactly two options on
a)

ORDERED WITHOUT REPLACEMENT, the permutations: n!(n−k)!\frac{n!}{(n-k)!}, for “how many podiums”. ORDERED WITH REPLACEMENT, the strings: nkn^{k}, for “how many passwords”. UNORDERED WITHOUT REPLACEMENT, the combinations: (nk)=n!k! (n−k)!\binom{n}{k}=\frac{n!}{k!\,(n-k)!}, for “how many committees”. UNORDERED WITH REPLACEMENT: (n+k−1k)\binom{n+k-1}{k}, for “how many ways to distribute identical objects”. The fourth is the only one you do not invent in your head; the other three are recovered from the multiplication principle.

b)

A complete ranking of 5 candidates is a PERMUTATION: 5!=1205!=120. It is the special case k=nk=n of the permutations, where 5!0!=5!\frac{5!}{0!}=5! since 0!=10!=1 by convention. This convention is not arbitrary: it is what makes the permutation formula valid all the way to the end.

c)

DISTINCT: this is a permutation of 3 letters out of 26, that is 26×25×24=15,60026\times 25\times 24=15{,}600. WITH REPETITIONS: this is a string, that is 263=17,57626^{3}=17{,}576. The gap is small here, 11.2 percent, but forbidding repetitions ALWAYS reduces the number of passwords: a rule that forbids two identical letters therefore weakens the password instead of strengthening it, which is the opposite of intuition.

d)

The order of the numbers does not matter and repetition is impossible: this is a combination. (496)=49×48×47×46×45×44720=13,983,816\binom{49}{6}=\frac{49\times 48\times 47\times 46\times 45\times 44}{720}=13{,}983{,}816, close to 14 million tickets. The probability of winning with one ticket is therefore about 7.15×10−87.15\times 10^{-8}.

e)

Four independent Boolean options: each is true or false, so 24=162^{4}=16 configurations. If EXACTLY 2 must be turned on, you choose which ones without caring about the order: (42)=6\binom{4}{2}=6. You can check consistency by summing over all sizes: (40)+(41)+(42)+(43)+(44)=1+4+6+4+1=16\binom{4}{0}+\binom{4}{1}+\binom{4}{2}+\binom{4}{3}+\binom{4}{4}=1+4+6+4+1=16 ✓, which is exactly the property of Pascal's triangle studied in the next exercise.

Exercise 3: Binomial coefficients and Pascal's triangle

The binomial coefficient counts subsets, and its recurrence relation is the same as that of a recursive algorithm. It is also a chance to meet dynamic programming again, from the recursion chapter.

111121133114641151010511615201561
  • a) Prove Pascal's identity (nk)=(n−1k−1)+(n−1k)\binom{n}{k}=\binom{n-1}{k-1}+\binom{n-1}{k} by a counting argument, with no computation.
  • b) Check this identity on the figure for (42)\binom{4}{2}.
  • c) Prove that the sum of a row of the triangle is 2n2^{n}, first by a counting argument and then by the binomial theorem.
  • d) Compute (103)\binom{10}{3} in two ways.
  • e) A program computes (nk)\binom{n}{k} recursively from Pascal's identity. What problem does it run into, and what is the remedy?

Type your answers, the page tells you right or wrong 0/13

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) The subsets split according to whether they contain xx or not: (n−1k−1)+(n−1k)\binom{n-1}{k-1} + \binom{n-1}{k}
  • b) (42)=6=3+3=(31)+(32)\binom{4}{2} = 6 = 3 + 3 = \binom{3}{1} + \binom{3}{2}
  • c) ∑k(nk)=2n\sum_{k}\binom{n}{k} = 2^{n}, by sorting the subsets by size or by the binomial theorem with a=b=1a=b=1
  • d) (103)=120=36+84\binom{10}{3} = 120 = 36 + 84
  • e) The calls overlap massively: memoization, or iterative construction in O(nk)O(nk)
a)

Count the kk-element subsets of an nn-element set, singling out one particular element xx. These subsets split into two categories with no overlap. Those that CONTAIN xx: you still have to choose k−1k-1 elements among the n−1n-1 others, which gives (n−1k−1)\binom{n-1}{k-1}. Those that do NOT contain it: you must choose the kk elements among the n−1n-1 others, which gives (n−1k)\binom{n-1}{k}. Every subset falls into exactly one of the two cases, hence the equality. No computation, only a split into two.

b)

On the figure, (42)=6\binom{4}{2}=6 is indeed the sum of the two numbers above it in the previous row, (31)=3\binom{3}{1}=3 and (32)=3\binom{3}{2}=3, which the two strokes mark. This is the rule for building the triangle: each number is the sum of the two above it, the edges being 1 because there is only one empty subset and only one full subset.

c)

COUNTING: the sum ∑k=0n(nk)\sum_{k=0}^{n}\binom{n}{k} counts all the subsets of the set, sorted by size; but you can also count a subset by deciding for EACH element whether it belongs to it or not, which gives 2n2^{n} by the multiplication principle. Both counts are about the same set, so they are equal. BINOMIAL THEOREM: the formula (a+b)n=∑k=0n(nk)akbn−k(a+b)^{n}=\sum_{k=0}^{n}\binom{n}{k}a^{k}b^{n-k}, applied with a=b=1a=b=1, gives directly 2n=∑k=0n(nk)2^{n}=\sum_{k=0}^{n}\binom{n}{k}. The figure displays these sums row by row: 1, 2, 4, 8, 16, 32, 64.

d)

BY THE FORMULA: (103)=10×9×83×2×1=7206=120\binom{10}{3}=\frac{10\times 9\times 8}{3\times 2\times 1}=\frac{720}{6}=120. BY PASCAL: (103)=(92)+(93)=36+84=120\binom{10}{3}=\binom{9}{2}+\binom{9}{3}=36+84=120 ✓. The first method is the one to use by hand, simplifying BEFORE multiplying; the second is useful when you build a complete table.

e)

It runs into exactly the naive Fibonacci problem: the calls OVERLAP massively, because (n−1k−1)\binom{n-1}{k-1} and (n−1k)\binom{n-1}{k} go back down to the same subproblems. The number of calls becomes of the order of (nk)\binom{n}{k} itself, hence astronomical. The remedy is the same: MEMOIZATION, or the iterative construction of the triangle row by row, which costs O(nk)O(nk) operations. This is the canonical example of dynamic programming, and it is no accident that the combinatorial relation and the algorithmic relation are the same equality.

111121133114641151010511615201561

Exercise 4: The pigeonhole principle

A statement that looks too simple to be of any use: if you put n+1n+1 objects into nn pigeonholes, some pigeonhole contains at least two. Yet it proves results that no computation reaches.

  • a) State the pigeonhole principle, then its quantitative version for mm objects in nn pigeonholes.
  • b) Show that in a group of 13 people, at least two were born in the same month.
  • c) A hash table has 100 slots and receives 1,000 keys. What can you say about the most heavily loaded slot?
  • d) Prove that no hash function sending arbitrary files to 256 bits can be injective.
  • e) Show that among 6 people, there are always 3 who all know each other or 3 who are all strangers to each other.

Type your answers, the page tells you right or wrong 0/11

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) n+1n+1 objects in nn pigeonholes force a repeat; with mm objects, some pigeonhole contains at least ⌈m/n⌉\lceil m/n \rceil
  • b) 13 people for 12 months: at least two share a month
  • c) At least ⌈1000/100⌉=10\lceil 1000/100 \rceil = 10 keys in one slot, a worst-case guarantee
  • d) Infinitely many files for 22562^{256} digests: collisions must exist, and security rests on the difficulty of finding one
  • e) ⌈5/2⌉=3\lceil 5/2 \rceil = 3 relationships of the same type, then two cases: this is the first theorem of Ramsey theory
a)

SIMPLE VERSION: if you put n+1n+1 or more objects into nn pigeonholes, at least one pigeonhole contains at least two objects. QUANTITATIVE VERSION: putting mm objects into nn pigeonholes, at least one pigeonhole contains at least ⌈mn⌉\left\lceil\frac{m}{n}\right\rceil objects. The proof is by contradiction: if every pigeonhole contained strictly fewer, the total would be strictly less than mm, a contradiction.

b)

The pigeonholes are the 12 months, the objects are the 13 people. Since 13>1213>12, at least one month contains two people ✓. Notice what the statement does NOT say: it does not say which month, nor how many pairs. It is a pure existence statement, of the same kind as the existence theorems of calculus, such as the intermediate value theorem.

c)

⌈1000100⌉=10\left\lceil\frac{1000}{100}\right\rceil=10: at least one slot contains at least 10 keys. This is a WORST-CASE guarantee, independent of the hash function used, however good it is. It explains why a hash table must provide for collision handling, chaining or probing, and why its access cost is constant only on average, never in the worst case.

d)

A 256-bit hash function has exactly 22562^{256} possible values, a finite number. The set of files, on the other hand, is infinite: you can build files as long as you like. So an infinity of objects is put into a finite number of pigeonholes, and the principle guarantees not only that a collision exists, but that infinitely many files share the same digest. The security of a hash function therefore does NOT rest on the absence of collisions, which is impossible, but on the difficulty of FINDING one.

e)

Take one person AA. They have 5 relationships, each of two types, acquaintance or stranger: by the pigeonhole principle, one of the two types appears at least ⌈52⌉=3\left\lceil\frac{5}{2}\right\rceil=3 times. Suppose AA knows three people BB, CC and DD. If two of them know each other, say BB and CC, then AA, BB and CC all know each other ✓. Otherwise, BB, CC and DD are mutual strangers ✓. The case where AA is a stranger to three people is handled symmetrically. This is the first theorem of Ramsey theory, and it rests entirely on two applications of the pigeonhole principle.

ABCDEF
AA has five relationships; at least three are of the same type, here “acquaintance” (blue) with BB, CC, DD. A single orange “acquaintance” edge closes a triangle with AA; with none, BB, CC, DD are mutual strangers.

Exercise 5: Probability on an equally likely finite sample space

As soon as all the outcomes are equally likely, a probability is nothing more than a quotient of two counts. All the work is therefore in the counting, not in the probability.

  • a) Give the formula for the probability of an event in an equally likely finite sample space, and say when it applies.
  • b) Five cards are dealt from a deck of 52. What is the probability of getting exactly 2 aces?
  • c) A generator produces a random byte. What is the probability that it contains exactly three bits equal to 1?
  • d) What is the probability that a password of 8 characters drawn at random from the 62 alphanumeric characters contains NO digit?
  • e) Why do we so often go through the COMPLEMENT? Illustrate with “at least one digit”.

Type your answers, the page tells you right or wrong 0/13

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) P(A)=favourable outcomespossible outcomesP(A) = \dfrac{\text{favourable outcomes}}{\text{possible outcomes}}, provided the ELEMENTARY outcomes are equally likely
  • b) (42)(483)(525)=103,7762,598,960≈0.0399\dfrac{\binom{4}{2}\binom{48}{3}}{\binom{52}{5}} = \dfrac{103{,}776}{2{,}598{,}960} \approx 0.0399
  • c) (83)256=56256=0.21875\dfrac{\binom{8}{3}}{256} = \dfrac{56}{256} = 0.21875
  • d) (5262)8≈0.2448\left(\dfrac{52}{62}\right)^{8} \approx 0.2448
  • e) P(at least one)=1−P(none)=0.7552P(\text{at least one}) = 1 - P(\text{none}) = 0.7552
a)

P(A)=number of favourable outcomesnumber of possible outcomesP(A)=\frac{\text{number of favourable outcomes}}{\text{number of possible outcomes}}. The condition is that all the elementary outcomes be EQUALLY LIKELY, which is not automatic and must be justified: a random draw, a fair die, a uniform generator. On a non-uniform sample space the formula is wrong, and the classic error is to apply it to compound events rather than to elementary outcomes.

b)

The sample space is the set of 5-card hands, that is (525)=2,598,960\binom{52}{5}=2{,}598{,}960 equally likely hands. The favourable hands are built in two independent steps: choose 2 aces out of 4, that is (42)=6\binom{4}{2}=6, and choose the 3 other cards among the 48 non-aces, that is (483)=17,296\binom{48}{3}=17{,}296. Total: 6×17,296=103,7766\times 17{,}296=103{,}776. Probability: 103,7762,598,960≈0.0399\frac{103{,}776}{2{,}598{,}960}\approx 0.0399, about 4 percent.

c)

A byte has 28=2562^{8}=256 equally likely values. Those containing exactly three bits equal to 1 correspond to choosing the three positions out of eight: (83)=56\binom{8}{3}=56. Probability: 56256=0.21875\frac{56}{256}=0.21875, about 22 percent. This is close to the maximum, which is reached at 4 bits equal to 1 with (84)=70\binom{8}{4}=70 values out of 256: a random byte rarely has very few or very many bits turned on.

d)

The 62 characters split into 52 letters and 10 digits. No digit means that all 8 positions are filled from the 52 letters: 52852^{8} favourable outcomes out of 62862^{8} possible. Probability: (5262)8=0.83878≈0.2448\left(\frac{52}{62}\right)^{8}=0.8387^{8}\approx 0.2448, about 24 percent. Nearly one random password in four contains no digit, which explains why security policies require one explicitly.

e)

Because counting “at least one” requires distinguishing the cases of one, two, three digits and so on, whereas the opposite, “none”, is counted in one go. The rule is P(at least one)=1−P(none)P(\text{at least one})=1-P(\text{none}). Here: 1−0.2448=0.75521-0.2448=0.7552, about 76 percent. The habit applies to every statement starting with “at least”, and it will be decisive in the birthday problem of exercise 10.

Part B: problems and reasoning (/50)

Exercise 6: Conditional probability, independence and Bayes' theorem

A positive test does not mean you are sick, and an email containing the word “free” is not necessarily spam. Bayes' theorem says exactly by how much to correct your intuition.

sickpositivenegativehealthypositivenegative0.010.990.010.990.050.95
  • a) Give the definition of P(A∣B)P(A\mid B) and the law of total probability.
  • b) A disease affects 1 percent of the population. A test detects 99 percent of the sick and is wrong on 5 percent of the healthy. Compute the probability that a person who tests positive is really sick.
  • c) Comment on the gap between this result and common intuition. Where does it come from?
  • d) A spam filter knows that 60 percent of emails are spam, that the word “free” appears in 30 percent of spam and in 2 percent of legitimate emails. Compute the probability that an email containing this word is spam.
  • e) Can two events of nonzero probability be both independent and mutually exclusive? Justify.

Type your answers, the page tells you right or wrong 0/14

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) P(A∣B)=P(A∩B)P(B)P(A\mid B) = \dfrac{P(A \cap B)}{P(B)}, and P(A)=∑iP(A∣Bi)P(Bi)P(A) = \sum_{i} P(A\mid B_{i})P(B_{i})
  • b) P(T)=0.0594P(T) = 0.0594 and P(M∣T)=0.00990.0594=16≈16.7%P(M\mid T) = \dfrac{0.0099}{0.0594} = \dfrac{1}{6} \approx 16.7\%
  • c) Out of 10,000 people: 99 true positives against 495 false positives. The rarity of the disease decides
  • d) P(G)=0.188P(G) = 0.188 and P(S∣G)≈95.7%P(S\mid G) \approx 95.7\%: the PRIOR probability changes everything
  • e) NO: mutually exclusive gives P(A∩B)=0P(A\cap B)=0, independent gives P(A)P(B)>0P(A)P(B)>0
a)

P(A∣B)=P(A∩B)P(B)P(A\mid B)=\frac{P(A\cap B)}{P(B)} for P(B)≠0P(B)\neq 0: it is the probability of AA once we KNOW that BB has occurred, in other words we replace the sample space by BB. LAW OF TOTAL PROBABILITY: if B1,…,BnB_{1},\dots,B_{n} form a partition of the sample space, then P(A)=∑iP(A∣Bi)P(Bi)P(A)=\sum_{i}P(A\mid B_{i})P(B_{i}). This is the formula that lets you go down the weighted tree of the figure by multiplying along the branches, then adding the favourable leaves.

b)

Let MM be the event “the person has the disease” and TT the event “the test is positive”. P(M)=0.01P(M)=0.01, P(T∣M)=0.99P(T\mid M)=0.99, P(T∣M‾)=0.05P(T\mid\overline{M})=0.05. Total probability: P(T)=0.01×0.99+0.99×0.05=0.0099+0.0495=0.0594P(T)=0.01\times 0.99+0.99\times 0.05=0.0099+0.0495=0.0594. Bayes: P(M∣T)=0.00990.0594=16≈0.1667P(M\mid T)=\frac{0.0099}{0.0594}=\frac{1}{6}\approx 0.1667. Only ONE positive person in six is really sick.

c)

Intuition spontaneously answers “about 99 percent”, confusing P(T∣M)P(T\mid M) with P(M∣T)P(M\mid T). The gap comes from the RARITY of the disease: out of 10,000 people, 100 are sick and 99 will be detected, but 9,900 are healthy and 495 of them will test positive wrongly. The false positives are five times more numerous than the true ones, not because the test is bad, but because it is applied to an immense population of healthy people. This is why rare diseases are not screened for systematically.

d)

Let SS be the event “spam” and GG the event “the email contains the word free”. P(G)=0.6×0.3+0.4×0.02=0.18+0.008=0.188P(G)=0.6\times 0.3+0.4\times 0.02=0.18+0.008=0.188. Bayes: P(S∣G)=0.180.188≈0.9574P(S\mid G)=\frac{0.18}{0.188}\approx 0.9574, about 96 percent. This time the result is very close to certainty, and the contrast with part b is worth noting: the same formula gives 17 percent here and 96 percent there. What changes is not the quality of the evidence, it is the PRIOR probability, 1 percent against 60 percent.

e)

NO, it is impossible. Mutually exclusive means A∩B=∅A\cap B=\varnothing, so P(A∩B)=0P(A\cap B)=0. Independent means P(A∩B)=P(A)P(B)P(A\cap B)=P(A)P(B), which is strictly positive since both probabilities are. The two conditions contradict each other. Intuitively: if AA and BB cannot happen together, then knowing that AA has occurred tells you something very strong about BB, namely that it has not. Mutually exclusive is therefore the opposite of independent, not a synonym, and this confusion is one of the costliest in the chapter.

sickpositive0.0099negativehealthypositive0.0495negative0.010.990.010.990.050.95

Exercise 7: Expected value and average-case analysis of an algorithm

The worst case of an algorithm is sometimes so rare that it says nothing about its real behaviour. Expected value gives the other measure, the one a user observes, and it is computed with the tools of this chapter.

  • a) Give the definition of the expected value of a discrete random variable and its interpretation.
  • b) You search linearly for an element known to be in an array of nn cells, at a uniformly random position. Compute the expected number of comparisons.
  • c) Apply this for n=1000n=1000. Compare with the worst case.
  • d) You flip a fair coin until you get heads. Compute the expected number of flips.
  • e) Quicksort makes about 2nln⁡n2n\ln n comparisons on average and n22\frac{n^{2}}{2} in the worst case. For one million elements, compute both and say why it is used anyway.

Type your answers, the page tells you right or wrong 0/12

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) E(X)=∑ixipiE(X) = \sum_{i} x_{i}p_{i}, the weighted average, valid over a large number of trials
  • b) E=1n⋅n(n+1)2=n+12E = \dfrac{1}{n}\cdot\dfrac{n(n+1)}{2} = \dfrac{n+1}{2}
  • c) 500.5500.5 against 1000: a ratio of only 2, linear search stays linear
  • d) E=2E = 2, confirmed by E=1+12EE = 1 + \frac{1}{2}E
  • e) About 28 million on average against 500 billion in the worst case, a factor of 18,000: the random pivot makes the worst case improbable
a)

If XX takes the values x1,…,xmx_{1},\dots,x_{m} with probabilities p1,…,pmp_{1},\dots,p_{m}, then E(X)=∑ixipiE(X)=\sum_{i}x_{i}p_{i}. It is the WEIGHTED average of the values, and its interpretation is that of the law of large numbers: when you repeat the experiment a large number of times, the average of the observed results approaches E(X)E(X). An expected value is therefore not a prediction for a single trial, it is a prediction for a large number of trials.

b)

The element is at position kk with probability 1n\frac{1}{n}, and the search then costs kk comparisons. So E=∑k=1nk×1n=1n×n(n+1)2=n+12E=\sum_{k=1}^{n}k\times\frac{1}{n}=\frac{1}{n}\times\frac{n(n+1)}{2}=\frac{n+1}{2}. We recover the sum of the first integers proved by induction in the induction and recursion chapter: the two chapters meet here.

c)

E=10012=500.5E=\frac{1001}{2}=500.5 comparisons on average, against 1000 in the WORST CASE, the one where the element is in the last position. The ratio is only 2: average-case analysis does not change the order of magnitude, and linear search remains linear. This is precisely what sets it apart from quicksort in part e, where the gap is a factor of thousands.

d)

Let XX be the number of flips. We have P(X=k)=(12)kP(X=k)=\left(\frac{1}{2}\right)^{k}, since you need k−1k-1 tails followed by a head. So E=∑k≥1k(12)k=2E=\sum_{k\geq 1}k\left(\frac{1}{2}\right)^{k}=2. A faster way to get it: the first flip costs 1; with probability 12\frac{1}{2} it is over, otherwise you start again from zero. Hence E=1+12EE=1+\frac{1}{2}E, that is E=2E=2. This reasoning by conditioning on the first step is the one used to analyze randomized algorithms.

e)

ON AVERAGE: 2×106×ln⁡(106)=2×106×13.8155≈2.76×1072\times 10^{6}\times\ln\left(10^{6}\right)=2\times 10^{6}\times 13.8155\approx 2.76\times 10^{7} comparisons, about 28 million. WORST CASE: (106)22=5×1011\frac{\left(10^{6}\right)^{2}}{2}=5\times 10^{11}, that is 500 billion, eighteen thousand times more. It is used anyway for two reasons. First, because the worst case corresponds to an already sorted array with a naive pivot choice, a situation that a RANDOM pivot makes extremely improbable. Second, because its hidden constant is small and it works in place, which makes it faster in practice than merge sort, even though merge sort is better in the worst case. Choosing an algorithm therefore requires looking at BOTH measures and knowing which one describes the real use.

Exercise 8: Five statements to correct

Each of the following five statements is FALSE. Say why and give the correct statement.

  • 1) “Forbidding repeated characters makes a password harder to crack.”
  • 2) “The test is 99 percent reliable, so a patient who tests positive has a 99 percent chance of being sick.”
  • 3) “Two mutually exclusive events are independent, since they have nothing to do with each other.”
  • 4) “A good hash function never produces a collision.”
  • 5) “To count hands of cards, we use permutations, since the order of the dealt cards matters.”

Type your answers, the page tells you right or wrong 0/12

1)
2)
3)
4)
5)
Show the solution

Answers

  • 1) FALSE: we go from 17,57617{,}576 to 15,60015{,}600, which is 11 % fewer. Every constraint shrinks the search space
  • 2) FALSE: the statement confuses P(T∣M)P(T\mid M) and P(M∣T)P(M\mid T). Bayes gives 16\frac{1}{6}, or 17 %
  • 3) FALSE: the two notions contradict each other. Mutually exclusive is about sets, independent is about information
  • 4) FALSE: the pigeonhole principle forbids it. What we ask for is the difficulty of FINDING a collision
  • 5) FALSE: a hand is a SET, so (525)=2,598,960\binom{52}{5} = 2{,}598{,}960, which is 5!=1205! = 120 times fewer than the permutations
1)

FALSE, it is exactly the opposite. Forbidding repetitions REDUCES the set of possible passwords: with 3 characters out of 26, we go from 263=17,57626^{3}=17{,}576 to 26×25×24=15,60026\times 25\times 24=15{,}600, which is 11 percent fewer. Any rule that forbids something shrinks the search space and therefore makes a brute-force attack easier. What strengthens a password is INCREASING its length and the size of its alphabet, never adding constraints.

2)

FALSE, and the statement confuses P(T∣M)P(T\mid M) with P(M∣T)P(M\mid T). With a prevalence of 1 percent and 5 percent false positives, Bayes' theorem gives P(M∣T)=16≈17P(M\mid T)=\frac{1}{6}\approx 17 percent. The reason is that healthy people are 99 times more numerous, so that their 5 percent of false positives swamp the true positives in number. A conditional probability and its converse have no reason to be close.

3)

FALSE, and the two notions are even contradictory for events of nonzero probability. Mutually exclusive gives P(A∩B)=0P(A\cap B)=0; independent gives P(A∩B)=P(A)P(B)>0P(A\cap B)=P(A)P(B)>0. Knowing that AA has occurred tells you, on the contrary, that BB has not, which is the height of dependence. Remember the wording: mutually exclusive is about SETS, independent is about INFORMATION.

4)

FALSE, and it is impossible by the pigeonhole principle. A 256-bit hash function has only 22562^{256} values whereas the possible files are infinite in number: infinitely many files therefore share each digest. What we ask of a good hash function is not the absence of collisions but the difficulty of FINDING one, which is a computational property and not a set-theoretic one.

5)

FALSE. A hand of cards is a SET: receiving the ace then the king or the king then the ace gives the same hand. We therefore use COMBINATIONS, (525)=2,598,960\binom{52}{5}=2{,}598{,}960. Using permutations would give 52×51×50×49×48=311,875,20052\times 51\times 50\times 49\times 48=311{,}875{,}200, which is 120 times too many, exactly the factor 5!5! that counts the orderings of one hand. The test to run every time: if two results differ only in their order, are they the same result?

Exercise 9: Problem: the strength of a password

How long does it take to crack a password by brute force? The calculation fits on three lines, and its result contradicts nearly every piece of advice you hear.

  • a) A password has 8 characters taken from the 95 printable characters of the keyboard. How many possible passwords are there?
  • b) An attacker tries 10 billion combinations per second. How long does it take at worst?
  • c) Redo the calculation for 12 characters. Express the result in years.
  • d) Redo it for 8 lowercase letters only. Conclusion?
  • e) Strength is measured in BITS OF ENTROPY, that is, log⁡2\log_{2} of the number of possibilities. Compute it in the three cases and say which of length or alphabet size weighs more.

Type your answers, the page tells you right or wrong 0/11

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) 958=6,634,204,312,890,62595^{8} = 6{,}634{,}204{,}312{,}890{,}625, about 6.63×10156.63 \times 10^{15}
  • b) About 663,420663{,}420 seconds, or 7.687.68 days
  • c) 9512≈5.40×102395^{12} \approx 5.40 \times 10^{23}, or about 1.711.71 million years
  • d) 268≈2.09×101126^{8} \approx 2.09 \times 10^{11}, or about 21 seconds
  • e) 52.652.6, 78.878.8 and 37.637.6 bits: entropy is proportional to length, logarithmic in the alphabet
a)

Eight positions, 95 choices each: 958=6,634,204,312,890,62595^{8}=6{,}634{,}204{,}312{,}890{,}625, about 6.63×10156.63\times 10^{15}, a little over six quadrillion.

b)

6.63×10151010≈663,420\frac{6.63\times 10^{15}}{10^{10}}\approx 663{,}420 seconds, or about 7.687.68 days. An eight-character password, even with all the keyboard symbols, therefore falls in a week against dedicated hardware. Note that this figure is a WORST case, the average being half as long, around four days.

c)

9512≈5.40×102395^{12}\approx 5.40\times 10^{23}, so 5.40×10231010=5.40×1013\frac{5.40\times 10^{23}}{10^{10}}=5.40\times 10^{13} seconds, that is about 1.71×1061.71\times 10^{6} years, nearly 1.7 million years. Four more characters take you from a week to a million years: the factor is 954≈81.595^{4}\approx 81.5 million.

d)

268=208,827,064,576≈2.09×101126^{8}=208{,}827{,}064{,}576\approx 2.09\times 10^{11}, so 2.09×10111010≈21\frac{2.09\times 10^{11}}{10^{10}}\approx 21 seconds. Conclusion: an eight-letter lowercase password does not last half a minute. Going from 26 to 95 characters multiplies the time by about 32,000, which is considerable, but remains trivial next to the effect of length.

e)

8log⁡295=8×6.570=52.68\log_{2}95=8\times 6.570=52.6 bits; 12log⁡295=78.812\log_{2}95=78.8 bits; 8log⁡226=8×4.700=37.68\log_{2}26=8\times 4.700=37.6 bits. Entropy is PROPORTIONAL to the length and only LOGARITHMIC in the alphabet size: adding 4 characters is worth 4×6.57=26.34\times 6.57=26.3 bits, whereas going from 26 to 95 characters over 8 positions is worth only 15. Length therefore weighs far more, which is why recent recommendations favour long passphrases over short strings of exotic symbols, which are harder to remember for a smaller gain.

Exercise 10: Problem: birthdays and hash collisions

It takes only 23 people for there to be a one-in-two chance that two of them share a birthday. The same calculation tells you how many keys a hash table can take before its first collision, and it governs the size of cryptographic hashes.

  • a) Compute the probability that, in a group of nn people, all the birth dates are DISTINCT. Ignore leap years.
  • b) Deduce the probability of at least one match and compute it for n=23n=23, then n=50n=50.
  • c) Why is the result so surprising? What question do most people ask themselves instead?
  • d) A hash function produces 32 bits. Assuming the 50 percent threshold is reached at about 1.18N1.18\sqrt{N} keys, how many keys are needed for a one-in-two chance of a collision?
  • e) Redo the calculation for 64, then 128 bits. What do you conclude about the minimum size of a cryptographic hash?

Type your answers, the page tells you right or wrong 0/11

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) ∏k=0n−1365−k365\prod_{k=0}^{n-1}\dfrac{365-k}{365}
  • b) 0.50730.5073 for n=23n=23 and 0.97040.9704 for n=50n=50
  • c) Because we compare nn to 365, whereas it is the (232)=253\binom{23}{2} = 253 PAIRS that count. “Someone shares MY birthday” is only 5.9%5.9\%
  • d) About 1.18×216≈77,3001.18 \times 2^{16} \approx 77{,}300 keys
  • e) About 5.07×1095.07 \times 10^{9} for 64 bits and 2.18×10192.18 \times 10^{19} for 128: the effective security is HALF the size
a)

The first person can be born on any day, the second must avoid 1 day, the third 2, and so on. By the multiplication principle: P(all distinct)=365365×364365×⋯×365−n+1365=∏k=0n−1365−k365P(\text{all distinct})=\frac{365}{365}\times\frac{364}{365}\times\dots\times\frac{365-n+1}{365}=\prod_{k=0}^{n-1}\frac{365-k}{365}. This is exactly the calculation of the COMPLEMENT recommended in exercise 5, and it is essential here: counting the matches directly would require distinguishing the cases with two, three, four people involved.

b)

P(at least one)=1−∏k=0n−1365−k365P(\text{at least one})=1-\prod_{k=0}^{n-1}\frac{365-k}{365}. For n=23n=23: about 0.50730.5073, a little over one chance in two. For n=50n=50: about 0.97040.9704, or 97 percent. The figure shows the very fast rise of this curve, almost vertical between 15 and 35 people.

c)

It is surprising because we instinctively compare nn to 365 and find 23 laughably small. But the number of PAIRS of people is (232)=253\binom{23}{2}=253, a number of the same order as 365: it is the pairs that count, not the people, and they grow like the SQUARE of the group size. The question people ask instead is “what is the probability that someone shares MY birthday”, whose answer is much smaller, 1−(364365)22≈0.05861-\left(\frac{364}{365}\right)^{22}\approx 0.0586, or 6 percent. The two questions differ, and it is the switch from one to the other that produces the surprise.

d)

N=232=4,294,967,296N=2^{32}=4{,}294{,}967{,}296, so N=216=65,536\sqrt{N}=2^{16}=65{,}536 and the threshold is about 1.18×65,536≈77,3001.18\times 65{,}536\approx 77{,}300 keys. In other words, a 32-bit hash has a one-in-two chance of a collision from 77,000 items on, a figure reached by any database. This is very far from the 4.3 billion available values, and it is the main reason why 32 bits are never enough.

e)

For 64 bits: 264=232\sqrt{2^{64}}=2^{32}, so about 1.18×4.29×109≈5.06×1091.18\times 4.29\times 10^{9}\approx 5.06\times 10^{9} keys, five billion, which is still attainable. For 128 bits: 2128=264\sqrt{2^{128}}=2^{64}, so about 2.18×10192.18\times 10^{19} keys, out of reach. CONCLUSION: the effective security of a hash is HALF its size in bits, because the collision attack costs 2n/22^{n/2} and not 2n2^{n}. A 128-bit hash therefore offers only 64 bits of collision resistance, which explains why current standards require 256 bits to aim for 128 bits of security.

510152025303540455055600.10.20.30.40.50.60.70.80.91n = 23: the 50% markprobability of at least one matchn
Something missing from this set? A type of exercise your teacher gives, a problem you are stuck on, a mistake you spotted: tell me, I read every request.

Sending goes through your free space: that is how I can answer you and tell you when the exercise is added. An email is enough, no password. Create your space. Rather not create an account? Write to me directly.

What is it about?
I read every request myself, nobody else sees it. No need to write your name or your school.
When your request is dealt with, you hear about it by email and in your space.

By sending, you agree that I read your request to answer it. It is kept with your account, erased with it, and never published: privacy policy.

Previous chapter Introduction to graphs and matrices, 201-N11

© Ahmed Squalli Houssaini. Exercise set published at www.letuteurscientifique.ca/en/exercices/cegep-n11-counting-probability. Free for personal and classroom use; republishing it elsewhere requires written permission (legal notice).

See also

Looking for a 201-N11 Mathematics for Computer Science tutor in Montreal?

Get in touch for a first session. We work through counting and probability at the level of real assessments, from choosing the right formula all the way to Bayes' theorem.

Site by Studio Squalli