Discrete probability
導入済み
5:38
離散数学
Discrete mathematics is the mathematics of objects you can list: statements, sets, graphs and arrangements. The first three units build the proof engine…
英語のナレーション・英語と中国語の字幕を切り替え可能
このレッスンの内容
| English | 意味 |
|---|---|
| Discrete probability | |
| sample space/ˈsæmpl speɪs/ | 標本空間 |
| event/ɪˈvent/ | イベント |
| conditional probability/kənˈdɪʃənl ˌprɒbəˈbɪlɪti/ | 条件確率 |
| Bayes' theorem/beɪz ˈθɪərəm/ | ベイズの定理 |
| independent/ˌɪndɪˈpendənt/ | 独立 |
| random variable/ˈrændəm ˈveərɪəbl/ | A numerical quantity whose value depends on the outcome of a random process. |
| expected value/ekˈspektɪd ˈvæljuː/ | The probability-weighted mean of the possible values of a random variable. |
| linearity of expectation/lɪˈnɪərɪti ɒv ekspɪkˈteɪʃn/ | the rule E[X + Y] = E[X] + E[Y], true even when X and Y are dependent |
| prosecutor's fallacy/ˈprɒsɪkjuːtəz ˈfæləsi/ | 検察官の誤謬 |
検査は陽性、どれほど心配すべきか?
- ある病気は100人に1人がかかる。検査では、病気の人の90%が陽性となり、健康な人の90%が陰性となる。あなたの検査結果が陽性だった場合、病気である確率は90%だろうか?
- その確率は約8%である。等確率の結果を数える離散確率を用いると、その理由がわかる。
標本空間とカウント
- 標本空間 $\Omega$ はすべての事象の集合であり、事象はその部分集合である。すべての事象が等確率であれば、$P(E) = \frac{|E|}{|\Omega|}$となる。
- 2つの公平なサイコロで$6 \times 6 = 36$組の組み合わせができる。合計が7になるのは6組あるので、$P(\text{sum} = 7) = \frac{6}{36} = \frac{1}{6}$。合計が11になるのは2組あるので、$P(\text{sum} = 11) = \frac{2}{36}$。
Two fair dice: what is P(sum = 7 or sum = 11)?
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
6 pairs sum to 7 and 2 pairs sum to 11; the events do not overlap, so 8 of the 36 pairs.
条件付き確率は世界を縮小する
- 条件付き確率: $P(A \mid B) = \frac{P(A \cap B)}{P(B)}$。$B$に含まれる事象のみを残し、その中で$A$にも含まれるものの割合を問う。
- 最初のサイコロが 6 と分かったとき、世界は 6 のペアに縮小する。その中の (6, 1) は和が 7 になるため、確率は $P(\text{sum} = 7 \mid \text{first} = 6) = \frac{1}{6}$ である。
Two fair dice. Given that the sum is 4, what is the probability that both dice show 2? Give a decimal to 3 places.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
The sum-4 world is (1,3), (2,2), (3,1): 3 outcomes, one of them (2,2), so 1/3.
検査におけるベイズの定理
- ベイズの定理: $P(A \mid B) = \frac{P(B \mid A)\,P(A)}{P(B)}$。木図から $P(B)$ を求めるには、$B$ で終わるすべての枝を足し合わせる。
- 病気で陽性: $0.9 \times 0.01 = 0.009$。健康で陽性: $0.1 \times 0.99 = 0.099$。陽性の枝だけを残し、確率の合計が1になるように調整すると、次のようになる。
- 同じことを整数の人数で考え、1000人を検査する。
| 1000人 | 検査で陽性 | 検査で陰性 |
|---|---|---|
| 病気の人10人 | 9 | 1 |
| 健康な人990人 | 99 | 891 |
| 合計 | 108 | 892 |
- 陽性の108人のうち、病気なのはわずか9人である: $9/108 = 1/12$。健康な人の集団は非常に大きいため、その10%にあたる偽陽性の人数は、病気で陽性となる人数を上回る。

