When you think ASP, think...
 Recent Articles All Articles ASP.NET Articles ASPFAQs.com Message Board Related Web Technologies User Tips! Coding Tips

 Sections: Sample Chapters Commonly Asked Message Board Questions JavaScript Tutorials MSDN Communities Hub Official Docs Security Stump the SQL Guru! XML Info Information: Feedback Author an Article

Binomial coefficients are really neat for a number of reasons. First off, they have a ton of practical value. For example, I enjoy playing basketball with friends and oftentimes we'll encounter a situation as follows:

Scenario:
• We meet four other folks at the courts who also want to play
• We decide to play a series of games of 3 on 3, three from our group of six on one team and three from the other group of three on one team.

Questions:

• How many teams of 3 from our group are possible?
• How many teams of 3 from the group of four are possible?

To answer these questions we can use binomial coefficients! The question can be restated, "How many ways can we choose teams of three from six possible players?" and "How many ways can we choose teams of three from four possible players?" This is, mathematically, C(6,3) and C(4,3).

Recall that:

C(n,k) = n! / (k! * (n-k)!)

And that:

n! = n * (n-1) * (n-2) * ... * 3 * 2 * 1

n! is pronounce n factorial.

So, if we want to determine C(6,3), we have:

6 * 5 * 4 * 3 * 2 * 1
--------------------------
(3 * 2 * 1) * (3 * 2 * 1)

A lot of the numbers cancel out nicely, leaving us with 20 as an answer. To determine C(4,3) we have:

4 * 3 * 2 * 1
-------------------
(3 * 2 * 1) * (1)

Which is 4.

 Note that... C(n,0) = 1 C(n,k), where k < 0, is defined to equal 0 0! (zero factorial) is defined to equal 1.

Determining Gambling Odds:
Binomial coefficients (or combinatorials) can be used to calculate gambling odds. Without delving into probability theory, think of an event as an action that has a finite number of possible outcomes. Flipping a coin, for example, has two possible outcomes: heads or tails. This event can be defined as a finite set, E, where the elements of E are the possible outcomes. Therefore, for flipping a coin, we have:

E = { Heads, Tails }

If each outcome in the set E is equally likely to occure, then the probability of an given outcome occurring is 1 / |E|, where |E| is the cardnality of E (the number of elements in set E). Using this knowledge we can use binomial coefficients to calculate the probability of obtaining certain hands in a card game.

If the set E is defined as all of the possible groups of five cards chosen from a 52-card deck, |E| = C(52,5). Now, if we want to know the probability of obtaining a flush, how many ways can we receive a flush? Well, since there are 13 cards of any given suit and we need five cards of the same suit to have a flush, there are C(13,5) possible ways to obtain a flush. Therefore, the probability of being delt a flush from a 52-card deck (when delt five cards), is:

C(13,5) / C(52,5) = 0.00049519...

Therefore, if delt five cards, there is roughly a 0.05% chance that you will have a flush. Neat, eh?

 ASP.NET [1.x] [2.0] | ASPFAQs.com | Advertise | Feedback | Author an Article

 #brand-footer{text-align:center;margin:0 auto;} #commonfooterpropertytext{padding-bottom: 12px;} #commonfootercopyright{padding: 3px;} #eweekBrand-footer{text-align:center;margin:0 auto} #footerDisclaimerText{margin: 15px 10px 0px 10px; text-align: justify;} Advertiser Disclosure: Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.