容斥(原理):一种计数/概率方法,用来计算多个集合并集的大小(或事件发生的概率)。核心思想是:先把各部分加起来,再减去重复计算的交集,再加回三重交集……交替加减。常见于集合论、组合数学与概率论中。(也常写作 inclusion–exclusion principle。)
/ɪnˈkluːʒən ɪkˈskluːʒən/
Inclusion-exclusion helps avoid double-counting.
容斥法能帮助避免重复计数。
To find the number of students who take at least one of math, physics, and chemistry, we use inclusion-exclusion by adding the single counts and then correcting for overlaps.
要计算至少选修数学、物理、化学中一门课的学生人数,我们用容斥:先把各科人数相加,再用重叠部分进行修正。
Inclusion 来自拉丁语词根,意为“包含、纳入”;exclusion 同源但含义相反,意为“排除、剔除”。“inclusion-exclusion” 作为术语,用来形象地表示这种方法在计算时对重叠部分进行“纳入与排除”的交替修正。