Some help with the “n Choose r” function Mr. George Tiser - Math 110 Recitation Sections 1, 2 September 11, 2008 1 “n Choose r” 1.1 Motivations (1) A sandwich shop opens in downtown Lexington. They have lettuce, tomato, onion, green pepper, ham, roast beef, swiss cheese, and other sandwich toppings: a total of 15 different toppings. You can choose any 3 of them. They claim they serve over 1,000 different kinds of sandwiches. Is that true? How can we check? (2) A security system for a biotechnology lab requires a user to push in 5 keys on a pad of buttons and then press the Door Open button (codes with more keys would be too hard for employees to remember). How many total keys should they put on the pad, in order to ensure there’s less than a 1 in a million chance for a burglar to guess the correct code? (3) Is there a way to write (x − 4)5 in standard form without hours of work? The solutions to these problems all use the “n choose r” function, which we usually write as n C r or just (nr ). Instead of saying the word “choose,” many people pronounce n C r as the letter n, the letter c, the letter r: “en cee arr”. 1.2 So what does “n choose r” really mean? You may notice that the phrase “n choose r” is unusual English grammar. It probably doesn’t sound like a correctly worded sentence to you. That’s because “n choose r” is shorthand for a longer sentence: Out of n possible choices, how many different ways can you choose exactly r of them? On the one hand, when you’re first learning about n C r , the shorthand “n choose r” can be frustrating because it leaves out so many words. On the other hand, thank goodness we have the shorthand n C r : can you imagine writing the entire long sentence out each time you need to solve a problem? 1.3 How do we compute “n choose r”? Counting all the possibilities could take a very long time. Instead, we have a formula: nC r = n! r!·(n−r)! 1 Remember that n! = n·(n − 1)·(n − 2)·(n − 3)· · · · ·1. The formula probably looks tedious (tedious is a formal term for “more work than you really want to do”). However, it is not so bad. When you plug in numbers, you’ll see there is a lot of cancel10! 10·9·8·7·6·5·4·3·2·1 = lation, which means there’s much less work to do. For example, 10 C 7 = 7!·3! = (7·6·5·4·3·2·1)·3·2·1 10·9·8·67·66·65·64·63·62·61 (67·66·65·64·63·62·61)·3·2·1 = 10·9·8 3·2·1 . 10·9·8 So 10 C 7 = 10·9·8 3·2·1 , and the fraction 3·2·1 isn’t a lot of work to simplify. To get this fraction, all we had to do was cancel! It’s a good idea to practice the steps in the paragraph above - perhaps you will eventually be able to do them in your head! 2 2.1 Applications Application 1: Sandwich Shop Problem. Let’s say a sandwich shop has a selection of 15 sandwich toppings. I’m allowed to choose exactly 3 toppings for my sandwich, no doubling up. The sandwich shop wants to claim, “We have thousands of sandwich possibilities!” because this sounds nice on an advertisement. Is it true? Solution. Well, we need to compute 15 C 3 . That means n = 15, r = 3, andn − r = 12. So 15! 1307674368000 2730 15 C 3 = 3!·12! = 6·479001600 = 6 = 455. So the claim is false. Solution. Well, we need to compute 15 C 3 . That means n = 15, r = 3, andn − r = 12. So 15! 1307674368000 2730 15 C 3 = 3!·12! = 6·479001600 = 6 = 455. So the claim is false. You might ask, but what if we allow someone to take extra lettuce? What if we allow 1, 2, or 3 toppings? It’s good to ask. There are efficient formulas for those problems, too: this is one of the many topics covered in a combinatorics or discrete mathematics course (“permutations and combinations”). 2.2 Application 2: Keypad Problem. A door’s keypad-lock has n keys. An employee hold down the correct five keys to open the door. We want there to be at most a one-in-a-million chance for burglars to just guess the code. We need to figure out a number n that satisfies n C 5 ≥ 1, 000, 000. Use our formula: n C 5 = n! 5!·(n−5)! Now consider what factorial means: n! = n·(n − 1)·(n − 2)·(n − 3)·(n − 4)·(n − 5)· · · · ·1. The big n! hint is, n! = n·(n − 1)·(n − 2)·(n − 3)·(n − 4)·(n − 5)!. So (n−5)! = n·(n − 1)·(n − 2)·(n − 3)·(n − 4). Thus n C 5 = n·(n−1)·(n−2)·(n−3)·(n−4) 5! = n·(n−1)·(n−2)·(n−3)·(n−4) . 120 We want n·(n−1)·(n−2)·(n−3)·(n−4) ≥ 1, 000, 000. Multiply both sides by 120: n·(n − 1)·(n − 2)·(n − 120 3)·(n − 4) ≥ 120, 000, 000. With some more work, you can find that any n ≥ 44 is acceptable. So, to be a fairly effective security lock, the system needs at least 44 keys. Once again, you might think, “what if we used a standard keyboard, so keys can be re-used in the combination?” and similar questions: this would be another important problem involving permutations and combinations. 2 2.3 Application 3: Binomial Theorem Is there a way to use n C r , to help us write (x − 4)5 in standard form? Yes. The incredibly useful Binomial Theorem: (x + t)n = n C 0 (xn )(t0 ) + n C 1 (xn−1 )(t1 ) + n C 2 (xn−2 )(t2 + n C 3 (xn−3 )(b3 ) + · · · + n C n−1 (x1 )(tn−1 ) + 0 n n C n (x )(t ). Let’s agree: It’s not short. It’s a lot of work. On the other hand, it’s probably much less work than multiplying (x + 4)13 out by hand. For our example, (x − 4)5 , we’d use t = −4 and n = 5. First, we know we’ll need to find all the 5 C r for r from 0 to 5: 5 C 0 = 1, 5 C 4 = 5, 5 C 2 = 10, 5 C 3 = 10, 5 C 4 = 5, 5 C 5 = 1. In the answers above, do you notice a shortcut involving symmetry? Hint: on my scrap paper, I only worked out 5 C 0 through 5 C 3 . Well, alright. Now we need to use the Binomial Theorem: we know (x + −4)5 = 5 C 0 (x5 )(t0 ) + 5 C 1 (x4 )(t1 ) + 5 C 2 (x3 )(t2 ) + 5 C 3 (x2 )(t3 ) + 5 C 4 (x1 )(t4 ) + 5 C 5 (x0 )(t5 ). Since we already calculated all the 5 C r , let’s plug those in: (x + −4)5 = 1(x5 )(t0 ) + 5(x4 )(t1 ) + 10(x3 )(t2 ) + 10(x2 )(t3 ) + 5(x1 )(t4 ) + 1(x0 )(t5 ). (x + −4)5 = 1(x5 )(t0 ) +5(x4 )(t1 ) + 10(x3 )(t2 ) +10(x2 )(t3 ) + 5(x1 )(t4 ) +1(x0 )(t5 ) = 1(x5 ) +5(x4 )t + 10(x3 )(t2 ) +10(x2 )(t3 ) + 5(x1 )(t4 ) +1(x0 )(t5 ) = x5 +(5t)x4 + (10t2 )x3 +(10t3 )x2 + (5t4 )x +t5 Now that we have as few t’s as possible, let’s plug in t = −4. (x + −4)5 = x5 = x5 = x5 +(5t)x4 + (10t2 )x3 +(10t3 )x2 + (5t4 )x +(5 · −4)x4 + (10 · (−4)2 )x3 +(−20)x4 + (160)x3 +(10 · (−4)3 )x2 + (5 · (−4)4 )x +(−640)x2 + (1280)x +t5 +(−4)5 + − 1024 Thus (x + −4)5 = x5 − 20x4 + 160x3 − 640x2 + 1280x − 1024. That was several steps, but we saved ourselves a lot of work by using the Binomial Theorem. If you don’t believe the method saved us time, try working out the solution with the usual method of multiplying and simplifying the result! Then try the same comparison for an even larger n, such as (x + 2)25 . You will probably agree that for large n, the Binomial Theorem is much more efficient than the conventional multiply-and-simplify method. 3 References Sathaye, Avinash. Precalculus with Geometry and Trigonometry. August 11, 2008: <http:www.msc.uky.edu/ sohum/ma110/text/ma110 fa08.pdf>. 3