# Homework Help: Sum of N geometric variables with changing probability

1. Dec 1, 2012

### Yoni

1. The problem statement, all variables and given/known data

Ʃ(A-i)/(N+1-i)

sum of i=1 to N

2. Relevant equations

How do I solve this series for all 0<N<A cases.
This series is the sum of N geometric variables of changing probability.

I'd appreciate any help

2. Dec 1, 2012

### Ray Vickson

You already have an expression that is just a finite sum involving A and N. Is there something more you want? Have you tried small values such as N = 2 or N = 3?

3. Dec 1, 2012

### Yoni

I need an expression that is not a summation.

hmm... btw, where do you think we'd be if Johann Carl Friedrich Gauss had just said: "ohh it's a finite sum, I'll just add them all one by one" (or something like that in German)?

4. Dec 1, 2012

### Ray Vickson

I was not criticizing; I was asking a question (which you answered, and then ruined by your snide comments about Gauss). Actually, the Forum rules require you to show your work, and to ask for help only when you are stuck, so I should not have replied at all. The summation is doable in terms of some non-elementary functions, and I would have been willing to help you before, but not now.

Last edited: Dec 1, 2012
5. Dec 1, 2012

### Yoni

I am sorry if I offended you in any way. It was not my intent. Generally, I like to write, and sometimes it gets me into trouble. Anyway, I did not think you were criticizing me, I appreciate any help, thank you.

About showing my work, I'd be happy to. Actually I am the one writing the question, not solving it. If you wish to know, the question goes as follows:

CookieMonster pulls a cookie from the jar, if it's chocolate he eats it. Otherwise he puts it back in the jar, shuffles and pulls again.
How many cookies would he pull until he eats all the chocolate cookies".

The number of cookies until each pull of chocolate cookie has a Geometric distribution:
Xi~G(p). Where p is (N-i+1)/(11-i).
For example: X1, the first pull has p=N/10. The second pull X2 has p=(N-1)/9... and so on. The total number of cookies pulled is the sum I gave above (where A is 11).

I am able to solve this easily using a computer, but I want the students to be able to solve this in class using a clue.

Thank you, and again sorry for the not-so-witty comment I made before. Didn't mean to offend anyone (not even Gauss, but I truly don't know much about him).

Yoni

6. Dec 1, 2012

### Ray Vickson

Sorry: I thought you were a student wanting help with homework, but since you seem to be an instructor, that's different.

Here is what I get using Maple 11:

> S:=sum((A-i)/(N+1-i),i=1..N) assuming N::posint; <--- input

S:= (-gamma*N^2+N^2-N^2*Psi(N)+A*Psi(N)*N-gamma*N+gamma*A*N-N*Psi(N)-N+A-1)/N

That is:
$$S = \frac{U}{N}, \\ U = -\gamma N^2 + N^2 - N^2 \Psi(N) + A N \Psi(N) - \gamma N + \gamma A N - N \Psi(N) - N + A-1,$$
where γ is Euler's constant and Psi(N) is the "digamma" function:
$$\Psi(x) = \frac{d \ln \Gamma (x) }{dx}.$$

Note added in editing: in fact, it is even simpler if we look at the two parts separately. Maple gives the following:
$$S_0 = \sum_{i=1}^N \frac{1}{N+1-i} = \Psi(N+1) + \gamma\\ S_1 = \sum_{i=1}^N \frac{i}{N+1-i} = (N+1) \left( \; \Psi(N+2) - 1 + \gamma \; \right)$$
In order to check we can compare the summed results with these formulas for a number of N values; perfect agreement (within roundoff errors) are obtained for N = 1,2,..., 10.

So, the final result is S = A*S0 - S1.

Last edited: Dec 2, 2012
7. Dec 2, 2012

### Yoni

Thank you.
These functions are too complex for the course I am giving. I will have to suffice with the sum...
But you reminded me to use Maple more often. So cheers!

Yoni

8. Dec 2, 2012

### haruspex

It's the expectation that's wanted, yes? Whether the answer is complicated depends on what form of answer you'll accept.
Expected number of tries in total =$\sum_{i=0}^{C-1}\frac{N-i}{C-i} = C+\sum_{i=0}^{C-1}\frac{N-C}{C-i} = C+(N-C)\sum_{i=0}^{C-1}\frac{1}{C-i} = C+(N-C)\sum_{i=1}^{C}\frac{1}{i}$