企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## A.7 Permutations and Combinations Suppose we have four balls marked A, B, C, and D in an urn or container, and two balls will he drawn from the urn. To win a lottery, we must pick the balls in the order in which they are drawn. To gain insight into the likelihood of our winning, we should determine how many outcomes are possible. The possible outcomes are: AB AC AD BA BC BD CA CB CD DA DB DC The outcomes AB and BA, for example, are different because we must pick the balls in the correct order. We have listed 12 different outcomes. However, can we be sure that these are all the outcomes? Notice that we arranged the outcomes in four rows and three columns. Each row corresponds to a distinct choice for the first ball; there are four such choices. Once we have made that choice, the second letters in the entries in a row correspond to the remaining distinct choices for the second ball; there are three such choices. The total number of outcomes is therefore ![](https://box.kancloud.cn/fa1a6d429505d9afb9084c847bb955b1_96x22.jpg) This result can be generalized. For example, if we have four balls and three are drawn, the first ball can be any one of four; once the first ball is drawn, the second ball can be any of three; and once the second ball is drawn, the third ball can be any of two. The number of outcomes is therefore ![](https://box.kancloud.cn/fd4e11ba354bc2ca8528ebc8b5174234_123x21.jpg) In general, if we have *n* balls, and we are picking *k* of them, the number of possible outcomes is ![](https://box.kancloud.cn/09423b8014f9ed4de5e9e7fe0de1c661_174x21.jpg) This is called the number of permutations of *n* objects taken *k* at a time. If *n* = 4 and *k* = 3, this formula yields ![](https://box.kancloud.cn/07b9d8a89f31e7ff930957d226345106_298x23.jpg) which is the result already obtained. If *n* = 10 and *k* = 5, the formula yields ![](https://box.kancloud.cn/67cd06912578d629a2d1fbeaa88d15c5_400x21.jpg) If *k* = *n*, we are picking all the balls. This is simply called the number of ***permutations*** of *n* objects. The previous formula shows that it is given by ![](https://box.kancloud.cn/7853d5a02112d4a90f21f60eeea68aa3_203x22.jpg) Recall that for a positive integer *n, n*! is defined as the integer times all the positive integers less than it, the value of 0! is defined to be 1, and *n*! is not defined for negative integers. Next consider a lottery that we can win by merely picking the correct balls. That is, we do not have to get the order right. Suppose again that there are four balls marked A, B, C, and D, and two are drawn. Each outcome in this lottery corresponds to two outcomes in the previous lottery. For example, the outcomes AB and BA in the other lottery are both the same for the purposes of this lottery. We will call this outcome A and B. Because two outcomes in the previous lottery correspond to one outcome in this lottery, we can determine how many outcomes there are in this lottery by dividing the number of outcomes in the previous lottery by 2. This means that there are ![](https://box.kancloud.cn/d1621eb1ab78c32430395cc9ac8832c2_85x41.jpg) outcomes in this lottery. The six distinct outcomes are A and B A and C A and D B and C B and D C and D. Suppose now that three balls are drawn from the urn containing the four balls marked A, B, C, and D, and we do not have to get the order right. Then the following outcomes are all the same for the purposes of this lottery: ABC ACB BAC BCA CAB CBA. These outcomes are simply the permutations of three objects. Recall that the number of such permutations is given by 3! = 6. To determine how many distinct outcomes there are in this lottery, we need to divide by 3! the number of distinct outcomes in the lottery, where the order does matter. That is, there are ![](https://box.kancloud.cn/d3f604f4e7cc66f4f3f0121f66306809_107x42.jpg) outcomes in this lottery. They are A and B and C A and B and D A and C and D A and C and D. In general, if there are *n* balls and *k* balls are drawn and the order does not matter, the number of distinct outcomes is given by ![](https://box.kancloud.cn/ee4f026c9580232c2faee0e1cdacf7e4_206x42.jpg) This is called the number of ***combinations*** of *n* objects taken *k* at a time. Because ![](https://box.kancloud.cn/86ba7ad3cf8bd464b558001c7ade9c2c_400x75.jpg) the formula for the number of combinations of *n* objects taken *k* at a time is usually shown as ![](https://box.kancloud.cn/72fad8e110ad4a448fa18cb2514b290f_94x45.jpg) Using this formula, the number of combinations of eight objects taken three at a time is given by ![](https://box.kancloud.cn/2ed986f661652ec13ad382ae6b1f2890_127x44.jpg) The ***Binomial theorem***, which is proven in algebra texts, states that for any nonnegative integer *n* and real numbers *a* and *b*, ![](https://box.kancloud.cn/3427b366c7837a1090e51ea8172279e1_257x53.jpg) Because the number of combinations of *n* objects taken *k* at a time is the coefficient of *akbn-k* in this expression, that number is called the ***binomial coefficient***. We will denote it ![](https://box.kancloud.cn/24ee194554b8a360d973549b31db2c47_39x47.jpg). Example A.10**![Start example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**We show that the number of subsets, including the empty set, of a set containing *n* items is 2*n*. For 0 ≤ *k* ≤ *n*, the number of subsets of size *k* is the number of combinations of *n* objects taken *k* at a time, which is ![](https://box.kancloud.cn/792dff136da8a8bc107f5f3bb603c0fb_29x26.jpg). This means that the total number of subsets is ![](https://box.kancloud.cn/c9dc0b691e01e63e352cae88c0b76507_343x54.jpg) The second-to-last equality is by the Binomial theorem. **![End example](https://box.kancloud.cn/e95df9d604ab2d89febe370ae4d88fb1_1x1.gif)**