How can i complete finding the conditional probability function? (details inside)

we toss a regular coin 50 times:

X - the number of heads from 50 tosses.

Y - the number of heads from the first 20 tosses.

1) find the conditional probability function of Y if given that X=i for {i=0,...,50}, and the conditional probability function of X if given Y=j so that {j=0,...,20}

2) calculate #E[X∣Y=j]#

so i tried to connect X and Y by another variable, #Z=X-Y#, and then to calculate #P_{X|Y}(x | y) =\frac{P_{XY}{(x,y)}}{p_Y(y)}# and #P_{Y|X}(y| x) =\frac{P_{XY}{(x,y)}}{p_X(X)}#. to calculate #P_{X,Y}(x,y)# i used #P_{X,Y}(x,y)=P_{Z}(x-y)\cdot P_Y(y)# - but i don't know how to continue from here.

for2) # E[X∣Y=j]# : #E(X|Y=j)= E(Z+Y| Y=j)# but i don't know how to continue. would really appreciate your help with it.

thank you very much for your help

1 Answer
Jun 19, 2018

#"1a) "P("Y=k|X=i") = { ((C(i,k) C(50-i, 20-k)) / (C(50,20)), if k<= i), (0, if k>i) :}#

#"1b) "P("X=k|Y=j") = { ((C(30, k-j)) / 2^30, if k >= j), (0, if k < j) :}#

#"2) "E[ X |Y = j ] = j + 15#

Explanation:

#"1a) "#
#P("Y=k|X=i") = 0, if k > i#
#P("Y=k|X=i") = (C(i,k)*20*19*...*(21-k)*30*29*...*(31-(i-k)))/(50*49*...*(51-i)), if k <= i#
#= C(i,k) (((20!)/((20-k)!)) ((30!)/((30-i+k)!))) / ((50!)/((50-i)!)), if k <= i#
#= { ((C(i,k) C(50-i, 20-k)) / (C(50,20)), if k<= i), (0, if k>i) :}#

#"1b) "#
#P("X=k|Y=j") = 0, if k < j#
#P("X=k|Y=j") = P("k-j times head in the last 30 tosses")#
#= { ((C(30, k-j)) / 2^30, if k >= j), (0, if k < j) :}#

#"2) "#
#E[ X | Y = j ] = (j*C(30,0) + (j+1)*C(30,1) + ... + (j+30)*C(30,30))/2^30#
#= j + (C(30,1) + 2*C(30,2) + ... + 30*C(30,30))/2^30#
#= j + (30*(1 + C(30,1) + ... + C(30,14)) + 15*C(30,15))/2^30#
#= j + (30*(2^30/2 - (C(30,15))/2) + 15*C(30,15))/2^30#
#= j + (15*(2^30 - C(30,15)) + 15*C(30,15))/2^30#
#= j + 15#

#"This is a very logical result as we certainly have j head"#
#"tosses and can expect half of the remaining 30 tosses"#
#"to give head on average."#