41 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			41 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| 
								 | 
							
								---
							 | 
						||
| 
								 | 
							
								title: Combinations
							 | 
						||
| 
								 | 
							
								---
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								## Combinations
							 | 
						||
| 
								 | 
							
								A combination is a selection of items from a collection,where the order of selection does not matter. More formally:
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								>A k-combination of a set S is a subset of k distinct elements of S. If the set has n elements, the number of k-combinations is equal to the [binomial coefficient](https://guide.freecodecamp.org/mathematics/counting/factorials-and-binomial-coefficients/)<sup>1</sup>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Or if you prefer using the [factorial](https://guide.freecodecamp.org/mathematics/counting/factorials-and-binomial-coefficients/):
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Combinations refer to the combination of n things taken k at a time **without** repetition. To refer to combinations in which repetition is allowed, the terms k-selection or k-combination with repetition are often used and we use the following formulae:
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								## Some examples:
							 | 
						||
| 
								 | 
							
								Combinations are very usefull when you want to solve combinatoric problems like the following one:
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								Compute the probability to obtain a poker from
							 | 
						||
| 
								 | 
							
								a standard fifty-two card deck drawing 5 cards
							 | 
						||
| 
								 | 
							
								at the same time
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								In order to solve this simple problem you need to compute the number of 5 card hands possible using combinations:
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Mind that  is equal to 48 as per binomial coefficient definition.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### Sources
							 | 
						||
| 
								 | 
							
								1 [Wikipedia Combination entry](https://en.wikipedia.org/wiki/Combination)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 |