Wei-Ann Lin · 林蔚安
機率論 · Chapter I · Topic 8

樣本空間的分割與全機率定理

Partitions and the Law of Total Probability


Abstract. 樣本空間的分割由一組互斥且周延的事件構成。本篇介紹分割的定義、全機率定理及其條件機率版本,並說明兩組分割彼此交集而成的二元分割與列聯表。

上一篇介紹列聯表時曾提到,表內的聯合機率與表邊的邊際機率,背後其實對應著樣本空間的分割與全機率定理。本篇便由分割的定義談起,說明如何依一組互斥且周延的事件將任一事件拆成數個部分,再逐項加總求得其機率。

樣本空間的分割

Definition 1.23

令 $(S,\mathcal{F},\mathbb{P})$ 為一機率空間,$A_1,A_2,\ldots,A_n\in\mathcal{F}$,若其滿足以下條件,則稱 $A_1,A_2,\ldots,A_n$ 為 $S$ 的一組分割 (partition):

(1) 互斥 (mutually exclusive):

\[A_i\cap A_j=\varnothing,\ \forall\,i\neq j\]

(2) 周延 (collectively exhaustive):

\[\bigcup_{i=1}^{n}A_i=S\]

分割是將樣本空間切分為數個互不重疊且不遺漏的事件,故須同時滿足兩兩互斥與整體周延兩項條件,其中周延即指所有事件的聯集等於樣本空間 $S$。

分割的概念可由下圖理解。

樣本空間 S 的矩形被垂直分線切成 A_1、A_2 到 A_n 等互不重疊的直條。
Fig. 1.23. 樣本空間 $S$ 被 $A_1,A_2,\ldots,A_n$ 切成數個互不重疊的部分,而這些事件的聯集恰為整個樣本空間。

全機率定理

Theorem 1.16 (The Law of Total Probability)

令 $(S,\mathcal{F},\mathbb{P})$ 為一機率空間,且令 $A_1,A_2,\ldots,A_n\in\mathcal{F}$ 為 $S$ 的一組分割,$B\in\mathcal{F}$ 為一事件,則

\[\mathbb{P}(B)=\mathbb{P}\left(\bigcup_{i=1}^{n}(B\cap A_i)\right)=\sum_{i=1}^{n}\mathbb{P}(B\cap A_i)\]
\[\begin{aligned} \mathbb{P}(B)&=\mathbb{P}\left(\bigcup_{i=1}^{n}(B\cap A_i)\right)\\[0.4em] &=\sum_{i=1}^{n}\mathbb{P}(B\cap A_i) \end{aligned}\]

Proof.

由於 $A_1,A_2,\ldots,A_n$ 為 $S$ 的一組分割,故

\[A_i\cap A_j=\varnothing,\ \forall\,i\neq j\]

且

\[B=B\cap S=B\cap\left(\bigcup_{i=1}^{n}A_i\right)=\bigcup_{i=1}^{n}(B\cap A_i)\]
\[\begin{aligned} B&=B\cap S=B\cap\left(\bigcup_{i=1}^{n}A_i\right)\\[0.4em] &=\bigcup_{i=1}^{n}(B\cap A_i) \end{aligned}\]

此外,$B\cap A_1,B\cap A_2,\ldots,B\cap A_n$ 兩兩互斥,故由有限可加性可得

\[\mathbb{P}(B)=\mathbb{P}\left(\bigcup_{i=1}^{n}(B\cap A_i)\right)=\sum_{i=1}^{n}\mathbb{P}(B\cap A_i)\]
\[\begin{aligned} \mathbb{P}(B)&=\mathbb{P}\left(\bigcup_{i=1}^{n}(B\cap A_i)\right)\\[0.4em] &=\sum_{i=1}^{n}\mathbb{P}(B\cap A_i) \end{aligned}\]

原式得證。 $\square$

全機率定理 (the law of total probability) 的概念已在前文兩事件版本的全機率定理中出現;此處則將分割由 $A$ 與 $A^{\prime}$ 兩個事件推廣至一般 $n$ 個事件所構成的分割,其概念可由下圖理解。

樣本空間 S 的矩形被切成 A_1、A_2 到 A_n 等直條,事件 B 為橫跨各直條的圓角橫帶,並被分線切成 B 交 A_1 到 B 交 A_n 等區塊。
Fig. 1.24. 事件 $B$ 橫跨分割中的各個事件,因而被切成 $B\cap A_1,B\cap A_2,\ldots,B\cap A_n$ 這些互斥的部分。

