Probability expect Detailed knowledge points and topics

Basics

Desired linear properties

\ (E (X + Y)
= E (X) + E (Y) \) Proof:

\(E(X + Y) = \sum\limits_i\sum\limits_jP(X=i \&\& Y=j)(i+j)\)
\(= \sum\limits_i\sum\limits_jP(X=i \&\& Y=j)i + \sum\limits_i\sum\limits_jP(X=i \&\& Y=j)j\)
\(=\sum\limits_ii\sum\limits_jP(X=i\&\&Y=j)j+\sum\limits_ij\sum\limits_jP(X=i\&\&Y=j)i\)
\(=\sum\limits_iP(X=i)i+\sum\limits_jP(Y=j)j\)
\(=E(x) + E(Y)\)

Prefix and skills

Of n random variables X [1 ... n], each random variable is a random integer, seeking Max (X [1 ... n]) from a desired 1 ... S

solution

\(E(Y)=\sum\limits_{i=1}^SP(Y=i)i=\sum\limits_{i=1}^Si(P(Y\le i) - P(Y \le i - 1))=i({\frac{i}{S}}^n-{\frac{(i-1)}{S}}^n)\)

Small Conclusions

Probability \ (p \) events expected \ (\ frac {1} { p} \) occurs later. The coin toss, throw positive probability \ (\ frac {1} { 2} \) after a desired polishing occurs twice.

Take the ball game

Take 1 ball game

It is in the box \ (n \) balls \ (the n-1 ... \) , you want to get in \ (m \) times the ball, not later took back, seeking out the figures and expectations.

solution

\(E(\sum\limits_{i=1}^nX_i)=\sum\limits_{i=1}^nE(X_i)=\sum\limits_{i=1}^nP(X=i)i=\sum\limits_{i=1}^n\frac{m}{n}\times i=\frac{m}{n}\sum\limits_{i=1}^ni=\frac{m}{n}\times \frac{n(n+1)}{2}=\frac{m(n+1)}{2}\)

Take Ball Game 2

It is in the box \ (n \) balls \ (the n-1 ... \) , you want to get in \ (m \) times the ball, took the back, seeking out the figures and expectations.

solution

Probability to take each ball are \ (\ {n-FRAC {m}} \) , so the answer is still \ (\ sum \ limits_ {i = 1} ^ n \ frac {m} {n} i = \ frac {m (n + 1) } {2} \)

Take the ball 3 game

Submenu ⾥ sub tank has n balls. 1 ... n, m you want to take the time ⾥ ball surface, the probability p1 is took back to back two and the probability p2, this same ball, seeking extracted digital and expectations of

solution
is still \ (\ sum \ limits_ {i = 1} ^ n \ frac {m} {n} i = \ frac {m (n + 1)} {2} \)

These three questions can be considered all n balls are faced with the same case, the probability of being selected is \ (\ frac {m} { n} \)

Migration issues

Walk Question 1

Random walk on a chain of n points, find the end of the period walked across a desired number of steps

solution
\ (E (S) = \ sum \ limits_ {i = 1} ^ {n-1} E (X_i) \)

\ (X_i \) represents the first arrival from I \ (. 1 + I \) a desired number of steps.

Because \ (\ frac {1} { 2} \) probability directly from \ (I \) come \ (. 1 + I \) , there are \ (\ frac {1} { 2} \) probability will back \ (. 1-I \) , so \ (X_i = \ frac {1 } {2} + \ frac {1} {2} \ times (1 + X_ {i-1} + X_i) = 2 + X_ {i-1} \)

Walk Question 2

In one \ (n-\) on a fully walk FIG points, find the desired number of steps from one point to another.

solution
because it is a complete graph. Regardless of the current at which point, the probability of reaching the target point are \ (\ {FRAC. 1. 1-n-} {} \) , so the probability \ (\ {FRAC. 1. 1-n-} {} \) , the probability of \ (P \) of the desired event \ (\ frac {1} { p} \) after the occurrence times. Therefore, a desired number of steps to reach the target point \ (n-1 \)

Walk Question 3

On complete bipartite graph a 2n-point walk, go find a desired number of steps from one point to another point

solution

It is divided into two different sides of the same side and discussed.
A represents a desired number of steps located on different sides, B represents a desired number of steps located in the same side.
\ (B = 1 + A \ )

\(A=\frac{1}{n}+\frac{n-1}{n}B\)

Solving equations

\(A=\frac{1}{n}+\frac{n-1}{n}(1+A)\)

\(\frac{1}{n}A=\frac{1}{n}+\frac{n-1}{n}\)

\(A=1+n-1 = n\)

