image
Physics Forums Logo
image
image
* Register * Upgrade Blogs Library Staff Rules Mark Forums Read
image
image   image
image

image combinatorics: number of words Share It Thread Tools Search this Thread image
Old Mar19-09, 04:47 PM                  #1
techmologist

techmologist is Offline:
Posts: 153
combinatorics: number of words

ere me now.

I'm trying to figure out how many words of length r having exactly k distinct letters can be made with an alphabet of size n. Call this number a_k,r. It satisfies the recursion

LaTeX Code: a_{k,r} = ka_{k,r-1} + (n-k+1)a_{k-1,r-1}

LaTeX Code: a_{1,r} = n for r >= 1
LaTeX Code: a_{k,r} = 0 for r < k

My best effort so far is to use a generating function as follows

LaTeX Code: f_k(x) = \\sum_{r=1}^{\\infty}a_{k,r}x^r

and use the recursion formula to get

LaTeX Code: f_k(x) = \\frac{(n-k+1)x}{1-kx}f_{k-1}(x) = \\frac{x^{k-1}(n-1)(n-2)...(n-k+1)}<BR>{(1-x)(1-2x)...(1-kx)}f_1(x)

or since f_1(x) = n/(1-x),

LaTeX Code: f_k(x) = \\frac{(k-1)!\\left(^n_{k-1} \\right)x^{k-1}}{(1-x)(1-2x)...(1-kx)}

I'm having a well difficult time getting the coefficient of x^r (which would be a_k,r) in the expansion of this. Is there a way to simplify it so you don't have k nested sums? thanks.
  Reply With Quote
Old Mar19-09, 05:56 PM                  #2
ThirstyDog

ThirstyDog is Offline:
Posts: 33
Re: combinatorics: number of words

I am trying to follow your approach and the f's confuse me: the problem I have is that
LaTeX Code:  f_{k}(1)  = \\sum_{r=1}^{\\infty} a_{k,r} \\geq 1,
but by your recursion relation we have
LaTeX Code:  \\frac{f_{k}(1)}{f_{k-1}(1)} = \\frac{n-k+1}{1-k}.
The right hand side must be positive while the left must be negative. This means either I have misunderstood something or you have...

I am sure some combinatorist has got a simply answer for this... but pending them stating what it is here is a way to at least reduce the problem.

First find how many ways to pick k distinct letters from the alphabet with n letters (order of picking not important). Consider these letters as a sub-alphabet.

From this sub-alphabet you will need to create words that are length r and use every letter. If you find this number then you can multiply by the previous to obtain the answer.

Please tell me if you find a simple answer and\or which one of us made the mistake.
  Reply With Quote
Old Mar20-09, 08:15 PM                  #3
techmologist

techmologist is Offline:
Posts: 153
Re: combinatorics: number of words

Yes, the series expansion for the f_k's is only valid for |x| < 1/k. But
your suggested way of doing it is a lot better. For an alphabet of k letters,
the number b_k,r of r-letter words which have all k letters is k^r minus the number
of words in which at least one of the letters is absent. I calculated the
latter using the sieve principle as

# of r-letter words missing at least 1 of the k letters =


LaTeX Code: \\left( ^{k}_{1} \\right)(k-1)^r - \\left( ^{k}_{2} \\right)(k-2)^r +...+<BR>(-1)^{k}\\left( ^{k}_{k-1} \\right)<BR> = \\sum_{j=1}^{k-1}(-1)^{j-1}\\left( ^{k}_{j} \\right)(k-j)^r

Then subtracting this from k^r gives

LaTeX Code: b_{k,r} =\\sum_{j=0}^{k-1}(-1)^{j}\\left( ^{k}_{j} \\right)(k-j)^r

As you said, to generalize this to n > k letters in the alphabet, multiply
b_k,r by choose(n,k) to get

LaTeX Code: a_{k,r} = \\left( ^{n}_{k} \\right)b_{k,r}

For the special case k = r, this should simplify to


LaTeX Code: a_{r,r} = r!\\left( ^{n}_{r} \\right)

I've been trying to verify by induction that

LaTeX Code: \\sum_{j=0}^{r-1}(-1)^{j}\\left( ^{r}_{j} \\right)(r-j)^r = r!
but I can't seem to do it. It seems to be true though, if you plug in small
numbers for r. Thanks for the tip! At least I'm making progress now. If you know of a way to simplify the above answer further, please show it.
  Reply With Quote
Old Mar21-09, 06:08 AM                  #4
Eero

Eero is Offline:
Posts: 6
Re: combinatorics: number of words

LaTeX Code: \\sum_{j=0}^{r-1}(-1)^{j}\\\\( ^{r}_{j} \\\\)(r-j)^r = r!

This expression is easy to prove by considering the r-th derivative
of (1-e^x)^r at x=0
  Reply With Quote
Old Mar21-09, 11:01 PM                  #5
techmologist

techmologist is Offline:
Posts: 153
Re: combinatorics: number of words

Originally Posted by Eero View Post
LaTeX Code: \\sum_{j=0}^{r-1}(-1)^{j}\\\\( ^{r}_{j} \\\\)(r-j)^r = r!

This expression is easy to prove by considering the r-th derivative
of (1-e^x)^r at x=0
Very cool. Thanks :)
  Reply With Quote
image image
Reply
Thread Tools


Similar Threads for: combinatorics: number of words
Thread Thread Starter Forum Replies Last Post
Simple Combinatorics: What are odds of picking same number? hamjam9 General Math 5 Feb22-09 12:54 PM
Combinatorics ritwik06 Precalculus Mathematics 5 Dec18-08 05:17 AM
combinatorics buzzmath Calculus & Beyond 7 Feb23-06 07:15 AM
combinatorics kikar Introductory Physics 7 Oct18-04 11:15 AM
Combinatorics Kuja Introductory Physics 3 Feb29-04 06:47 PM

Powered by vBulletin Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. © 2010 Physics Forums
Sciam | physorgPhysorg.com Science News Partner
image
image   image