Bayes' theorem and 组合数学 (Fall 2017)/Problem Set 1: Difference between pages

From TCS Wiki
(Difference between pages)
Jump to navigation Jump to search
 
imported>Etone
No edit summary
 
Line 1: Line 1:
In [[probability theory]] and applications, '''Bayes' theorem''' shows the relation between a '''[[conditional probability]]''' and its reverse form. For example, the probability of a [[hypothesis]] given some observed pieces of evidence and the probability of that evidence given the hypothesis. This theorem is named after [[Thomas Bayes]] ({{IPA-en|ˈbeɪz|}} or "bays") and often called '''Bayes' law''' or '''Bayes' rule'''.
*每道题目的解答都要有<font color="red" size=4>完整的解题过程</font>。中英文不限。


== Formula ==
== Problem 1 ==
#有<math>k</math>种不同的明信片,每种明信片有无限多张,寄给<math>n</math>个人,每人一张,有多少种方法?
#有<math>k</math>种不同的明信片,每种明信片有无限多张,寄给<math>n</math>个人,每人一张,每个人必须收到不同种类的明信片,有多少种方法?
#有<math>k</math>种不同的明信片,每种明信片有无限多张,寄给<math>n</math>个人,每人收到<math>r</math>张不同的明信片(但不同的人可以收到相同的明信片),有多少种方法?
#只有一种明信片,共有<math>m</math>张,寄给<math>n</math>个人,全部寄完,每个人可以收多张明信片或者不收明信片,有多少种方法?
#有<math>k</math>种不同的明信片,其中第<math>i</math>种明信片有<math>m_i</math>张,寄给<math>n</math>个人,全部寄完,每个人可以收多张明信片或者不收明信片,有多少种方法?


The equation used is:
== Problem 2 ==
:<math>P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}.</math>
Find the number of ways to select <math>2n</math> balls from <math>n</math> identical blue balls, <math>n</math> identical red balls and <math>n</math> identical green balls.
* Give a combinatorial proof for the problem.
* Give an algebraic proof for the problem.


Where:
== Problem 3 ==
* P(''A'') is the [[prior probability]] or [[marginal probability]] of ''A''. It is "prior" in the sense that it does not take into account any information about&nbsp;''B''.
*一个长度为<math>n</math>的“山峦”是如下由<math>n</math>个"/"和<math>n</math>个"\"组成的,从坐标<math>(0,0)</math>到<math>(0,2n)</math>的折线,但任何时候都不允许低于<math>x</math>轴。例如下图:
* P(''A''|''B'') is the [[conditional probability]] of ''A'', given ''B''. It is also called the [[posterior probability]] because it is derived from or depends upon the specified value of&nbsp;''B''.
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''. It is also called the [[Likelihood function|likelihood]].
* P(''B'') is the prior or marginal probability of ''B'', and acts as a [[normalizing constant]].


== Example ==
    /\
  /  \/\/\    /\/\
  /        \/\/    \/\/\
  ----------------------
:长度为<math>n</math>的“山峦”有多少?


A simple example is as follows: There is a 40% chance of it raining on Sunday. If it rains on Sunday, there is a 10% chance it will rain on Monday. If it didn't rain on Sunday, there's an 80% chance it will rain on Monday.
*一个长度为<math>n</math>的“地貌”是由<math>n</math>个"/"和<math>n</math>个"\"组成的,从坐标<math>(0,0)</math>到<math>(0,2n)</math>的折线,允许低于<math>x</math>轴。长度为<math>n</math>的“地貌”有多少?


