# 【輸入數值自動計算聯集】三項聯集/四項聯集/五項聯集計算(排容原理)

## 聯集/交集說明與計算

### 什麼是交集

A和B的交集是含有所有既屬於A又屬於B的元素，而沒有其他元素的集合。

### 兩項聯集計算說明

｜A∪B ｜ = ｜A ｜+ ｜B ｜- ｜ A∩B ｜

｜A∪B ｜=0.3+0.2-0.3*0.2=0.44

### 三項聯集計算說明

｜A∪B∪C｜=｜A｜+｜B｜+｜C｜-｜A∩B｜-｜A∩C｜-｜B∩C｜+｜A∩B∩C｜

｜A∪B∪C｜=(0.3)+(0.2)+(0.1)-(0.3*0.2)-(0.3*0.1)-(0.2*0.1)+(0.3*0.2*0.1)=0.6-0.06-0.03-0.02+0.006=0.496

### 排容原理

｜A∪B ｜ = ｜A ｜+ ｜B ｜- ｜ A∩B ｜ (單個集合-雙個集合)
｜A∪B∪C｜=｜A｜+｜B｜+｜C｜-｜A∩B｜-｜A∩C｜-｜B∩C｜+｜A∩B∩C｜ (單個集合-雙個集合+三個集合)

### 四項聯集計算說明

｜A∪B ∪C ∪D ｜ = ｜A ｜+ ｜B ｜+ ｜C ｜+｜D ｜ – ｜ A∩B ｜-｜ A∩C ｜-｜ A∩D ｜-｜ B∩C ｜-｜ B∩D ｜-｜ C∩D ｜+ ｜ A∩B∩C ｜+｜ A∩B∩D ｜+｜ A∩C∩D ｜+ ｜ B∩C∩D ｜ – ｜ A ∩ B∩C∩D ｜

｜A∪B ∪C ∪D ｜=(0.4)+(0.3)+(0.2)+(0.1)-(0.4*0.3)-(0.4*0.2)-(0.4*0.1)-(0.3*0.2)-(0.3*0.1)-(0.2*0.1)+(0.4*0.3*0.2)+(0.4*0.3*0.1)+(0.4*0.2*0.1)+(0.3*0.2*0.1)-(0.4*0.3*0.2*0.1)=1-0.12-0.08-0.04-0.06-0.03-0.02+0.024+0.012+0.008+0.006-0.0024=0.6976

### 五項聯集計算說明

｜A∪B∪C∪D∪E｜=｜A｜+｜B｜+｜C｜+｜D｜+｜E｜-｜A∩B｜-｜A∩C｜-｜A∩D｜-｜A∩E｜-｜B∩C｜-｜B∩D｜-｜B∩E｜-｜C∩D｜-｜C∩E｜-｜D∩E｜+｜A∩B∩C｜+｜A∩B∩D｜+｜A∩B∩E｜+｜A∩C∩D｜+｜A∩C∩E｜+｜A∩D∩E｜+｜B∩C∩D｜+｜B∩C∩E｜+｜B∩D∩E｜+｜C∩D∩E｜-｜A∩B∩C∩D｜-｜A∩B∩C∩E｜ -｜A∩B∩D∩E｜-｜A∩C∩D∩E｜-｜B∩C∩D∩E｜+｜A∩B∩C∩D∩E｜

｜A∪B∪C∪D∪E｜=(0.5)+(0.4)+(0.3)+(0.2)+(0.1)-(0.5*0.4)-(0.5*0.3)-(0.5*0.2)-(0.5*0.1)-(0.4*0.3)-(0.4*0.2)-(0.4*0.1)-(0.3*0.2)-(0.3*0.1)-(0.2*0.1)+(0.5*0.4*0.3)+(0.5*0.4*0.2)+(0.5*0.4*0.1)+(0.5*0.3*0.2)+(0.5*0.3*0.1)+(0.5*0.2*0.1)+(0.4*0.3*0.2)+(0.4*0.3*0.1)+(0.4*0.2*0.1)+(0.3*0.2*0.1)-(0.5*0.4*0.3*0.2)-(0.5*0.4*0.3*0.1)-(0.5*0.4*0.2*0.1)-(0.5*0.3*0.2*0.1)-(0.4*0.3*0.2*0.1)+(0.5*0.4*0.3*0.2*0.1)=0.8488

\$277

\$225