Question

Combinatorial problem

Asked by: arni_richard


Hi everyone!

I have a fun problem in combinatorics to solve. I am searching for an analytical formula for the answer. Right now I use a recursive function to solve it.

A bowl contains N balls of each of L different colors (NxL balls in total). You pick M <= NxL balls without replacement. What is the probability of having picked K balls of the same color, but less of the others?

If someone can give me reference to discussion of this problem, I'ld be glad.

Best regards,
Arni Richard

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-10-06 at 07:19:15ID22015489
Tags

combinatorial

,

problem

,

balls

,

solve

Topic

Math & Science

Participating Experts
5
Points
250
Comments
16

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. bowling scoring utility
    i need a simple bowling scoring (U.S. standard ten pin) for use on lap top for league bowling. ** this is worth 500 points to the person who does this. ** options should be just simple scoring for one team upto five players. option for printing if possible. just the stand...
  2. Golf Balls
    I'm a grade 8 student and I'm trying to find out ways I could test the tragectory of a golf ball when hit and how to calculate the reasons it did that(It is also the winter). I know it sounds like a gay question but im not very smart. Please help me!!!!!!!!!!
  3. Algorythm to create a bowling league tournament
    I'm developing some software for a 10-pin bowling league and I'd like to include an 'auto-generate matches' function. To do this, I need an algorythm to create the match fixtures, ie: Week1 1-2 3-4 5-6 7-8 9-10 Week2 7-3 1-6 2-9 5-10 8-4 Week3 4...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: aburrPosted on 2006-10-06 at 11:07:44ID: 17678795

"What is the probability of having picked K balls of the same color, but less of the others?"

The import of the " but less of the others" puzzles me.

How many balls are  you picking? 5? 10?  K?
So you pick K. What is the probablilty that they will all be the same? (small, if K is large) but what is this "less".

Are you given a particular color?  Pick K balls and find that color to be the less? If you pick K balls, the probability that one of the colors will be less (or equal) is 100%

 

by: arni_richardPosted on 2006-10-06 at 12:08:25ID: 17679228


This should actually be

      "What is the probability of having picked exactly K balls of the same arbitrary color, but less from the other colors?"

For example, a bowl contains 5 red balls, 5 blue. (N = 5, L = 2)

I pick 3 balls. (M = 3).

What is the probability of the event that I have 2 red balls and 1 blue, or 2 blue balls and 1 red. (K = 2).

 

by: aburrPosted on 2006-10-06 at 18:43:04ID: 17681077

I see where I misread your statement. Let me see if I have it at least partially right.
Say we have five colors each with 5 balls.
I am to pick 12 balls. 3 are to be (let us say) red.
What is the probability of doing this without getting more than two of any other color.


Clearly there are some limits on M and K. Cearly M<21, K<6, If M=1 then K=1. If M=2, then K must = 2  M cannot be < K. In your case above proability is 36 out of 100 but I do not have an analytical equation.


 

by: dbkrugerPosted on 2006-10-06 at 22:20:26ID: 17681482


For the specific case you stated, which is more specific than the general solution:

number of balls B = N* L
total combinations = choose(B, M) = 10 choose 3 = 10*9*8/(3*2) = 720/6 = 120

Of those, you want the probability that you choose 2 of 5, and 1 of 5

(N/B) * (N-1)/(B-1) * (N-1)/(B-2) + (N/B) * (N-1)/(B-1) * (N-1)/(B-2)

in general, there need not be a single value for N. There could be N1 = 5, N2 = 14. The idea still works.

 

by: jkmyoungPosted on 2006-10-13 at 11:56:15ID: 17726687

Limits on M and K
K<=M

Number of balls picked is less than or equal to picking K-1 of all colors, and one more of the arbitrary color.
M <= KL - L + 1
In terms of K,
K - 1 >= (M-1)/L
K >= 1 + (M-1)/L

1 + (M-1)/L <= K <= M

If L = 1  P=1
If L = 2, the problem becomes very simple. P = KCN * (M-K)CN /  MC(LN)
      # of ways of choosing the K balls from the designated color TIMES
      # of ways of choosing the M-K remaining balls from the other color DIVIDED BY
      # of ways of choosing all balls.
If L = 3, the problem becomes much harder.
      P = KCN * SUM(i = MAX(0, M-K-(K-1)) to MIN(M-K,K-1)) [iCN * (M-K-i)CN] / MC(LN)
      Why the restrictions on i?
      i can be no greater than the balls left over (M-K) nor K-1.
      the number of balls leftover after picking the i balls can not be over (M-K) nor K-1

and so forth.

 

by: jkmyoungPosted on 2006-10-13 at 12:02:36ID: 17726730

If the color of the K balls do not matter, simply multiply the answer by L.

For your example: (N = 5, L = 2). (M = 3). (K = 2).
P = KCN * (M-K)CN /  MC(LN)
  = 2C5 * (3-2)C5 / 3C(2*5)
  = 2C5 * 1C5 / 3C10
  = 5 * 4 / 2    * 5    / ((10*9*8)/(3*2*1))
  = 10 * 5 / 120
  = 50 /120
  = 5/12
  ~0.416667

If color does not matter, 5/12 * 2 = 10/12 = 5/6 ~ .83333

 