"Raining on Sunday" is event A, and "Raining on Monday" is event B.
== Problem 4==
* P(''A'') = 0.40 = Probability of Raining on Sunday.
李雷和韩梅梅竞选学生会主席,韩梅梅获得选票 <math>p</math> 张,李雷获得选票 <math>q</math> 张,<math>p>q</math>。我们将总共的 <math>p+q</math> 张选票一张一张的点数,有多少种选票的排序方式使得在整个点票过程中,韩梅梅的票数一直高于李雷的票数?等价地,假设选票均匀分布的随机排列,以多大概率在整个点票过程中,韩梅梅的票数一直高于李雷的票数。
* P(''A`'') = 0.60 = Probability of not raining on Sunday.
* P(''B|A'') = 0.10 = Probability of it raining on Monday, if it rained on Sunday.
* P(''B`|A'') = 0.90 = Probability of it not raining on Monday, if it rained on Sunday.
* P(''B|A`'') = 0.80 = Probability of it raining on Monday, if it did not rain on Sunday.
* P(''B`|A`'') = 0.20 = Probability of it not raining on Monday, if it did not rain on Sunday.


The first thing we'd normally calculate is the probability of it raining on Monday:
==Problem 5==
This would be the sum of the probability of "Raining on Sunday and raining on Monday" and "Not raining on Sunday and raining on Monday"
A <math>2\times n</math> rectangle is to be paved with <math>1\times 2</math> identical blocks and <math>2\times 2</math> identical blocks. Let <math>f(n)</math> denote the number of ways that can be done. Find a recurrence relation for <math>f(n)</math>, solve the recurrence relation.
:<math> 0.40\times0.10 + 0.60\times0.80 = 0.52 = 52%</math> chance


However, what if we said: "It rained on Monday. What is the probability it rained on Sunday?" That is where Bayes' theorem comes in. It allows us to calculate the probability of an earlier event, given the result of a later event.
== Problem 6 ==
* 令<math>s_n</math>表示长度为<math>n</math>,没有2个连续的1的二进制串的数量,即
*:<math>s_n=|\{x\in\{0,1\}^n\mid \forall 1\le i\le n-1, x_ix_{i+1}\neq 11\}|</math>。
:求 <math>s_n</math>。


The equation used is:
*令<math>t_n</math>表示长度为<math>n</math>,没有3个连续的1的二进制串的数量,即
*:<math>t_n=|\{x\in\{0,1\}^n\mid \forall 1\le i\le n-2, x_ix_{i+1}x_{i+2}\neq 111\}|</math>。
*#给出计算<math>t_n</math>的递归式,并给出足够的初始值。
*#计算<math>t_n</math>的生成函数<math>T(x)=\sum_{n\ge 0}t_n x^n</math>,给出生成函数<math>T(x)</math>的闭合形式。


:<math>P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}.</math>
注意:只需解生成函数的闭合形式,无需展开。


In our case, "Raining on Sunday" is event A, and "Raining on Monday" is event B.
== Problem 7 ==
* P(''B|A'') = 0.10 = Probability of it raining on Monday, if it rained on Sunday.
Let <math>a_n</math> be a sequence of numbers satisfying the recurrence relation:
* P(''A'') = 0.40 = Probability of Raining on Sunday.
:<math>p a_n+q a_{n-1}+r a_{n-2}=0</math>
* P(''B'') = 0.52 = Probability of Raining on Monday.
with initial condition <math>a_0=s</math> and <math>a_1=t</math>, where <math>p,q,r,s,t</math> are constants such that <math>{p}+q+r=0</math>, <math>p\neq 0</math> and <math>s\neq t</math>. Solve the recurrence relation.
 
So, to calculate the probability it rained on Sunday, given that it rained on Monday:
:<math>P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}.</math>
or:
:<math>P(A|B) = \frac{0.10*0.40}{0.52} = .0769</math>
In other words, if it rained on Monday, there's a 7.69% chance it rained on Sunday.
 
== Intuitive explanation ==
 
To calculate the probability of it having rained on Sunday, given that it rained on Monday, we can take the following steps:
* We know that it rained on Monday. Therefore, the total probability is P(B).
* The probability it rained on Sunday is P(A).
* The probability it rained on Monday, given that it rained on Sunday is P(B|A).
* The probability of raining on Sunday AND raining Monday is P(A)*P(B|A).
* Therefore, the total probability of it having rained on Sunday, given that it rained on Monday, is the chance of it raining on Sunday and Monday divided by the total chance of it having rained on Monday.
Therefore,
:<math>P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}.</math>
 
Another way to see this, which shows where Bayes' theorem comes from, is to consider the probability P(AB) that it rains on both Sunday and Monday.  This can be calculated in two different ways, which give the same answer for P(AB):
:<math>P(A)\, P(B|A) = P(B)\, P(A|B)</math>
Bayes' theorem is just another way to write that equation.
 
[[Category:Mathematics]]

Revision as of 13:14, 17 September 2017

  • 每道题目的解答都要有完整的解题过程。中英文不限。

Problem 1

  1. [math]\displaystyle{ k }[/math]种不同的明信片,每种明信片有无限多张,寄给[math]\displaystyle{ n }[/math]个人,每人一张,有多少种方法?
  2. [math]\displaystyle{ k }[/math]种不同的明信片,每种明信片有无限多张,寄给[math]\displaystyle{ n }[/math]个人,每人一张,每个人必须收到不同种类的明信片,有多少种方法?
  3. [math]\displaystyle{ k }[/math]种不同的明信片,每种明信片有无限多张,寄给[math]\displaystyle{ n }[/math]个人,每人收到[math]\displaystyle{ r }[/math]张不同的明信片(但不同的人可以收到相同的明信片),有多少种方法?
  4. 只有一种明信片,共有[math]\displaystyle{ m }[/math]张,寄给[math]\displaystyle{ n }[/math]个人,全部寄完,每个人可以收多张明信片或者不收明信片,有多少种方法?
  5. [math]\displaystyle{ k }[/math]种不同的明信片,其中第[math]\displaystyle{ i }[/math]种明信片有[math]\displaystyle{ m_i }[/math]张,寄给[math]\displaystyle{ n }[/math]个人,全部寄完,每个人可以收多张明信片或者不收明信片,有多少种方法?

Problem 2

Find the number of ways to select [math]\displaystyle{ 2n }[/math] balls from [math]\displaystyle{ n }[/math] identical blue balls, [math]\displaystyle{ n }[/math] identical red balls and [math]\displaystyle{ n }[/math] identical green balls.

  • Give a combinatorial proof for the problem.
  • Give an algebraic proof for the problem.

Problem 3

  • 一个长度为[math]\displaystyle{ n }[/math]的“山峦”是如下由[math]\displaystyle{ n }[/math]个"/"和[math]\displaystyle{ n }[/math]个"\"组成的,从坐标[math]\displaystyle{ (0,0) }[/math][math]\displaystyle{ (0,2n) }[/math]的折线,但任何时候都不允许低于[math]\displaystyle{ x }[/math]轴。例如下图:
   /\
  /  \/\/\    /\/\
 /        \/\/    \/\/\
 ----------------------
长度为[math]\displaystyle{ n }[/math]的“山峦”有多少?
  • 一个长度为[math]\displaystyle{ n }[/math]的“地貌”是由[math]\displaystyle{ n }[/math]个"/"和[math]\displaystyle{ n }[/math]个"\"组成的,从坐标[math]\displaystyle{ (0,0) }[/math][math]\displaystyle{ (0,2n) }[/math]的折线,允许低于[math]\displaystyle{ x }[/math]轴。长度为[math]\displaystyle{ n }[/math]的“地貌”有多少?

Problem 4

李雷和韩梅梅竞选学生会主席,韩梅梅获得选票 [math]\displaystyle{ p }[/math] 张,李雷获得选票 [math]\displaystyle{ q }[/math] 张,[math]\displaystyle{ p\gt q }[/math]。我们将总共的 [math]\displaystyle{ p+q }[/math] 张选票一张一张的点数,有多少种选票的排序方式使得在整个点票过程中,韩梅梅的票数一直高于李雷的票数?等价地,假设选票均匀分布的随机排列,以多大概率在整个点票过程中,韩梅梅的票数一直高于李雷的票数。

Problem 5

A [math]\displaystyle{ 2\times n }[/math] rectangle is to be paved with [math]\displaystyle{ 1\times 2 }[/math] identical blocks and [math]\displaystyle{ 2\times 2 }[/math] identical blocks. Let [math]\displaystyle{ f(n) }[/math] denote the number of ways that can be done. Find a recurrence relation for [math]\displaystyle{ f(n) }[/math], solve the recurrence relation.

Problem 6

  • [math]\displaystyle{ s_n }[/math]表示长度为[math]\displaystyle{ n }[/math],没有2个连续的1的二进制串的数量,即
    [math]\displaystyle{ s_n=|\{x\in\{0,1\}^n\mid \forall 1\le i\le n-1, x_ix_{i+1}\neq 11\}| }[/math]
[math]\displaystyle{ s_n }[/math]
  • [math]\displaystyle{ t_n }[/math]表示长度为[math]\displaystyle{ n }[/math],没有3个连续的1的二进制串的数量,即
    [math]\displaystyle{ t_n=|\{x\in\{0,1\}^n\mid \forall 1\le i\le n-2, x_ix_{i+1}x_{i+2}\neq 111\}| }[/math]
    1. 给出计算[math]\displaystyle{ t_n }[/math]的递归式,并给出足够的初始值。
    2. 计算[math]\displaystyle{ t_n }[/math]的生成函数[math]\displaystyle{ T(x)=\sum_{n\ge 0}t_n x^n }[/math],给出生成函数[math]\displaystyle{ T(x) }[/math]的闭合形式。

注意:只需解生成函数的闭合形式,无需展开。

Problem 7

Let [math]\displaystyle{ a_n }[/math] be a sequence of numbers satisfying the recurrence relation:

[math]\displaystyle{ p a_n+q a_{n-1}+r a_{n-2}=0 }[/math]

with initial condition [math]\displaystyle{ a_0=s }[/math] and [math]\displaystyle{ a_1=t }[/math], where [math]\displaystyle{ p,q,r,s,t }[/math] are constants such that [math]\displaystyle{ {p}+q+r=0 }[/math], [math]\displaystyle{ p\neq 0 }[/math] and [math]\displaystyle{ s\neq t }[/math]. Solve the recurrence relation.