半个正面
Half Heads
题目详情
设随机变量 只取 或 ,且各以 的概率发生(可理解为一次公平抛硬币:反面为 0,正面为 1)。
你需要用独立同分布的 (可多次调用)构造新随机变量 ,使得 只取 或 ,且各以 的概率发生。
请给出 关于 的构造方式。
Let be a random variable that takes value 0 or 1 with 50% probability each. You need to define a new random variable as a function of , such that has the value 1 with 25% probability and 0 otherwise.
Hint
Use as an independent copy of .
解析
取两个独立样本 ,令 + + + +因为 ,所以 以 概率取 ,以 概率取 。
Original Explanation
where is an independent copy of
Solution
Given is a random variable such that .
These mathematical entities typically represent a real world concept. For example, this can take value 0 or 1 based on the outcome of a coin toss, say Tails representing 0 and Heads represeting 1. But we can toss this coin again, and get another sample independent of the first outcome. Let take the value 0 or 1 based on this second toss, independent of the first toss. This is the concept of an independent copy.
Let be an independent copy of . It has the same probability distribution as but the value may or may not be the same.
Thus,
Also, we can imagine if one coin-toss has probability of 1/2 for a heads, then the probability will be 1/4 for both coins to show up heads.
Hence, we can define = 1 if both and are 1, and 0 otherwise.
We can also use product operator to simplify this relationship.
This way, if both and are 1 then will be 1, otherwise zero.
This is not the same as because can take the value 0 or 1 with probability 50% each.
Programming Variant
Following is the programming version of this question:
Function f1() returns true or false with 50% probability each, define function f2() that can return true with 25% probability, and false otherwise. You may use the function f1.
This can be answered using the and gate.
def f2():
return f1() and f1()