上圖中,$B$ 與這組分割逐一取交集後,形成 $B\cap A_1,B\cap A_2,\ldots,B\cap A_n$ 共 $n$ 個互斥的集合,其聯集即為 $B$ 本身,故由機率的有限可加性即可推得上述結果,其直觀意義亦與兩事件版本的全機率定理完全一致。

由於全機率定理將 $\mathbb{P}(B)$ 表為各交集機率的總和,若進一步假設對所有 $i=1,2,\ldots,n$ 皆有 $\mathbb{P}(A_i)>0$,即可套用乘法原理將交集機率改寫為條件機率的版本,寫為

\[\mathbb{P}(B)=\mathbb{P}\left(\bigcup_{i=1}^{n}(B\cap A_i)\right)=\sum_{i=1}^{n}\mathbb{P}(B\cap A_i)=\sum_{i=1}^{n}\mathbb{P}(B\mid A_i)\,\mathbb{P}(A_i)\]
\[\begin{aligned} \mathbb{P}(B)&=\mathbb{P}\left(\bigcup_{i=1}^{n}(B\cap A_i)\right)\\[0.4em] &=\sum_{i=1}^{n}\mathbb{P}(B\cap A_i)\\[0.4em] &=\sum_{i=1}^{n}\mathbb{P}(B\mid A_i)\,\mathbb{P}(A_i) \end{aligned}\]

當問題已知各分組的機率與條件機率時,此表示式尤為實用。

二元分割與列聯表

分割的概念可以推廣至兩組分割彼此的交集,我們稱為二元分割。二元分割的概念即為上一篇中的列聯表,如下表:

 $A_1$$\cdots$$A_n$總和
$B_1$$\mathbb{P}(A_1\cap B_1)$$\cdots$$\mathbb{P}(A_n\cap B_1)$$\mathbb{P}(B_1)$
$\vdots$$\vdots$$\ddots$$\vdots$$\vdots$
$B_m$$\mathbb{P}(A_1\cap B_m)$$\cdots$$\mathbb{P}(A_n\cap B_m)$$\mathbb{P}(B_m)$
總和$\mathbb{P}(A_1)$$\cdots$$\mathbb{P}(A_n)$$1$
Note

由於 $A_1,A_2,\ldots,A_n$ 與 $B_1,B_2,\ldots,B_m$ 各自為樣本空間 $S$ 的分割,兩組事件逐一取交集所得的 $A_i\cap B_j$ 仍兩兩互斥,且各交集事件的聯集恰等於樣本空間,即

\[\bigcup_{i=1}^{n}\bigcup_{j=1}^{m}(A_i\cap B_j)=S\]

因此這 $nm$ 個交集事件也滿足互斥與周延條件,構成 $S$ 的二元分割。

全機率定理的應用

Example 1.25 (Symptoms and Diseases)

Suppose that a patient examined at a hospital is free of any disease with probability $0.99$, is affected by Disease $B$ with probability $0.001$, and is affected by Disease $C$ with probability $0.009$. These three states are the only possibilities. Symptom $A$ is observed with probability $0.001$ in a patient free of any disease, and with probability $0.9$ in each of the two diseased states. What is the probability that a patient chosen at random shows Symptom $A$?

令 $A$ 表有 $A$ 症狀、$B$ 表感染 $B$ 疾病、$C$ 表感染 $C$ 疾病、$N$ 表沒有感染疾病之事件。依題目敘述可知

\[\mathbb{P}(A\mid N)=0.001,\qquad\mathbb{P}(A\mid B)=0.9,\qquad\mathbb{P}(A\mid C)=0.9\]
\[\begin{gathered} \mathbb{P}(A\mid N)=0.001,\\[0.4em] \mathbb{P}(A\mid B)=0.9,\\[0.4em] \mathbb{P}(A\mid C)=0.9 \end{gathered}\]

且

\[\mathbb{P}(N)=0.99,\qquad\mathbb{P}(B)=0.001,\qquad\mathbb{P}(C)=0.009\]
\[\begin{gathered} \mathbb{P}(N)=0.99,\\[0.4em] \mathbb{P}(B)=0.001,\\[0.4em] \mathbb{P}(C)=0.009 \end{gathered}\]

由乘法原理可得

