8. Walking on the Gridlines a. What musician would be most likely to record a song with the same title as this problem? Huey Lewis & the News had a song called “Walking on a Thin Line”. Many disputers pointed out that Johnny Cash should also get credit for “I Walk the Line”; we agreed. Parts b through h refer to paths from A to B in the seven-by-five array of unit squares to the right. Note that a path may pass through a segment or intersection multiple times in any direction, but may only turn at the intersection of two line segments. A How many paths from A to B b. have a length of 12? There are 12 steps to take, and we must choose which five of them will be downward. 12𝑐5 = 12×11×10×9×8 5×4×3×2 = 11 × 9 × 8 = 99 × 8 = 792 B c. have a length of 15? c. Any time we take a step in the wrong direction, we must take an extra step to make up for it, so lengths must be even, so the answer is 0. d. have a length of 18? Combinations must include RRRRRRRDDDDD, and then have three of RL or DU (but can’t start or end with L or U). There are four cases: 3 RLs, 2 RLs & 1 DU, 1 RL & 2 DUs, and 3 DUs. For each case, we can consider the R’s and L’s separately from the D’s & U’s, then combine them. For the 3 RL case, we can start RRR, RRLR, RLRR, RRLLR, or RLRLR, and we can end with the reverse of any of those five cases. This allows us to place all remaining R’s & L’s in the middle as we see fit. Labeling them A-E and V-Z, the only pairings to consider are AV, AW, AX, AY, AZ, BV, BW, BX, BY, BZ, CV, CW, CX, CY, CZ, DV, DW, DX, EV, EW, and EX. For each of these pairings, there are 7𝑐3, 6𝑐2, 6𝑐2, 5𝑐1, 5𝑐1, 6𝑐2, 5𝑐1, 5𝑐1, 4𝑐0, 4𝑐0, 6𝑐2, 5𝑐1, 5𝑐1, 4𝑐0, 4𝑐0, 5𝑐1, 4𝑐0, 4𝑐0, 5𝑐1, 4𝑐0, and 4𝑐0 ways to arrange the central letters, for a total of 35 + 60 + 40 + 8 = 143 ways. Then we must pick five places to insert D’s, which can be done in 18𝑐5 = 18×17×16×15×14 5×4×3×2 = 18 × 17 × 2 × 14 = 306 × 28 = 8568 ways, for a total of 8568 × 143 = 1,225,224 ways. The 3 DU case works similarly, with pairings having 5𝑐3, 4𝑐2, 4𝑐2, 3𝑐1, 3𝑐1, 4𝑐2, 3𝑐1, 3𝑐1, 2𝑐0, 2𝑐0, 4𝑐2, 3𝑐1, 3𝑐1, 2𝑐0, 2𝑐0, 3𝑐1, 2𝑐0, 2𝑐0, 3𝑐1, 2𝑐0, and 2𝑐0 ways to arrange the central letters, for a total of 10 + 24 + 24 + 8 = 66 ways to arrange the D’s and U’s. There are 18𝑐7 = 18×17×16×15×14×13×12 7×6×5×4×3×2 17 × 4 × 3 × 13 × 12 = 221 × 144 = 31824 ways to insert the R’s, for a total of 66 × 31824 = 2,100,384 ways. = For the 2RL & 1 DU case, the DU’s must start and end with a D, giving 5𝑐1 = 5 ways to arrange the central letters. The RL’s can start RR or RLR, and end similarly. The pairings to consider are AY, AZ, BY, and BZ with 7𝑐2, 6𝑐1, 6𝑐1, and 5𝑐0 ways to arrange the central letters, for a total of 21 + 12 + 1 = 34 ways. Then there are 18𝑐7 = 31824 ways to intersperse the two sets, for a total of 31824 × 5 × 34 = 31824 × 170 = 5,410,080 ways. The 1 RL & 2 DU case is similar, with 7𝑐1 = 7 ways to do the RL’s, while the DU’s can have 5𝑐2, 4𝑐1, 4𝑐1, and 3𝑐0 ways, for a total of 10 + 8 + 1 = 19 ways. There are 18𝑐9 = 18×17×16×15×14×13×12× 11×10 9×8×7×6×5×4×3×2 = 17 × 2 × 5 × 2 × 13 × 11 = 221 × 220 = 48620 ways to intersperse them, for a total of 48620 × 7 × 19 = 48620 × 133 = 6,466,460ways. Adding the four cases gives 1,225,224 + 2,100,384 + 5,410,080 + 6,466,460 = 15,202,148. e. turn exactly once? The only way to do this is to turn in the corners, and there are 2 ways to do that. f. turn exactly twice? The only way to do this is to turn on one edge and turn again on the other edge. There are 6 ways to the right and 4 ways heading down, for a total of 6 + 4 = 10. g. turn exactly three times? 180° turns are now an option. Without them, you must turn on an edge, turn before the opposite edge, and then turn on the adjacent edge, giving 6 × 4 × 2 = 48 ways. With one 180° turn, you can reverse on an edge, turn, then turn on the opposite edge (8𝑐2 + 6𝑐2 = 28 + 15 = 43 ways). You can also turn on an edge, turn the wrong way on the opposite edge, and then reverse (another 8𝑐2 + 6𝑐2 = 43 ways). With two 180° turns, you can reverse twice, then turn down the far edge (another 43 ways), or turn at the far edge then reverse twice (another 43 ways). This gives a total of 48 + 4 × 43 = 220 ways. h. have a length of 20 and turn exactly four times? There will be between 0 and 4 RL’s and the complement of DU’s. With only four turns, it’s not possible to use both RL’s and DU’s, so there are 4 of one and 0 of the other. Without 180’s, you must turn on an edge, turn the wrong way before the opposite edge, turn back the way you were headed, and then turn on the opposite edge, so that the 4 wrong ways must all happen in a row (4 × 4 + 2 × 6 = 16 + 12 = 28 ways). With one 180, there are several cases. Reversing on an edge, turning into the middle, turning toward the adjacent edge and turning there can happen in 4 × 4 + 2 × 6 = 28 ways. Turning on an edge, reversing, then turning and turning can happen in another 28 ways. Turning on the first edge, turning the wrong way, reversing, and then turning again can happen in another 28 ways. Turning on the first edge, turning again, turning the wrong way, then reversing can happen in another 28 ways, for a subtotal of 4 × 28 = 112. With two 180’s, there are also several cases. Reversing twice on an edge, then turning and turning can happen in 3 + 4 + 5 + 6 + 3 + 4 = 25 ways. Reversing on an edge, turning to the opposite edge, turning the wrong way there, and then finally reversing can happen in 4 × 3 + 2 × 3 = 12 + 6 = 18 ways. Turning on the first edge, reversing twice, then turning on the opposite edge can happen in 6 × 2 + 4 × 4 = 28 ways. Turning on the first edge, turning the right way on the opposite edge, then reversing twice can happen in another 25 ways, for a subtotal of 25 + 18 + 28 + 25 = 50 + 46 = 96. The overall total is thus 28 + 112 + 96 = 236.