A disease affects 2%. A test catches 95% of cases and gives a false positive for 5% of healthy people. What is P(ill | positive), in % to 1 decimal place?
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Ill and positive: 0.95 × 0.02 = 0.019. Healthy and positive: 0.05 × 0.98 = 0.049. 0.019 ÷ 0.068 ≈ 0.279, so about 27.9%.
独立性
- $A$ と $B$ が独立しているとは $P(A \cap B) = P(A)\,P(B)$ のことを指すので、$B$ を知っても $P(A)$ は変わらない。2つのサイコロは独立しており、$P(\text{both } 6) = \frac{1}{6} \times \frac{1}{6} = \frac{1}{36}$ となる。
- 戻さない抽出は独立ではありません。 52 カードのデッキからエース2枚: $\frac{4}{52} \times \frac{3}{51} = \frac{1}{221}$ 、最初の抽出でデッキが変わるため。
Drawing two cards from a deck without putting the first back gives independent draws.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
The first card changes what is left, so the second probability depends on it.
Two cards are drawn without replacement from a 52-card deck. The probability that both are aces is 1/N. What is N?
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
4/52 × 3/51 = 12/2652 = 1/221.
確率変数と期待値
- 確率変数は、2つのサイコロの目の和のように、それぞれの結果に数値を対応させる。その期待値は、確率で重み付けした平均である: $E[X] = \sum_x x\,P(X = x)$。サイコロ1個では、$(1 + 2 + \dots + 6)/6 = 3.5$。
- 期待値の線形性: $X$ と $Y$ が互いに依存していても、常に $E[X + Y] = E[X] + E[Y]$ が成り立つ。
- したがって、36組の表を作らなくても、2つのサイコロの目の和の平均は $3.5 + 3.5 = 7$ となる。アルゴリズムの解析では、コストを単純な部分に分け、それぞれの平均を求めて足し合わせるという方法がよく使われる。
Three fair dice are rolled. What is the expected value of their sum?
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
By linearity of expectation, 3.5 + 3.5 + 3.5 = 10.5.
例題: ハッシュテーブルでの衝突
- 23個のキーを、それぞれ独立に365個のスロットへハッシュ化する。各スロットに入る確率は等しい。平均して、何組のキーが同じスロットに入るだろうか? キーの組は $\binom{23}{2} = 253$ 組ある。それぞれの組について、衝突すれば1と数える。衝突する確率は $1/365$ なので、その期待値は $1/365$ である。
- 期待値の線形性により、衝突する組の数の期待値は $253/365 \approx 0.69$ となる。衝突が起こらない確率は $\frac{365}{365} \times \frac{364}{365} \times \dots \times \frac{343}{365} \approx 0.49$ なので、衝突は起こる可能性の方が高い(誕生日の問題)。
- 衝突は比較的早く起こるため、ハッシュテーブルでは衝突を避けられると期待するのではなく、衝突に対処する必要がある。
10 keys are independently hashed into 100 equally likely slots. What is the expected number of pairs of keys that share a slot? (two decimals)
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
There are 10 × 9 / 2 = 45 pairs, each colliding with probability 1/100, so the expected number is 45/100 = 0.45.
検察側の誤謬
- $P(A \mid B)$ と $P(B \mid A)$ は異なる数値である。「健康な人が稀に陽性になる」(10%)と「陽性な人が稀に健康である」(ここでは約 92% が健康)は別物である。
- これらを逆転させることが検察側の誤謬である。ベイズは片方を他方に変換するものであり、無償で逆転させるわけではない。
For the 1% disease test in this lesson, match each probability to its value.
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
The test's own rates condition on health; the patient's question conditions on the result. Bayes links them.
点数を落としやすいポイント
- 等確率でない結果を等確率として数える。和が2から12までのそれぞれの値になる確率は等しくない。代わりに36組の出目を数える。
- 依存する事象の確率を掛け合わせる。$P(A)P(B)$ が成り立つのは、$A$ と $B$ が独立している場合だけである。
- ベースレートを無視する。まれな状態は、精度が完全ではない検査を1回受けた後でも、比較的起こりにくいままである。
理解できたかな
- 結果が等確率なら、$P(E) = |E| / |\Omega|$ なので、数え上げればよい。
- $P(A \mid B) = P(A \cap B)/P(B)$。ベイズの定理: $P(A \mid B) = P(B \mid A)P(A)/P(B)$。ここで $P(B)$ は木図から求める。
- 独立性とは $P(A \cap B) = P(A)P(B)$ ということである。$P(A \mid B)$ と $P(B \mid A)$ を決して取り違えてはいけない。
- 期待値は足し合わせられる: $E[X + Y] = E[X] + E[Y]$。これは変数が互いに依存していても成り立つ。
何が問題でしたか?この内容はサイトの運営チームだけが確認します。