by: Ehsan_NoureddinPosted on 2006-11-07 at 10:31:27ID: 17891759

We suppose :
M = N * L


Answer is :  Sigma (   (1/M)*(1/(M-1))*(1/(M-2))*....*(1/(M-[K/2])) , K = 1 ..  L )


hint : [2.xxx] = 2

 

by: Ehsan_NoureddinPosted on 2006-11-07 at 10:41:33ID: 17891829

sorry i correct my post :

We suppose :
X= N * L


Answer is :  Sigma (   (1/X)*(1/(X-1))*(1/(X-2))*....*(1/(X-[K/2-1])) , K = 1 ..  M )


hint : [2.xxx] = 2


=======================================================
for example  N = 5 , L = 2 , M = 5
you want to pick 5 ball .. you want a probility of  '1 of your desire colour' , '2 of your desire colour'

answer is : 1/90 + 1/10

 

by: Ehsan_NoureddinPosted on 2006-11-08 at 13:57:14ID: 17902096

im really sorry for my incorrect posts ..
today i found that all my posts are incorrect ..

but i think this one is correct :D :

X = N * L

we define a function of probablity of picking  a desire colour ball when we pick M Ball ..

F(N,L,M,a) =  (N/X) * (N-1/X-1) * ... * (N-(a-1)/X-(a-1)) * ( X-N/X-a ) * (X-N-1/X-a-1) * ... *(X-N-(M-a-1) / X-(M-1))


For your question :

Answer = Sigma (F(N,L,M,a) , a = 1 .. [M/2])

[2.xxx] = 2

in according to that Function the answer of you Example is :
N = 5 , L = 2 , M = 3

F(5,2,3,1) = 5/10 * 5/9 * 4/8  = 10/72      // one red & 2 blue
F(5,2,3,2) = 5/10 * 4/9 * 5/8  = 10/72     // 2red & one blue

is it helpful ?

 

by: jkmyoungPosted on 2006-11-09 at 11:43:15ID: 17908787

F(5,2,3,1) = 5/10 * 5/9 * 4/8  = 10/72  = 5/36    // one red & 2 blue
This is the probability of picking one blue ball, then one red ball, then another blue ball.
However, this misses,
red, blue, blue = 5/10 * 5/9 * 4/8 = 5/36
blue, blue, red = 5/10 * 4/9 * 5/8  = 5/36
Total probability for 2 blue and one red= 15/36 = 5/12
as shown easier.

I do not recommend this method, as it just seems painful to calulate and would become unmanageable with big enough M or L. Using nCr is much easier.

 

by: Ehsan_NoureddinPosted on 2006-11-09 at 11:49:22ID: 17908830

jkmyoung ,
yes , i accept that it is hard but i thought that he needs an equation for using in a computer programming ..
so i produced this equation ..

in according to my equation you can solve it by just 2 loop ..


thanks for you comment ..

 

by: relfPosted on 2006-12-01 at 02:11:47ID: 18052509

I think there is no simple analytical formula for that.

Notice that the number of ways to choose M balls out of N*L balls equals the binomial coefficient C(N*L,M). That's simple.

Now let's count the number of ways of "having picked K balls of the same color, but less of the others". First we need to select a color with K balls picked out of L colors, it brings a factor of L*C(N,K) (the binomial coefficient C(N,K) stands for choosing K specific balls of selected color out of N balls) to the answer and leaves us with L-1 non-selected colors. From each of these L-1 colors we need to pick at most K-1 balls, with the total amount of M-K balls. I do not see any better description than in term of generating functions. Namely, the number of ways to pick M-K balls of L-1 colors with at most K-1 balls of each color equal the coefficient of x^(M-K) in the expansion of
(1 + C(N,1)*x + C(N,2)*x^2 + ... + C(N,K-1)*x^(K-1))^(L-1)
that is denoted as follows:
[x^(M-K)] (1 + C(N,1)*x + C(N,2)*x^2 + ... + C(N,K-1)*x^(K-1))^(L-1)

Hence, the final answer for the probability you've asked is
L * C(N,K) * [x^(M-K)] (1 + C(N,1)*x + C(N,2)*x^2 + ... + C(N,K-1)*x^(K-1))^(L-1) / C(N*L,M)

This answer can be simplified in some cases:
1) If M<2K then the probability can be computed simply as
L * C(N,K) * C(N*(L-1),M-K) / C(N*L,M)
2) If K=1 then the probability is 0 unless M=1, in which case the probability is 1.
3) If K=2 then the probability is L* C(N,2) * C(L-1,M-2) * N^(M-2) / C(N*L,M)

For example, let's compute the answer in the case N=5, L=2, M=3, K=2 considered by others.
We can apply either formula 1 (since M<2*K):
F(5,2,3,2) = 2 * C(5,2) * C(5*(2-1),3-2) / C(5*2,3) = 2 * C(5,2) * C(5,1) / C(10,3) = 2 * 10 * 5 / 120 = 5/6
or formula 3 (since K=2):
F(5,2,3,2) = 2 * C(5,2)  * C(1,3-2) * 5^(3-2) / C(5*2,3) = 2 * 10 * 1 * 5 / 120 = 5/6

 

by: aburrPosted on 2007-01-16 at 16:02:50ID: 18328829

after the problem was restated, solutions were proposed, some of which may work

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...