\(B=n+1\)

Walk Question 4

N in a daisy FIG migration points, find the desired number of steps walked from one point to another point ⾛.

solution

1. Leaf -> Center: 1
2. Leaf -> B + 1 = Leaf A
3. Center -> Leaf \ (B = \ frac {1 } {n-1} + \ frac {n-2} {n- 1} (A + 1) \ )

Solutions of the equation
\ (B = \ frac {1 } {n-1} + \ frac {n-2} {n-1} (B + 2) \)

\(B=\frac{1}{n-1}+\frac{n-2}{n-1}B+\frac{2(n-2)}{n-1}\)

\(\frac{1}{n-1}B=\frac{1}{n-1}+\frac{2(n-2)}{n-1}\)

\ (B = 1 + 2n-2 = 2n-1 \)

Walk Question 5

In a tree walk n points, Q x the number of steps walked desirable from the root

solution

Provided come from x y, y is the root places

Set \ (f [x] \) represents a first come (X \) \ a desired number of steps.

\ (F [x] = \ frac {1} {d [x]} + \ frac {1} {d [x]} \ sum \ limits_ {y son of x} (1 + f [y] + f [x]) \)

Walk Question 6

A configuration of 200 points undirected graph, so that the above come from the random walk T S of a desired number of steps $ \ ge $ 1000000

solution

Similar to the first question. In the chain, \ (= x_2. 1 \) so that the total number of steps \ (n ^ 2 \) level. Just let \ (x_2 = n \) can reach \ (n ^ 3 \) level of. Therefore, in the beginning with \ (100 \) points out a connected undirected complete graph, then \ (100 \) points out a connected chain.

Classic problem

Classic Question 1

Each time a random [1, n] is an integer, we can ask several desirable number of all Couchu

solution
\(S=\sum\limits_{i=1}^nX_i\)

\ (S \) represents the total number. \ (X_i \) represents the hands have now \ (i-1 \) digits. Has been taken to continue to take the first \ (i \) the number of steps required for digital

\(E(S) = \sum\limits_{i=1}^nE(X_i)\)

\(P(X_i)=\frac{n-i+1}{n}\)

\(E(x_i)=\frac{n}{n-i+1}\)

\(E(S)=\sum\limits_{i=1}^n\frac{n}{n-i+1}=\sum\limits_{i=1}^n\frac{n}{i}\)

Question 2 Classic

A random permutation of length n p, the i-th digit of Q before P [i] is the probability of the maximum number.

solution

Before i digits, the greatest probability of each number are the same. Therefore, p [i] is the probability that the maximum number is \ (\ frac {1} { i} \)

Question 3 Classic

Pray to the square of the number i in question.

solution

Set \ (X_i \) represents the \ (i \) number is (1) is not (0) before the i-th maximum digit number.

\(E(S) = \sum\limits_{i=1}^nE(X_i)\)

$E(S^2)=\sum\limits_{i=1}^nE(X_i^2) \
=\sum\limits_{i!=j}E(X_i且X_j)+\sum\limits_{i=1}^nE(X_i)^2 \
=\sum\limits_{i!=j}\frac{1}{ij}+\sum\limits_{i=1}^n{\frac{1}{i}}^2
$

Classic Question 4

A random permutation of length n p, the probability Q i j of the back

solution

Since i and j is equivalent to, and in front of i or j, i or j in the front (except i = j), the probability \ (\ frac {1} { 2} \)

5 classic problem

A random permutation of length n p, find it contains w [1 ... m] as a probability sequence

solution

Total w \ (m! \) species arrangement. Only one of which meet the conditions.

Therefore, the answer is \ (\ frac {1} { m!} \)

Question 6 Classic

A random permutation of length n p, find it contains w [1 ... m] as the probability of a continuous sequence.

solution

all cases of total w \ (C (_n ^ m) m! \) species, the total of the n \ (n-m + 1 \ ) permutations. Therefore, the answer is \ (\ frac {n-m + 1} {C (_n ^ m) m!} \)

7 classic problem

N-stack stone, the number of the i-th stack A [i], each time a stone is then randomly selected whole heap that are thrown, first find the desired stack of several stones thrown.

solution

\ (A [i] \) represents \ (I \) stack is many times desirable stones thrown.

\(A[1]=\sum\limits_{i=1}^n[A[i]\le A[1]]\)