\[\begin{gathered} \mathbb{P}(N\cap A)=\mathbb{P}(A\mid N)\,\mathbb{P}(N)=0.001\times 0.99=0.00099\\[0.4em] \mathbb{P}(B\cap A)=\mathbb{P}(A\mid B)\,\mathbb{P}(B)=0.9\times 0.001=0.0009\\[0.4em] \mathbb{P}(C\cap A)=\mathbb{P}(A\mid C)\,\mathbb{P}(C)=0.9\times 0.009=0.0081 \end{gathered}\]
\[\begin{aligned} \mathbb{P}(N\cap A)&=\mathbb{P}(A\mid N)\,\mathbb{P}(N)\\[0.4em] &=0.001\times 0.99=0.00099 \end{aligned}\] \[\begin{aligned} \mathbb{P}(B\cap A)&=\mathbb{P}(A\mid B)\,\mathbb{P}(B)\\[0.4em] &=0.9\times 0.001=0.0009 \end{aligned}\] \[\begin{aligned} \mathbb{P}(C\cap A)&=\mathbb{P}(A\mid C)\,\mathbb{P}(C)\\[0.4em] &=0.9\times 0.009=0.0081 \end{aligned}\]

由於 $N$、$B$、$C$ 兩兩互斥,且三者的聯集為整個樣本空間,故此三個事件為 $S$ 的一組分割,因此由全機率定理可得

\[\mathbb{P}(A)=\mathbb{P}(N\cap A)+\mathbb{P}(B\cap A)+\mathbb{P}(C\cap A)=0.00999\]
\[\begin{aligned} \mathbb{P}(A)&=\mathbb{P}(N\cap A)+\mathbb{P}(B\cap A)\\[0.4em] &\qquad+\mathbb{P}(C\cap A)\\[0.4em] &=0.00999 \end{aligned}\]
Example 1.26 (Manufacturing Defects)

Three machines $A$, $B$, and $C$ produce the same item and account for $20\%$, $30\%$, and $50\%$ of the total output, respectively. Of the items made by $A$, $B$, and $C$, $5\%$, $4\%$, and $2\%$ are defective, respectively. One item is drawn at random from the combined output and inspected. What is the probability that the item drawn is defective?

令 $A$、$B$、$C$ 分別表示該產品來自 $A$、$B$、$C$ 機台之事件,$R$ 表示不良品之事件。則由題意可知

\[\mathbb{P}(A)=0.2,\qquad\mathbb{P}(B)=0.3,\qquad\mathbb{P}(C)=0.5\]
\[\begin{gathered} \mathbb{P}(A)=0.2,\\[0.4em] \mathbb{P}(B)=0.3,\\[0.4em] \mathbb{P}(C)=0.5 \end{gathered}\]

且

\[\mathbb{P}(R\mid A)=0.05,\qquad\mathbb{P}(R\mid B)=0.04,\qquad\mathbb{P}(R\mid C)=0.02\]
\[\begin{gathered} \mathbb{P}(R\mid A)=0.05,\\[0.4em] \mathbb{P}(R\mid B)=0.04,\\[0.4em] \mathbb{P}(R\mid C)=0.02 \end{gathered}\]

由於抽出的產品必來自 $A$、$B$、$C$ 三台機器之一,此三個事件恰為樣本空間的一組分割,故由全機率定理可知,所求為

\[\begin{aligned} \mathbb{P}(R)&=\mathbb{P}(R\mid A)\,\mathbb{P}(A)+\mathbb{P}(R\mid B)\,\mathbb{P}(B)+\mathbb{P}(R\mid C)\,\mathbb{P}(C)\\[0.4em] &=0.05\times 0.2+0.04\times 0.3+0.02\times 0.5=0.032 \end{aligned}\]
\[\begin{aligned} \mathbb{P}(R)&=\mathbb{P}(R\mid A)\,\mathbb{P}(A)+\mathbb{P}(R\mid B)\,\mathbb{P}(B)\\[0.4em] &\qquad+\mathbb{P}(R\mid C)\,\mathbb{P}(C)\\[0.4em] &=0.05\times 0.2+0.04\times 0.3+0.02\times 0.5\\[0.4em] &=0.032 \end{aligned}\]

本篇小結

本篇由樣本空間的分割出發,整理下列結果:

結果內容
Definition 1.23分割的互斥與周延條件
Theorem 1.16全機率定理與其條件機率版本
二元分割兩組分割彼此交集所構成的列聯表

全機率定理把 $\mathbb{P}(B)$ 寫成各個條件機率 $\mathbb{P}(B\mid A_i)$ 以 $\mathbb{P}(A_i)$ 為權重的加權平均。既然整體機率由各組的條件機率混合而成,接下來自然要問,分組之後的比較方向與混合之後的比較方向是否一定相同。這正是下一篇要談的分組、混合與辛普森悖論。

參考文獻與延伸閱讀

  • 黃文璋,2010,《機率論》,二版,華泰文化。
  • Sheldon Ross. 2019. A First Course in Probability. 10th ed. Pearson.
  • Joseph K. Blitzstein and Jessica Hwang. 2019. Introduction to Probability. 2nd ed. Chapman and Hall/CRC.