Heads-Minus-Tails Distribution

Author

Eric W. Weisstein
September 14, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Statistics/Heads-Minus-TailsDistribution.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Heads-Minus-TailsDistribution.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Initialization

<<Statistics`

h[k_]:=Piecewise[{{(1/(2^(2n)))Binomial[2n,n],k==0},{2(1/(2^(2n)))Binomial[2n,n+k/2],Mod[k,2]==0}},0]

Values

Table[h[k],{k,0,10}]//Column//TraditionalForm

Plot

BarChart[Table[h[k,50],{k,0,35}],BarGroupSpacing->0,PlotRange->All,Ticks->None]

Total[Table[h[k,50],{k,0,100}]]//N

Simulation

HeadsTails[n_]:=Table[2Random[Integer,{0,1}]-1,{n}]
HeadsMinusTails[n_]:=Abs[Plus@@HeadsTails[n]]

h=BinCounts[Table[HeadsMinusTails[100],{10000}],{-1,30,1}]

BarChart[h,BarGroupSpacing->0,PlotRange->All,Ticks->None]

Moments

Normalization

sum=Sum[h[k],{k,0,2n}]

InputForm[sum=Sum[h[k],{k,0,2n}]]

Table[sum,{n,20}]

h[2k]

sum=Sum[h[2k],{k,0,n}]

(2^(-2n))Binomial[2n,n]+Sum[(2^(1-2 n)) Binomial[2 n,k+n],{k,∞}]

FullSimplify[%,n>0]

Table[(2^(-2 n)) Binomial[2 n,n]+(2^(1-2 n)) Binomial[2 n,1+n] Hypergeometric2F1[1-n,1,2+n,-1]/.n->RandomComplex[],{100}]-1//Chop//Union

Table[(2^(-2 n)) Binomial[2 n,n]+(2^(1-2 n)) Binomial[2 n,1+n] Hypergeometric2F1[1-n,1,2+n,-1]/.n->RandomInteger[{0,10}],{100}]-1//Chop//Union

FunctionExpand[(4^(-n)) (Binomial[2 n,n]+2 Binomial[2 n,1+n] Hypergeometric2F1[1,1-n,2+n,-1])]//FullSimplify

Table[((Gamma[(1/2)+n] (1+n+2 n Hypergeometric2F1[1,1-n,2+n,-1]))/((Sqrt[π]) Gamma[2+n]))/.n->RandomComplex[],{100}]-1//Chop//Union

Table[((Gamma[(1/2)+n] (1+n+2 n Hypergeometric2F1[1,1-n,2+n,-1]))/((Sqrt[π]) Gamma[2+n]))/.n->RandomInteger[{0,10}],{100}]-1//Chop//Union

Mean

Sum[p[k]k,{k,0,2n}]

Sum[(2^(1-2 n)) Binomial[2 n,k+n]2k,{k,n}]

Table[(2^(1-2 n)) (1+n) Binomial[2 n,1+n],{n,0,10}]

FullSimplify[%,n∈Integers&&n>0]

Table[((2 Gamma[(1/2)+n])/((Sqrt[π]) Gamma[n])),{n,0,10}]

FullSimplify[Subtract@@{((2 Gamma[(1/2)+n])/((Sqrt[π]) Gamma[n])),((n Binomial[2n, n])/(2^(2n-1)))},n∈Integers]

GeneratingFunction[((n Binomial[2n, n])/(2^(2n-1))),n,x]

SeriesCoefficient[(x/(((1-x))^(3/2))),{x,0,n}]

FullSimplify[-(((-1))^n) Binomial[-(3/2),-1+n],n∈Integers&&n>0]

Table[-(((-1))^n) Binomial[-(3/2),-1+n],{n,0,10}]

FullSimplify[FunctionExpand[-(((-1))^n) Binomial[-(3/2),-1+n]],n>0&&n∈Integers]

Table[((2 (((-1))^n) (Sqrt[π]))/(Gamma[(1/2)-n] Gamma[n])),{n,0,10}]

Moment

Sum[p[k](k^p),{k,0,2n}]

Sum[(2^(1-2 n)) Binomial[2 n,k+n](((2k))^p),{k,n}]