\ (E (A [1]) = \ sum \ limits_ {i = 1} ^ E ([A [i] \ le A [1]) \)

\ (E (A [p] \ A [1]) = P (A [p] \ A [1]) \)

\ (E (A [1]) = 1 + \ sum \ limits_ {i = 2} 'NP (A [i] \ le A [1]) \)

\(P(A[i] \le A[1]) = \frac{a[i]}{a[i]+a[1]}\)

Question 8 Classic

A random sequence of length n is 01, each location probability is 1 p, defined and x is the square of the length of each continuous and 1. Seeking \ (E (x) \)

solution

\ (f [i] \) represents the i-th before the answer. \ (G [i] \) represents the number of i 1 of the ending.

If the first \ (i + 1 \) a 1, then the \ (G [I + 1] = G [I] + 1 \) , \ (F [I + 1] = F [I] - G [I] + 2 ^ (G [I] + 1'd) ^ 2 = F [I] + 2g [I] + 1'd \) ,

Ina则\ (G [I Tasu 1] = 0 \) , \ (F [I Tasu 1] = F [I] \)

\(f[i+1] = f[i]+ \frac{1}{2}(2g[i]+1)\)
\(g[i+1] = \frac{1}{2}g[i]\)

Classic Question 9

To a sequence, each random delete an element, ask the i-th and j-th adjacent probability in the process

solution

Remove all elements in accordance with a permutation order composition.

i and j from i to j corresponding to adjacent this \ (j-i + 1 \ ) sequence element consisting of, i and j on the last. This \ (ji + 1 \) all possible sequences of elements consisting of a total of \ ((ji + 1)! \) Species, which satisfies the condition of total \ (2 (ji-1) ! \) Species . Therefore, the answer is \ (\ frac {2 (ji -1)!} {(Ji + 1)!} = \ Frac {2} {(ji + 1) (ji)} \)

Exercises

Exercises

Given n coins, coins of the i-th value of W [i], each random removal of a coin, the value obtained as the product of the value of the left and right of the coin, the total value of the desired requirements.

solution

Two coins have value, and only when all the numbers between those two numbers, the last two figures were removed. This probability can be known by the classic question 9. Therefore, the answer to this question is \ (\ sum \ limits_ {i = 1} ^ {n-2} \ sum \ limits_ {j = i + 2} ^ n \ frac {2w [j] w [i]} {( ji + 1) (ji)} \)

Exercise 2

There are N number of a [1 ... N], the probability for one of two numbers each other, then combined into a new put back number, proceeds to give the new value of the number of expected demand of the total revenue

solution

\ (S = X_ia_i \)

\ (X_i \) represents the number of i-th number generator contribution.

\ (E (S) = \ sum \ limits_ {i = 1} ^ E (X_i) a_i \)

\(E(X_i)=P(X_i)=\sum\limits_{i=2}^n\frac{2}{i}\)

\(E(S)=\sum\limits_{i=2}^n\frac{2}{i}\sum\limits_{j=1}^na_i\)

Exercise 3

Given a number of columns of W [1 ... N], randomly a permutation H, if H [i] ratio of H [i-1] and H [i + 1] is larger, is obtained W [i] proceeds, seeking expected revenue

solution

\(E(S)=\sum\limits_{i=1}^nP(H[i]>H[i-1]\&\&H[i]>H[i+1])W[i]\)

Since \ (H [i], H [i-1], H [i + 1] \) of the three digital equivalent, and there must be a maximum. So \ (H [i] \) the greatest probability is \ (\ FRAC {. 1} {. 3} \) , so the answer is \ (\ frac {1} { 3} \ sum \ limits_ {i = 1} ^ nw [I] \)

Exercise 4

codeforces280C

Given a tree, at the beginning of each point are white, a white point every election his son Juri all points Black, Black beg expect several entire tree

solution

For a point \ (x \) , only when \ (x \) and all of its ancestors \ (x \) the first to be black. \ (x \) will generate contributions. Probability \ (\ frac {1} { dep_i} \)

\(E(S)=\sum\limits_{i=1}^nE(X_i)\)

\ (X_i \) represents the \ (I \) a desired number of operating points are dyed black.

\(E(X_i)=\frac{1}{dep[i]}\)

\(E(S)=\sum\limits_{i=1}^n\frac{1}{dep[i]}\)

Homework

In other classrooms

noip2016

solution

\ (f [i] [j ] [0/1] \) represents the i-th period before, is (1) No (0) application, desirable to minimize the cost of the physical.
Then transfer to vigorously discuss classification.

DETAILED transfer equation as follows

\(f[i + 1][j][0] = min(f[i][j][0] + dis[c[i]][c[i + 1]],\\f[i][j][2] + dis[d[i]][c[i + 1]] * K[i] + dis[c[i]][c[i + 1]] * (1 - K[i]))\)

\(f[i + 1][j + 1][3] = min(\\f[i][j][0] + \\dis[c[i]][d[i + 1]] * K[i + 1] + \\dis[c[i]][c[i + 1]] * (1 - K[i + 1]),\\f[i][j][4] + \\dis[d[i]][d[i + 1]] * K[i] * K[i + 1] + \\dis[d[i]][c[i + 1]] * K[i] * (1 - K[i + 1]) + \\dis[c[i]][d[i + 1]] * (1 - K[i]) * K[i + 1] + \\dis[c[i]][c[i + 1]] * (1 - K[i]) * (1 - K[i + 1]))\)

Cross section

A method for generating a random interval is defined as follows. \ (L = Random (. 1, N), R & lt Random = (L, N) \) . In this way two random intervals, and asked the two intersecting probability interval. \ (N \ le 1000000 \)

solution

The problem of negation, into seeking the probability interval does not intersect.

I.e. the need for a section smaller than the left end of the right end point of another section.

With \ (F [i] \) represents the right end of the interval i is less than or equal probability

\(ans=\frac{1}{n}\sum\limits_{i=1}^{n - 1}f[i]\)

\ (g [i] \) represents the right end as \ (I \) of the probability interval.

\(f[i]=\sum\limits_{j=1}^ig[i]\)

\(g[i]=\frac{1}{n} \sum\limits_{l=1}^n\frac{1}{n-l+1}\)

collect stamps

luogu4550

There are the n-( \ (the n-\ Le 10000 \) ) different stamps, Pippi would like to collect all kinds of stamps. The only way is to collect Fanfan students to buy, you can only buy one, buy stamps and exactly what kind of stamps n is an equal probability, the probability of both 1 / n. However, due to Fanfan also like stamps, so Pippi purchase stamps to pay the k-k dollars.
Now Pippi did not have a stamp, Pippi want to know all kinds of money to get the number of stamps it takes expectations.

solution

With \ (f [i] \) represents the hands have now \ (I \) stamps, to take \ (n-\) number of steps required sheets. There \ (\ frac {ni} { n} \) probability to get a new stamp. It is desirable to take \ (\ frac {n} { ni} \) times. So \ (f [i] = f [i + 1] + \ frac {n} {ni} \)

With \ (g [i] \) represents the hands have now \ (I \) stamps. Take to \ (n \) Qian Zhang needed to take. Every time the price is still made here from the beginning to remember. +1 as long as it takes time to take back all will be able to take to ensure that meet the meaning of the questions. There \ (\ frac {i} { n} \) probability have been taken to stamp. There \ (\ frac {ni} { n} \) probability to get a new stamp. So \ (g [i] = \ frac {i} {n} (g [i] + f [i] +1) + \ frac {ni} {n} (g [i + 1] + f [i + 1] +1) = \ frac { i (f [i] +1)} {ni} + f [i + 1] + g [i + 1] +1 \)

Puzzles

CF696B

solution

After a node x with his brother randomly arranged, of any other brother y, x y probability are both in front of \ (\ FRAC. 1} {2} {\) , if \ (x \) in \ ( y \) back, then access to the full trees \ (y \) after sub-tree will be accessible \ (x \) node. With \ (SIZ [i] \) represents the size of i in the subtree rooted. \ (ANS [X] = ANS [FA] +1+ \ FRAC. 1} {2} {(SIZ [FA] -siz [X] -. 1) \) , ( \ (FA \) represents \ (X \) father)

Bad Luck Island

CF540D

厄运岛上居住着三种物种:Rock、Scissors和Paper。在某些时刻,两个随机的个体相遇(所有的个体都可以平等地相遇),如果他们属于不同的物种,那么一个个体杀死另一个:Rock杀死Scissors,Scissors杀死Paper,Paper杀死Rock。你的任务是为每一个物种确定在足够长的时间之后,这个物种将是唯一居住在这个岛上的物种的概率。

solution

\(f[i][j][k]\)表示还剩下i个Rock,j个Scissors,k个Paper的概率。然后枚举两个物种,计算相遇的概率转移即可。计算概率时注意减去相同的两个物种相遇的情况。

Fish

有n条鱼,每天会有两条鱼相遇,任意两条鱼相遇的概率都是相同的。两条鱼i,j相遇之后,会有\(a[i][j]\) 的概率i吃掉j,有\(1-a[i][j]\)的概率j吃掉i。对于每条鱼x,问最后剩下x的概率。

\(1\le n\le 18\)

solution

状压一下。枚举当前状态下相遇的两条鱼,计算概率,然后转移即可。

Guess you like

Origin www.cnblogs.com/wxyww/p/11372508.html