#"Name"#
#p = P["head"]#
#"Then we have"#
#P["A wins"] = p + p(1-p)^2 + p(1-p)^4 + ...#
#= p/(1-(1-p)^2)#
#"(geometric series with ratio (1-p)²)"#
#= p/(2 p - p^2)#
#= 1/(2 - p)#
#P["B wins"] = p(1-p) + p(1-p)^3 + p(1-p)^5 + ...#
#= p(1-p)/(1-(1-p)^2)#
#= (1-p)/(2-p)#
#"Note that "P["A wins"] + P["B wins"] = 1", as should."#
#"Now if "P["A wins"] = P["B wins"]", then"#
#1/(2-p) = (1-p)/(2-p)#
#=> 1 = 1 - p#
#=> p = 0#
#"Note that the ratio in the geometric series becomes 1 then,"#
#"so strictly speaking we do not have convergence. We have"#
#"to take the limit "p->0" as such."#
#"The theory of geometric series is simple :"#
#(1+x+x^2+x^3+...+x^n)(1-x) = 1-x^(n+1)#
#=> 1+x+x^2+x^3+...+x^n = (1-x^(n+1))/(1-x)#
#"So if "n->oo" and "|x| < 1" then we get"#
#=> 1+x+x^2+x^3+... = 1/(1-x)#
#"We must have "|x| < 1" for convergence as such."#
#"Here we have the ratio "x = (1-p)^2" and "p=0", so"#
#"strictly speaking we have no convergence, so we must"#
#"take the limit "p->0"."#