Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 85 lines (81 sloc) 5.418 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
<!DOCTYPE html>
<html data-require="math math-format word-problems">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Permutations</title>
    <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
    <div class="exercise">
        <div class="problems">
            <div id="letters" data-weight="3">
                <div class="vars" data-ensure="WORD != PERM">
                    <var id="INDEX">randRange(0,11)</var>
                    <var id="WORD">["CLAW", "OPAL", "APE", "RULES", "ANGER", "SLIME", "FEAT", "FANCY", "SONG", "DEN", "TIGER", "IRON"][INDEX]</var>
                    <var id="PERM">shuffle(WORD).join("")</var>
                    <var id="ANSWER">factorial(WORD.length)</var>
                </div>
                <p class="question">How many unique ways are there to arrange the letters in the word <var>WORD</var>?</p>
                <p class="solution" data-forms="integer"><var>ANSWER</var></p>
                <div class="hints">
                    <div>
                        <p>Let's try building the re-arrangements (or permutations) letter by letter. The word is <var>WORD.length</var>
                        letters long:</p>
                        <p><var>_.map(_.range(WORD.length), function(l){ return "_ "; }).join("")</var></p>
                        <p>Now, for the first blank, we have <var>WORD.length</var> choices of letters to put in.
                    </p></div>
                    <div>
                        <p>After we put in the first letter, let's say it's <var>PERM[0]</var>, we have <var>WORD.length-1</var> blanks left.</p>
                        <p><var>PERM[0]+" "+_.map(_.range(WORD.length-1), function(l){ return "_ "; }).join("")</var></p>
                        <p>For the second blank, we only have <var>WORD.length-1</var> choices of letters left to put in. So far, there were
                            <code><var>WORD.length</var> \cdot <var>WORD.length-1</var></code> unique choices we could have made.</p>
                    </div>
                    <div>
                        We can continue in this fashion to put in a third letter, then a fourth, and so on. At each step, we have one fewer unique choice to
                        make, until we get to the last letter, and there's only one we can put in.
                    <br><br>
                    </div>
                    <div>
                        So, the total number of unique re-arrangements must be <code><var>_.map(_.range(WORD.length).reverse(), function(l){ return (++l);}).join("\\cdot")</var>.</code> Another way of writing this is <code><var>WORD.length</var>!</code>,
                        or <var>WORD.length</var> factorial, which is <var>ANSWER</var>.
                    </div>
                </div>
            </div>

            <div id="reindeer" data-weight="2">
                <div class="vars">
                    <var id="NUM_NAMES">randRange(4,5)</var>
                    <var id="NAMES">_.map(randRangeUnique(0,8,NUM_NAMES), function(n){
                        return ["Bloopin", "Gloopin", "Prancer", "Lancer", "Quentin", "Balthazar", "Ezekiel", "Jebediah", "Rudy"][n];
                    })
                    </var>
                    <var id="SLOTS">randRange(3, NAMES.length-1)</var>
                    <var id="ANSWER">factorial(NAMES.length)/factorial(NAMES.length-SLOTS)</var>
                </div>
                <p>
                    You have <var>NAMES.length</var> reindeer, <var>toSentence(NAMES)</var>, and you want to have <var>SLOTS</var> fly your sleigh.
                    You always have your reindeer fly in a single-file line.
                </p>

                <p class="question">How many different ways can you arrange your reindeer?</p>
                <p class="solution" data-forms="integer"><var>ANSWER</var></p>

                <div class="hints">
                    <div>
                        <p>We can build our line of reindeer one by one: there are <var>SLOTS</var> slots, and we have <var>NAMES.length</var>
                        different reindeer we can put in the first slot.</p>
                    </div>
                    <p>
                        Once we fill the first slot, we only have <var>NAMES.length-1</var> reindeer left, so we only have <var>NAMES.length-1</var>
                        choices for the second slot. So far, there are <code><var>NAMES.length</var> \cdot <var>NAMES.length-1</var> = <var>NAMES.length*(NAMES.length-1)</var></code> unique choices we can make.
                    </p>
                    <p>
                        We can continue in this way for the third reindeer, and so on, until we reach the last slot, where we will
                        have <var>NAMES.length - SLOTS + 1</var> choices for the last reindeer.
                    </p>
                    <p>
                        So, the total number of unique choices we could make to get to an arrangement of reindeer is <code><var>_.map(_.range(SLOTS), function(l){ return (NAMES.length - l);}).join("\\cdot")</var>.</code> Another way of writing this is <code> \dfrac{<var>NAMES.length</var>!}{(<var>NAMES.length</var>-<var>SLOTS</var>)!} = <var>ANSWER</var></code>
                    </p>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
Something went wrong with that request. Please try again.