01 · el método01 · the method
Tres preguntas antes de tocar una fórmulaThree questions before touching a formula
¿Importa el orden? · ¿Se pueden repetir? · ¿Intervienen todos?Does order matter? · Can they repeat? · Are all of them used?
m es el número de elementos disponibles y n el número de huecos que rellenas. Responde las tres preguntas con sí o no y busca la fila. El orden importa si cambiar de sitio dos elementos da un resultado distinto: en un podio, oro y plata no son lo mismo; en un equipo, sí. La repetición se permite si un mismo elemento puede salir dos veces: un dígito en un PIN, sí; una persona en un podio, no. «Todos» significa que usas los m elementos, cada uno una vez: ordenar los 6 libros de una balda.m is the number of available elements and n the number of slots you fill. Answer the three questions with yes or no and find the row. Order matters if swapping two elements gives a different result: on a podium, gold and silver are not the same; in a team, they are. Repetition is allowed if the same element can come out twice: a digit in a PIN, yes; a person on a podium, no. "All" means you use the m elements, each one once: arranging the 6 books on a shelf.
02 · multiplicación y suma02 · multiplication and sum
Si eliges por etapas, multiplicas; si eliges entre opciones que se excluyen, sumasIf you choose in stages, multiply; if you choose between options that exclude each other, add
etapas: n₁·n₂·n₃ · alternativas: n₁ + n₂stages: n₁·n₂·n₃ · alternatives: n₁ + n₂
Un menú con 3 primeros, 4 segundos y 2 postres da 3·4·2 = 24 comidas distintas. ¿Por qué se multiplica? Porque cada uno de los 3 primeros se combina con cada uno de los 4 segundos: 12 parejas; y cada pareja, con cada postre. Si en vez de menú puedes pedir o el menú o uno de 5 platos combinados, las opciones son 24 + 5 = 29: no haces las dos cosas, haces una u otra. La palabra «y» multiplica; la palabra «o», cuando no pueden pasar las dos, suma.A menu with 3 starters, 4 mains and 2 desserts gives 3·4·2 = 24 different meals. Why multiply? Because each of the 3 starters goes with each of the 4 mains: 12 pairs; and each pair, with each dessert. If instead you can order either the menu or one of 5 combo plates, the options are 24 + 5 = 29: you do not do both, you do one or the other. The word "and" multiplies; the word "or", when both cannot happen, adds.
iniciostart → A → A1 · A2
iniciostart → B → B1 · B2
iniciostart → C → C1 · C2
3 ramas · 2 subramas = 6 caminos3 branches · 2 sub-branches = 6 paths
Cada nivel es una etapa y cada rama una opción. El número de caminos completos, de la raíz a una hoja, es el producto de las ramas por nivel si todas las ramas de un nivel tienen el mismo número de hijos. El árbol sirve para dos cosas: ver la estructura cuando dudas y contar a mano los casos pequeños para comprobar tu fórmula. Si en un nivel no todas las ramas tienen los mismos hijos, no multipliques a ciegas: suma rama a rama.Each level is a stage and each branch an option. The number of complete paths, from root to leaf, is the product of the branches per level if every branch in a level has the same number of children. The tree does two jobs: showing the structure when you hesitate, and counting small cases by hand to check your formula. If in a level not every branch has the same children, do not multiply blindly: add branch by branch.
03 · factorial03 · factorial
n! es el número de formas de ordenar n cosas distintasn! is the number of ways to order n different things
n! = n·(n − 1)·…·2·1 · 0! = 1 · n! = n·(n − 1)!
Para ordenar 5 libros: 5 opciones para el primer hueco, 4 para el segundo, y así hasta 1. Eso es 5·4·3·2·1 = 120 = 5!. Crece muy rápido: 10! = 3 628 800 y 20! tiene 19 cifras. ¿Por qué 0! = 1? Por dos razones que dicen lo mismo. La regla n! = n·(n − 1)! con n = 1 da 1! = 1·0!, así que 0! tiene que valer 1. Y hay exactamente una forma de ordenar nada: no hacer nada. Con 0! = 1 las fórmulas funcionan también en los extremos: C(m, 0) = 1 y C(m, m) = 1.To order 5 books: 5 options for the first slot, 4 for the second, and so on down to 1. That is 5·4·3·2·1 = 120 = 5!. It grows very fast: 10! = 3,628,800 and 20! has 19 digits. Why is 0! = 1? For two reasons that say the same thing. The rule n! = n·(n − 1)! with n = 1 gives 1! = 1·0!, so 0! has to be 1. And there is exactly one way to order nothing: do nothing. With 0! = 1 the formulas also work at the edges: C(m, 0) = 1 and C(m, m) = 1.
04 · variaciones con repetición04 · variations with repetition
Cada hueco tiene las mismas m opciones: mⁿEach slot has the same m options: mⁿ
VR(m, n) = m·m·…·m = mⁿ
Qué estoy contando: listas ordenadas de n posiciones en las que cada posición puede ser cualquiera de los m elementos, aunque ya haya salido. Un PIN de 4 dígitos: 10 opciones en cada uno, 10·10·10·10 = 10⁴ = 10 000. Una quiniela inventada de 8 partidos con 1, X o 2: 3⁸ = 6561. Ojo con el orden de la potencia: la base son las opciones de cada hueco y el exponente, los huecos. 10⁴ no es 4¹⁰. Aquí n puede ser mayor que m: un PIN de 4 cifras usando solo 0 y 1 da 2⁴ = 16.What am I counting: ordered lists of n positions where each position can be any of the m elements, even if it already came out. A 4-digit PIN: 10 options in each, 10·10·10·10 = 10⁴ = 10,000. A made-up pools coupon of 8 matches with 1, X or 2: 3⁸ = 6561. Watch the order of the power: the base is the options per slot and the exponent, the slots. 10⁴ is not 4¹⁰. Here n can be larger than m: a 4-digit PIN using only 0 and 1 gives 2⁴ = 16.
05 · variaciones sin repetición05 · variations without repetition
Cada hueco tiene una opción menos que el anteriorEach slot has one option fewer than the previous one
V(m, n) = m·(m − 1)·…·(m − n + 1) = m! / (m − n)!
Un podio de 8 corredores: 8 para el oro, 7 para la plata, porque el del oro ya no puede, y 6 para el bronce. 8·7·6 = 336. Son n factores que bajan de uno en uno empezando en m. La forma con factoriales es la misma cuenta escrita en corto: 8!/5! = 8·7·6, porque los 5·4·3·2·1 de arriba y de abajo se van. En el examen, escribe el producto: se ve qué haces y se calcula antes. Sin repetición, n no puede pasar de m: no hay podio de 3 con 2 corredores.A podium of 8 runners: 8 for gold, 7 for silver, because the gold one can no longer, and 6 for bronze. 8·7·6 = 336. That is n factors going down one by one starting at m. The factorial form is the same count written short: 8!/5! = 8·7·6, because the 5·4·3·2·1 on top and bottom cancel. In the exam, write the product: it shows what you do and it is faster. Without repetition, n cannot exceed m: there is no 3-place podium with 2 runners.
06 · permutaciones06 · permutations
Variaciones en las que entran todos: P(m) = m!Variations in which all are used: P(m) = m!
P(m) = V(m, m) = m! / 0! = m!
Si ordenas los m elementos, todos, el último hueco solo tiene una opción: la que queda. 6 libros en una balda: 6! = 720 órdenes. 7 personas en 7 sillas numeradas: 7! = 5040. La permutación no es una fórmula nueva, es la variación sin repetición cuando n = m. Por eso hacía falta 0! = 1: m!/(m − m)! = m!/0! = m!. Ampliación, por si sale: en una mesa redonda sin cabecera, girar a todos un puesto da la misma mesa, así que se cuentan (m − 1)!.If you order the m elements, all of them, the last slot has only one option: the one left. 6 books on a shelf: 6! = 720 orders. 7 people in 7 numbered chairs: 7! = 5040. A permutation is not a new formula, it is the variation without repetition when n = m. That is why we needed 0! = 1: m!/(m − m)! = m!/0! = m!. Extension, in case it comes up: at a round table with no head, rotating everyone one seat gives the same table, so you count (m − 1)!.
07 · permutaciones con repetición07 · permutations with repetition
Si hay letras iguales, divide por los órdenes que no se notanIf there are equal letters, divide by the orders you cannot see
PR = n! / (a!·b!·…) · TOMATETOMATE: 6! / 2! = 360
Qué estoy contando: órdenes de n objetos de los que algunos son iguales entre sí. Con las 6 letras de TOMATE, si las dos T fueran distintas, T₁ y T₂, habría 6! = 720 palabras. Pero T₁OMAT₂E y T₂OMAT₁E se leen igual: cada palabra real sale 2! = 2 veces. 720/2 = 360. Si una letra se repite 3 veces, cada palabra se cuenta 3! = 6 veces y se divide por 6. Con varias letras repetidas, se divide por el factorial de cada repetición.What am I counting: orders of n objects of which some are equal to each other. With the 6 letters of TOMATE, if the two T were different, T₁ and T₂, there would be 6! = 720 words. But T₁OMAT₂E and T₂OMAT₁E read the same: each real word comes out 2! = 2 times. 720/2 = 360. If a letter repeats 3 times, each word is counted 3! = 6 times and you divide by 6. With several repeated letters, divide by the factorial of each repetition.
08 · combinaciones08 · combinations
Cuenta como si importara el orden y divide por n!Count as if order mattered and divide by n!
C(m, n) = V(m, n) / n! = m! / (n!·(m − n)!) · equipo de 5 entre 12team of 5 out of 12: (12·11·10·9·8) / 120 = 792
Fórmula: arriba, las variaciones; abajo, n!. Qué estoy contando: grupos, subconjuntos, en los que da igual quién entra primero. Intuición: si eliges 5 jugadores uno detrás de otro, salen 12·11·10·9·8 = 95 040 listas ordenadas. Pero el equipo {A, B, C, D, E} aparece en esa lista tantas veces como formas hay de ordenar a esos 5: 5! = 120. Cada grupo está contado 120 veces, así que hay 95 040/120 = 792 equipos. Ese es todo el porqué de dividir por n!: cada grupo se cuenta tantas veces como órdenes tiene. El contador visual de la parte 3 lo enseña con las listas reales.Formula: on top, the variations; below, n!. What am I counting: groups, subsets, where it does not matter who comes in first. Intuition: if you pick 5 players one after another, you get 12·11·10·9·8 = 95,040 ordered lists. But the team {A, B, C, D, E} appears in that list as many times as there are ways to order those 5: 5! = 120. Each group is counted 120 times, so there are 95,040/120 = 792 teams. That is the whole reason for dividing by n!: each group is counted as many times as it has orders. The visual counter in part 3 shows it with the real lists.
09 · número combinatorio09 · binomial coefficient
C(m, n) se lee «m sobre n» y tiene dos propiedades que ahorran cuentasC(m, n) is read "m choose n" and has two properties that save work
C(m, n) = C(m, m − n) · C(m, n) = C(m − 1, n − 1) + C(m − 1, n)
Simetría: elegir los 3 que van de excursión entre 10 es lo mismo que elegir los 7 que se quedan. Por eso C(10, 3) = C(10, 7) = 120, y C(50, 48) se calcula como C(50, 2) = 1225. Suma de Pascal: fija a una persona concreta. Los grupos de n o la llevan, y entonces eliges los otros n − 1 entre m − 1, o no la llevan, y eliges los n entre m − 1. Las dos cosas se excluyen, así que se suman. Y dos valores que conviene saber de memoria: C(m, 0) = 1 y C(m, 1) = m.Symmetry: choosing the 3 who go on the trip out of 10 is the same as choosing the 7 who stay. That is why C(10, 3) = C(10, 7) = 120, and C(50, 48) is computed as C(50, 2) = 1225. Pascal's sum: fix one particular person. Groups of n either include them, and then you choose the other n − 1 out of m − 1, or they do not, and you choose the n out of m − 1. Both exclude each other, so you add. And two values worth knowing by heart: C(m, 0) = 1 and C(m, 1) = m.
10 · Pascal y Newton10 · Pascal and Newton
El triángulo de Pascal da los coeficientes del binomioPascal's triangle gives the coefficients of the binomial
(a + b)ⁿ = ∑ C(n, k)·aⁿ⁻ᵏ·bᵏ · Tk+1 = C(n, k)·aⁿ⁻ᵏ·bᵏ
Cada número del triángulo es la suma de los dos de encima: es la suma de Pascal de la tarjeta 09. La fila n son los C(n, k) con k de 0 a n, y suma 2ⁿ. ¿Por qué salen en el binomio? Al desarrollar (a + b)⁴ = (a + b)(a + b)(a + b)(a + b), cada término sale de elegir a o b en cada paréntesis. Para que salga a²b² hay que elegir b en 2 de los 4 paréntesis: C(4, 2) = 6 formas. Por eso (a + b)⁴ = a⁴ + 4a³b + 6a²b² + 4ab³ + b⁴. Si b es negativo, los signos se alternan.Each number in the triangle is the sum of the two above it: it is Pascal's sum from card 09. Row n holds the C(n, k) with k from 0 to n, and adds up to 2ⁿ. Why do they appear in the binomial? When expanding (a + b)⁴ = (a + b)(a + b)(a + b)(a + b), each term comes from choosing a or b in each bracket. To get a²b² you must choose b in 2 of the 4 brackets: C(4, 2) = 6 ways. That is why (a + b)⁴ = a⁴ + 4a³b + 6a²b² + 4ab³ + b⁴. If b is negative, the signs alternate.
11 · resta de casos11 · subtracting cases
Cuando la condición estorba, cuenta todo y quita lo que no valeWhen the condition gets in the way, count everything and remove what is not allowed
permitidos = total − no permitidosallowed = total − not allowed
Es la estrategia del apunte: calcular el total, calcular los casos prohibidos y restar. Funciona sobre todo con «al menos uno» y con «separados». Contraseñas de 6 caracteres con al menos un dígito: es más fácil contar las que no tienen ninguno, todo letras, y quitarlas. Dos personas que no pueden estar juntas en una fila: cuenta las filas en que sí están juntas, pegándolas como un bloque, y réstalas del total. «Juntos» se cuenta con el bloque; «separados», con la resta; «en un extremo», fijando primero ese extremo.It is the strategy from the notes: compute the total, compute the forbidden cases and subtract. It works above all with "at least one" and with "apart". 6-character passwords with at least one digit: it is easier to count the ones with none, all letters, and remove them. Two people who cannot be together in a row: count the rows where they are together, gluing them as a block, and subtract from the total. "Together" is counted with the block; "apart", with the subtraction; "at one end", by fixing that end first.
12 · desarreglos12 · derangements
Amigo invisible: nadie se regala a sí mismo, por inclusión y exclusiónSecret Santa: nobody gives to themselves, by inclusion and exclusion
D(n) = n! − C(n, 1)·(n − 1)! + C(n, 2)·(n − 2)! − … ± C(n, n)·0! ≈ n! / e
Total de sorteos con n amigos: n!. Quita los que tienen a alguien que se toca a sí mismo. Si la persona 1 se toca a sí misma, los demás se reparten de (n − 1)! formas, y hay C(n, 1) personas que pueden ser «la que se toca». Pero los sorteos con dos personas fijas los has quitado dos veces, así que los devuelves: C(n, 2)·(n − 2)!. Los de tres los has quitado tres veces y devuelto tres, así que se vuelven a quitar. Signos alternos hasta el final. Es la resta de casos aplicada con cuidado. Para 6 amigos: 720 − 720 + 360 − 120 + 30 − 6 + 1 = 265.Total draws with n friends: n!. Remove those where someone gets themselves. If person 1 gets themselves, the rest are shared out in (n − 1)! ways, and there are C(n, 1) people who can be "the one who gets themselves". But the draws with two fixed people you have removed twice, so you give them back: C(n, 2)·(n − 2)!. The ones with three you removed three times and gave back three, so you remove them again. Alternating signs to the end. It is case subtraction applied carefully. For 6 friends: 720 − 720 + 360 − 120 + 30 − 6 + 1 = 265.
La proporción se estabiliza muy pronto en 1/e ≈ 0,368: con 6 amigos o con 60, el sorteo sale limpio a la primera algo más de una vez de cada tres. Por eso D(n) es el entero más cercano a n!/e: 720/e = 264,87 → 265.The proportion settles very early at 1/e ≈ 0.368: with 6 friends or with 60, the draw comes out clean at the first try a little more than one time in three. That is why D(n) is the integer nearest to n!/e: 720/e = 264.87 → 265.