Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 105 lines (83 sloc) 4.196 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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
<!DOCTYPE html>
<html data-require="math graphie">
<head>
    <title>Square roots of perfect squares</title>
    <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
    <div class="exercise">
        <div class="vars">
            <var id="cx">0</var>
            <var id="y">0</var>

            <var id="N">randRange( 2, 12 )</var>
            <var id="F_N">getPrimeFactorization( N )</var>
        </div>

        <div class="hints">
            <p>
                If you can't think of that number, you can break down <code><var>Q</var></code> into
                its prime factorization and look for equal groups of numbers.
            </p>
            <div>
                <p>Let's draw a factor tree.</p>
                <div class="graphie" id="factor-tree">
                    init({
                        range: [ [-1, FACTORIZATION.length + 2], [ -2 * FACTORIZATION.length - 1, 1] ],
                        scale: [30, 30]
                    });

                    label( [cx + 1, y], curr );
                </div>
            </div>

            <div class="graphie" data-each="FACTORIZATION as factor" data-update="factor-tree">
                    path( [ [cx + 1, y - 0.5], [cx, y - 1.5] ] );
                    path( [ [cx + 1, y - 0.5], [cx + 2, y - 1.5] ] );
                    y -= 2;
                    cx += 1;

                    curr = curr / factor;

                    label( [cx - 1, y], factor );
                    circle( [cx - 1, y], 0.5);
                    label( [cx + 1, y], curr );
            </div>

            <div class="graphie" data-update="factor-tree">
                circle( [cx + 1, y], 0.5);
            </div>

            <p>So the prime factorization of <code><var>Q</var></code> is <code><var>PRIMES.join( "\\times " )</var></code>.</p>
        </div>

        <div class="problems">
            <div id="square">
                <div class="vars">
                    <var id="Q">N * N</var>
                    <var id="PRIMES">getPrimeFactorization( Q )</var>
                    <var id="FACTORIZATION">PRIMES.slice( 0, PRIMES.length - 1 )</var>
                    <var id="curr">Q</var>
                </div>

                <p class="question"><code>\Large{\sqrt{<var>Q</var>} = \text{?}}</code></p>

                <p class="solution" data-forms="integer"><var>N</var></p>

                <div class="hints" data-apply="prependContents">
                    <p>
                        <code>\sqrt{<var>Q</var>}</code> is the number that, when
                        multiplied by itself, equals <code><var>Q</var></code>.
                    </p>
                </div>

                <div class="hints" data-apply="appendContents">
                    <p>We're looking for <code>\sqrt{<var>Q</var>}</code>, so we want to split the prime factors into two identical groups.</p>

                    <div data-if="PRIMES.length === 2" data-unwrap="">

                        <p>We only have two prime factors, and we want to split them into two groups, so this is easy.</p>
                        <p><code><var>Q</var> = <var>PRIMES.join( "\\times " )</var></code>, so <code><var>N</var>^2 = <var>Q</var></code>.</p>

                    </div><div data-else="" data-unwrap="">

                        <div>
                            <p>Notice that we can rearrange the factors like so:</p>
                            <p><code><var>Q</var> = <var>PRIMES.join(" \\times ")</var> = \left(<var>F_N.join( "\\times " )</var>\right) \times \left(<var>F_N.join(" \\times ")</var>\right)</code></p>
                        </div>

                        <p data-if="F_N.length > 1">
                            So <code>\left(<var>F_N.join( "\\times " )</var>\right)^2 = <var>N</var>^2 = <var>Q</var></code>.
                        </p><p data-else="">
                            So <code><var>N</var>^2 = <var>Q</var></code>.
                        </p>

                    </div>

                    <p>So <code>\sqrt{<var>Q</var>}</code> is <code><var>N</var></code>.</p>
                </div>

            </div>
        </div>

    </div>
</body>
</html>
Something went wrong with that request. Please try again.