Discrete probability
แนะนำใหม่
5:38
Discrete Mathematics
Discrete mathematics is the mathematics of objects you can list: statements, sets, graphs and arrangements. The first three units build the proof engine…
บรรยายภาษาอังกฤษ · สลับคำบรรยายภาษาอังกฤษและภาษาจีนได้
ในบทเรียนนี้
| English | ความหมาย |
|---|---|
| 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/ | ความผิดพลาดของอัยการ |
ผลทดสอบเป็นบวก แต่ควรกังวลแค่ไหน?
- โรคนี้พบใน 1 จาก 100 คน การทดสอบตรวจพบ 90% ของผู้ป่วย และให้ผลลบที่ถูกต้อง 90% ของคนปกติ หากคุณได้ผลทดสอบเป็นบวก โอกาสที่คุณป่วยคือ 90%?
- ประมาณ 8% ความน่าจะเป็นแบบไม่ต่อเนื่อง ซึ่งเป็นการนับจากผลลัพธ์ที่มีโอกาสเท่ากัน แสดงเหตุผลไว้
พื้นที่ตัวอย่างและการนับ
- พื้นที่ตัวอย่าง $\Omega$ คือเซตของผลลัพธ์ทั้งหมด; เหตุการณ์ เป็นเซตย่อย หากทุกผลลัพธ์มีโอกาสเท่ากัน $P(E) = \frac{|E|}{|\Omega|}$
- ลูกเตียสองลูกให้ $6 \times 6 = 36$ คู่ หกคู่รวมกันได้ 7 ดังนั้น $P(\text{sum} = 7) = \frac{6}{36} = \frac{1}{6}$ สองคู่รวมกันได้ 11 ดังนั้น $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.
theorem ของ Bayes กับผลการทดสอบ
- Bayes' theorem: $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$. มีเพียงกิ่งที่เป็นบวกที่เหลืออยู่และปรับขนาดใหม่:


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)$ ลูกเตียสองลูกเป็นอิสระ: $P(\text{both } 6) = \frac{1}{6} \times \frac{1}{6} = \frac{1}{36}$
- การสุ่มโดยไม่ใส่กลับไม่ใช่ความเป็นอิสระ. แอสสองใบจากไพ่ 52 ใบ: $\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.
การ์ดนี้เป็นการ์ดใหม่ จึงแสดงเป็นภาษาอังกฤษจนกว่าคำแปลจะพร้อม
Random variables and expected value
- A random variable 随机变量 gives a number for each outcome, such as the sum of two dice. Its expected value 期望值 is the average weighted by probability: $E[X] = \sum_x x\,P(X = x)$. One die: $(1 + 2 + \dots + 6)/6 = 3.5$.
- Linearity of expectation 期望的线性: $E[X + Y] = E[X] + E[Y]$ always, even when $X$ and $Y$ depend on each other.
- So two dice sum to $3.5 + 3.5 = 7$ on average, with no table of 36 pairs. Algorithm analysis uses this all the time: split a cost into simple pieces, average each piece, then add.
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.
การ์ดนี้เป็นการ์ดใหม่ จึงแสดงเป็นภาษาอังกฤษจนกว่าคำแปลจะพร้อม
Worked example: collisions in a hash table
- 23 keys are independently hashed into 365 slots, each slot equally likely. On average, how many pairs of keys land in the same slot? There are $\binom{23}{2} = 253$ pairs. For each pair, count 1 if it collides; that happens with probability $1/365$, so its expected value is $1/365$.
- By linearity, the expected number of colliding pairs is $253/365 \approx 0.69$. The chance of no collision is $\frac{365}{365} \times \frac{364}{365} \times \dots \times \frac{343}{365} \approx 0.49$, so a collision is more likely than not (the birthday problem).
- Collisions come early, which is why hash tables must handle them rather than hope to avoid them.
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% ที่ปกติ)
- การสลับกันคือ ลวงตาของอัยการ. Bayes แปลงหนึ่งให้เป็นอีกอย่างหนึ่ง; มันneverสลับกันฟรีๆ
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$ เป็นอิสระต่อกัน
- การละเลยอัตราพื้นฐาน เงื่อนไขที่พบน้อยยังคงมีความน่าจะเป็นต่ำมากหลังจากการทดสอบที่ไม่สมบูรณ์แบบหนึ่งครั้ง
คุณเข้าใจแล้ว
- ผลลัพธ์ที่มีความน่าจะเป็นเท่ากัน: $P(E) = |E| / |\Omega|$ ดังนั้นการนับจึงสามารถคำนวณได้โดยตรง
- $P(A \mid B) = P(A \cap B)/P(B)$; Bayes: $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)$
เกิดปัญหาอะไรขึ้น? เฉพาะทีมเว็บไซต์เท่านั้นที่เห็นข้อมูลนี้