The algebraic equation satisfied by the Probability Generating Function of L\ ife in a Casion where the stakes are from, -1, to , 1 By Shalosh B. Ekhad Theorem: Let a(n) be probability that you exit after EXACTLY n rounds in a \ casino where in each turn The probability that you win, 1, dollars is, p[1] The probability that you lose, 1, dollars is, p[-1] and the probability that you neither win nor lose is, p[0] Of course the probabilities have to add-up to 1, in other wrods p[-1] + p[0] + p[1] = 1 We also assume that the Casino stays in business, in other words, the expect\ ed gain in one round is negative: -p[-1] + p[1] < 1 Let X(t) be the ordinary generating function of that sequence, in other word\ s infinity ----- \ n X(t) = ) a(n) t / ----- n = 0 X(t) satisifies the algebraic equation 2 p[1] t X(t) + (t p[0] - 1) X(t) + p[-1] t = 0 and in Maple notation p[1]*t*X(t)^2+(t*p[0]-1)*X(t)+p[-1]*t = 0 Or more usefully (for computing many terms) 2 X(t) = p[1] t X(t) + p[0] t X(t) + p[-1] t and in Maple notation X(t) = p[1]*t*X(t)^2+p[0]*t*X(t)+p[-1]*t This took, 0.025, seconds. The algebraic equation satisfied by the Probability Generating Function of L\ ife in a Casion where the stakes are from, -2, to , 2 By Shalosh B. Ekhad Theorem: Let a(n) be probability that you exit after EXACTLY n rounds in a \ casino where in each turn The probability that you win, 1, dollars is, p[1] The probability that you win, 2, dollars is, p[2] The probability that you lose, 1, dollars is, p[-1] The probability that you lose, 2, dollars is, p[-2] and the probability that you neither win nor lose is, p[0] Of course the probabilities have to add-up to 1, in other wrods p[-2] + p[-1] + p[0] + p[1] + p[2] = 1 We also assume that the Casino stays in business, in other words, the expect\ ed gain in one round is negative: -2 p[-2] - p[-1] + p[1] + 2 p[2] < 1 Let X(t) be the ordinary generating function of that sequence, in other word\ s infinity ----- \ n X(t) = ) a(n) t / ----- n = 0 X(t) satisifies the algebraic equation 3 3 3 3 2 2 2 2 p[-1] t + p[-2] t - 2 p[-1] t - 2 p[-2] t 3 2 3 2 2 2 5 3 2 + (t p[0] p[2] + 3 t p[1] p[2] - t p[2] ) X(t) + (-t p[-2] p[2] 3 3 2 3 + t p[-1] p[1] p[2] + 3 t p[-1] p[2] + 2 t p[0] p[1] p[2] 3 2 3 2 2 2 2 4 + 2 t p[0] p[2] + 3 t p[1] p[2] - 2 t p[1] p[2] - 2 t p[2] ) X(t) 3 3 2 3 + (-2 t p[-2] p[0] p[2] + t p[-2] p[1] + 2 t p[-2] p[1] p[2] 3 2 3 2 3 + 8 t p[-2] p[2] + t p[-1] p[2] + 2 t p[-1] p[0] p[2] 3 2 3 3 2 3 2 + t p[-1] p[1] + 4 t p[-1] p[1] p[2] + 2 t p[0] p[2] + t p[0] p[1] 3 3 3 2 2 + 4 t p[0] p[1] p[2] + t p[1] + 2 t p[-2] p[2] - 2 t p[-1] p[2] 2 2 2 2 3 - 4 t p[0] p[2] - t p[1] - 4 t p[1] p[2] + 2 t p[2]) X(t) + ( 3 2 3 3 -t p[-2] p[2] + t p[-2] p[-1] p[1] + 2 t p[-2] p[-1] p[2] 3 3 3 + 2 t p[-2] p[0] p[1] + 12 t p[-2] p[0] p[2] + 8 t p[-2] p[1] p[2] 3 2 3 2 3 - 4 t p[-2] p[2] + t p[-1] p[1] + 3 t p[-1] p[0] p[1] 3 3 2 3 + 4 t p[-1] p[0] p[2] + t p[-1] p[1] + t p[-1] p[1] p[2] 3 2 3 2 3 2 2 + 2 t p[0] p[1] + t p[0] p[2] + 2 t p[0] p[1] - 2 t p[-2] p[1] 2 2 2 2 - 12 t p[-2] p[2] - 3 t p[-1] p[1] - 4 t p[-1] p[2] - 4 t p[0] p[1] 2 2 2 2 3 2 - 2 t p[0] p[2] - 2 t p[1] + 2 t p[1] + t p[2]) X(t) + (t p[-2] p[0] 3 2 3 2 3 + 3 t p[-2] p[1] + 8 t p[-2] p[2] + 2 t p[-2] p[-1] p[0] 3 3 3 2 + 4 t p[-2] p[-1] p[1] + 8 t p[-2] p[-1] p[2] + 2 t p[-2] p[0] 3 3 3 2 + 4 t p[-2] p[0] p[1] - 4 t p[-2] p[0] p[2] + 3 t p[-2] p[1] 3 3 2 3 2 - 4 t p[-2] p[1] p[2] + t p[-1] p[0] + t p[-1] p[1] 3 2 3 2 3 + 3 t p[-1] p[2] + 2 t p[-1] p[0] + 2 t p[-1] p[0] p[1] 3 2 3 3 3 2 2 2 2 + t p[-1] p[1] + t p[0] + t p[0] p[1] - t p[-2] - 2 t p[-2] p[-1] 2 2 2 2 2 - 4 t p[-2] p[0] - 4 t p[-2] p[1] + 4 t p[-2] p[2] - t p[-1] 2 2 2 2 2 - 4 t p[-1] p[0] - 2 t p[-1] p[1] - 3 t p[0] - 2 t p[0] p[1] + 2 t p[-2] + 2 t p[-1] + 3 t p[0] + t p[1] - 1) X(t) + p[-2] t + p[-1] t 3 2 2 3 3 2 3 2 + p[-1] t p[0] - p[-1] t p[2] + p[-2] t p[0] - p[-2] t p[1] 2 3 3 2 2 3 2 + p[-1] t p[1] + 3 p[-2] t p[-1] + 3 p[-2] t p[-1] - 2 p[-2] t p[0] 2 2 3 2 2 - 4 p[-2] t p[-1] + 2 p[-2] t p[0] - 2 p[-1] t p[0] - p[-1] t p[1] 2 3 3 2 3 3 6 - 4 p[-2] t p[2] + 2 p[0] t p[-1] + p[2] t X(t) 3 3 3 + p[-1] t p[0] p[1] - 4 p[-2] t p[-1] p[2] + p[-2] t p[-1] p[1] 3 + 4 p[-2] t p[-1] p[0] = 0 and in Maple notation p[-1]^3*t^3+p[-2]^3*t^3-2*p[-1]^2*t^2-2*p[-2]^2*t^2+(t^3*p[0]*p[2]^2+3*t^3*p[1] *p[2]^2-t^2*p[2]^2)*X(t)^5+(-t^3*p[-2]*p[2]^2+t^3*p[-1]*p[1]*p[2]+3*t^3*p[-1]*p [2]^2+2*t^3*p[0]*p[1]*p[2]+2*t^3*p[0]*p[2]^2+3*t^3*p[1]^2*p[2]-2*t^2*p[1]*p[2]-\ 2*t^2*p[2]^2)*X(t)^4+(-2*t^3*p[-2]*p[0]*p[2]+t^3*p[-2]*p[1]^2+2*t^3*p[-2]*p[1]* p[2]+8*t^3*p[-2]*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1] p[1] p[2] + 2 t p[0] p[2] + t p[0] p[1] 3 3 3 2 2 + 4 t p[0] p[1] p[2] + t p[1] + 2 t p[-2] p[2] - 2 t p[-1] p[2] 2 2 2 2 3 - 4 t p[0] p[2] - t p[1] - 4 t p[1] p[2] + 2 t p[2]) X(t) + ( 3 2 3 3 -t p[-2] p[2] + t p[-2] p[-1] p[1] + 2 t p[-2] p[-1] p[2] 3 3 3 + 2 t p[-2] p[0] p[1] + 12 t p[-2] p[0] p[2] + 8 t p[-2] p[1] p[2] 3 2 3 2 3 - 4 t p[-2] p[2] + t p[-1] p[1] + 3 t p[-1] p[0] p[1] 3 3 2 3 + 4 t p[-1] p[0] p[2] + t p[-1] p[1] + t p[-1] p[1] p[2] 3 2 3 2 3 2 2 + 2 t p[0] p[1] + t p[0] p[2] + 2 t p[0] p[1] - 2 t p[-2] p[1] 2 2 2 2 - 12 t p[-2] p[2] - 3 t p[-1] p[1] - 4 t p[-1] p[2] - 4 t p[0] p[1] 2 2 2 2 3 2 - 2 t p[0] p[2] - 2 t p[1] + 2 t p[1] + t p[2]) X(t) + (t p[-2] p[0] 3 2 3 2 3 + 3 t p[-2] p[1] + 8 t p[-2] p[2] + 2 t p[-2] p[-1] p[0] 3 3 3 2 + 4 t p[-2] p[-1] p[1] + 8 t p[-2] p[-1] p[2] + 2 t p[-2] p[0] 3 3 3 2 + 4 t p[-2] p[0] p[1] - 4 t p[-2] p[0] p[2] + 3 t p[-2] p[1] 3 3 2 3 2 - 4 t p[-2] p[1] p[2] + t p[-1] p[0] + t p[-1] p[1] 3 2 3 2 3 + 3 t p[-1] p[2] + 2 t p[-1] p[0] + 2 t p[-1] p[0] p[1] 3 2 3 3 3 2 2 2 2 + t p[-1] p[1] + t p[0] + t p[0] p[1] - t p[-2] - 2 t p[-2] p[-1] 2 2 2 2 2 - 4 t p[-2] p[0] - 4 t p[-2] p[1] + 4 t p[-2] p[2] - t p[-1] 2 2 2 2 2 - 4 t p[-1] p[0] - 2 t p[-1] p[1] - 3 t p[0] - 2 t p[0] p[1] + 2 t p[-2] + 2 t p[-1] + 3 t p[0] + t p[1]) X(t) + p[-2] t + p[-1] t 3 2 2 3 3 2 3 2 + p[-1] t p[0] - p[-1] t p[2] + p[-2] t p[0] - p[-2] t p[1] 2 3 3 2 2 3 2 + p[-1] t p[1] + 3 p[-2] t p[-1] + 3 p[-2] t p[-1] - 2 p[-2] t p[0] 2 2 3 2 2 - 4 p[-2] t p[-1] + 2 p[-2] t p[0] - 2 p[-1] t p[0] - p[-1] t p[1] 2 3 3 2 3 3 6 - 4 p[-2] t p[2] + 2 p[0] t p[-1] + p[2] t X(t) 3 3 3 + p[-1] t p[0] p[1] - 4 p[-2] t p[-1] p[2] + p[-2] t p[-1] p[1] 3 + 4 p[-2] t p[-1] p[0] and in Maple notation X(t) = p[-1]^3*t^3+p[-2]^3*t^3-2*p[-1]^2*t^2-2*p[-2]^2*t^2+(t^3*p[0]*p[2]^2+3*t ^3*p[1]*p[2]^2-t^2*p[2]^2)*X(t)^5+(-t^3*p[-2]*p[2]^2+t^3*p[-1]*p[1]*p[2]+3*t^3* p[-1]*p[2]^2+2*t^3*p[0]*p[1]*p[2]+2*t^3*p[0]*p[2]^2+3*t^3*p[1]^2*p[2]-2*t^2*p[1 ]*p[2]-2*t^2*p[2]^2)*X(t)^4+(-2*t^3*p[-2]*p[0]*p[2]+t^3*p[-2]*p[1]^2+2*t^3*p[-2 ]*p[1]*p[2]+8*t^3*p[-2]*p[2]^2+t^3*p[-1]^2*p[2]+2*t^3*p[-1]*p[0]*p[2]+t^3*p[-1] *p[1]^2+4*t^3*p[-1]*p[1]*p[2]+2*t^3*p[0]^2*p[2]+t^3*p[0]*p[1]^2+4*t^3*p[0]*p[1] *p[2]+t^3*p[1]^3+2*t^2*p[-2]*p[2]-2*t^2*p[-1]*p[2]-4*t^2*p[0]*p[2]-t^2*p[1]^2-4 *t^2*p[1]*p[2]+2*t*p[2])*X(t)^3+(-t^3*p[-2]^2*p[2]+t^3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