返回题库

狡猾的猫

Sly Cat

专题
Probability / 概率
难度
L2

题目详情

你养了一只猫,它有个狡猾的习惯:会趁你不在家时偷偷溜出去。每天你外出时,都会打电话给邻居,问猫是否离开过你家。邻居总会回答“是”或“否”,但有时会撒谎,也就是明明猫没出去却说出去了,或者反过来。

设猫离家的概率是 0.001,而邻居撒谎的概率是 0.1(且与猫是否真的离家相互独立)。

已知邻居说猫离开了家,求猫真的离家的概率。

You have a pet cat that has a sly tendency to leave your house while you are away. Every day while you are out, you call your neighbor to ask them whether your cat has left your house. Your neighbor always responds with a yes or a no, but sometimes they lie, saying that your cat left when it has not, or vice versa.

Let's say that the probability that your cat leaves the house is 0.001 and the probability that your neighbor lies is 0.1 (independent of whether your cat actually left the house or not).

What is the probability that your cat left the house given that your neighbor says it did so?

解析

设事件:

  • CC:猫真的离开了家
  • NN:邻居说“猫离开了家”
  • LL:邻居在说谎

已知 P(C)=0.001P(C)=0.001P(L)=0.1P(L)=0.1,且 LLCC 独立。我们要求 P(CN)P(C\mid N)

由贝叶斯公式:

P(CN)=P(NC)P(C)P(N).P(C\mid N)=\frac{P(N\mid C)P(C)}{P(N)}.

若猫真的离家(CC 发生),邻居说“离家”的概率等于说真话的概率: P(NC)=1P(L)=0.9.P(N\mid C)=1-P(L)=0.9.

若猫没离家(¬C\neg C 发生),邻居说“离家”只能是说谎: P(N¬C)=P(L)=0.1.P(N\mid \neg C)=P(L)=0.1.

用全概率公式:

P(N)=P(NC)P(C)+P(N¬C)P(¬C)=0.90.001+0.10.999=0.1008.P(N)=P(N\mid C)P(C)+P(N\mid\neg C)P(\neg C)=0.9\cdot 0.001+0.1\cdot 0.999=0.1008.

代回:

P(CN)=0.90.0010.10080.0089.P(C\mid N)=\frac{0.9\cdot 0.001}{0.1008}\approx \boxed{0.0089}.

Original Explanation

Let's begin by defining a few random variables.

C=your cat left the houseC = \text{your cat left the house}\\ N=your neighbor says that your cat left the houseN = \text{your neighbor says that your cat left the house}\\ L=your neighbor liesL = \text{your neighbor lies}

From the problem statement we know that P(C)=0.001P(C) = 0.001 and P(L)=0.1P(L) = 0.1. Our objective is to find P(CN)P(C | N) - the probability that your cat left the house given your neighbor said it did so.

We can apply Bayes' Theorem here:

P(CN)=P(NC)P(C)P(N)P(C |N) = \frac{P(N | C) * P(C)}{P(N)}

The probability that your neighbor says that the cat left the house when it did, is the same as the probability that your neighbor told the truth, which equals 1P(L)=10.1=0.91 - P(L) = 1 - 0.1 = 0.9.

Next, using the law of total probability we can decompose P(N)P(N) into

P(N)=P(NC)P(C)+P(N¬C)P(¬C)=0.90.001+0.10.999=0.1008P(N) = P(N | C) * P(C) + P(N | \neg C) * P(\neg C) \\ = 0.9 * 0.001 + 0.1 * 0.999 \\ = 0.1008

Plugging these values back into the original equation we get:

P(CN)=0.90.0010.1008=0.0089P(C | N) = \frac{0.9 * 0.001}{0.1008} = \boxed{0.0089}