Tuesday, 10 November 2009

Polynomials, dice and pensions!!

OK a weird title for a blog. I'm typing this with a few loose thoughts in my head. OK to business, the journey begins...

let
p+q=1
This is quite simple, but I'll further restrain our space with both p & q are positive but less than one. Now as seen before in the previous blog, if there is a game or situation where someone has n attempts, if they see a certain situation they stop, if not they try again (persistence). For example you have 4 tries to throw a six, if you get it on the first go, then you stop, if not try again for up to 4 attempts. Looking at this situation q, represents the probability that you "go again", p the probability you "stop". All the permutations for n attempts are (as previously shown)

p + pq + pq2 + pq3 + .. + pqi +.. + pq(n-1) + qn == 1

or
p(1 + q + q2 + q3 + .. + qi +.. + q(n-1) )+ qn == 1

Well the above is fine, except that most people would not recognise it, rather gravitate to the expansion of (p+q)n == 1

On the face of it, there is absolutely nothing wrong with either formulae. So lets run with this, recognising that qn will cancel from both formulae.

p(1 + q + q2 + q3 + .. + qi +.. + q(n-1) ) + qn == 1
pn +np(n-1)q .. nCi piq(n-i) .. + npq(n-1) + qn == 1

Well the qn cancels, and we can divide through by p to get

1 + q + q2 + q3 + .. + qi +.. + q(n-1) ==
pn-1 +np(n-2)q .. nCi p(i-1)q(n-i) .. + nq(n-1)

The top formulae has a very well known simplification, namely (1-qn)/(1-q) or (1-qn)/p (as p+q=1). The formulae is thus

(1-qn)/p = sum(i=0..n-1) nCi p(i-1)q(n-i)

Looking carefully at the above this is merely a re-write of (p+q)n .

This can also be broken down to look like the following..

(p+q)n + p(p+q)(n+1) + p2(p+q)(n-2) + .. pi(p+q)(n-i) + .. pn

So we are now back to our original formulae as p+q=1!!


However, lest assume p+q!=1. let us assume p+q=K instead, and use a similar method (that I stumbled upon by chance) to see where it leads. so

(p+q)n = kn

and thus

sum(i=0..n) nCi piq(n-i) = kn

rearranging

sum(i=0..n) nCi p(i-1)q(n-i) = (kn-qn)/p

and so we can transform the above into

(p+q)n-1 + p(p+q)(n-2) + p2(p+q)(n-3) + .. pi(p+q)(n-i-1) + .. pn-1 = (kn-pn)/(k-p)

finally

k(n-1) + pk(n-2) + p2k(n-3) + .. p(n-2)k + p(n-1) = (kn-pn)/(k-p)


An alternate method..

So lets do something similar, let
S = an + a(n-1)b + a(n-2)b2 + .. a(n-i)bi .. + bn

Sa = an+1 + anb + a(n-1)b2 + .. a(n-i+1)bi .. + abn

Sb = anb+ a(n-1)b2 + a(n-2)b3 + .. a(n-i)bi+1 .. + bn+1


Sa - Sb = an+1 - bn+1

and so
S = (an+1 - bn+1)/(a-b)

This is identical to above formula (and far quicker to run through!!!)