Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 332 lines (312 sloc) 14.755 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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
<!DOCTYPE html>
<html data-require="math math-format graphie graphie-geometry angles">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Law of cosines</title>
    <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
    <div class="problems">
        <div id="find-side" data-calculator="">
            <div class="vars" data-ensure="
!TRIANGLE.isRight() &amp;&amp;
TRIANGLE.isScalene() &amp;&amp;
TRIANGLE.isNotDegenerate()">
                <var id="SIDES">shuffle([null].
                    concat(randRangeUnique(5, 16, 2)))</var>
                <var id="ANGLES">_.map(SIDES, function(s) {
                    if (s === null) {
                        return randRange(20, 140);
                    }
                    return null;
                })</var>
                <var id="TRIANGLE">solveTriangle({
                    sides: SIDES.slice(),
                    angles: ANGLES.slice(),
                    sideLabels: SIDES.slice(),
                    angleLabels: _.map(ANGLES, function(a) {
                        return a == null ? a : a + "^\\circ";
                    }),
                    vertexLabels: ["A", "B", "C"]
                })</var>
                <var id="UNKNOWN">SIDES.indexOf(null)</var>
                <var id="UNKNOWN_MEASURE">["BC", "AC", "AB"][UNKNOWN]</var>
                <var id="UNKNOWN_SIDE">"abc"[UNKNOWN]</var>
                <var id="KNOWN_SIDE_1">SIDES[(UNKNOWN + 1) % 3]</var>
                <var id="KNOWN_SIDE_2">SIDES[(UNKNOWN + 2) % 3]</var>
                <var id="SOLUTION">roundTo(1, sqrt(KNOWN_SIDE_1 * KNOWN_SIDE_1
                    + KNOWN_SIDE_2 * KNOWN_SIDE_2 - 2 * KNOWN_SIDE_1 *
                    KNOWN_SIDE_2 * cos(ANGLES[UNKNOWN] * PI / 180)))
                </var>
                <!-- Limit rotation such that the final triangle fills up more
width than height -->
                <var id="ROTATION">
                    rand(2) ? randRange(-20, 20) : randRange(160, 200)
                </var>
            </div>

            <p class="question">
                Find <code><var>UNKNOWN_MEASURE</var></code>.
            </p>

            <div class="problem">
                <p>
                    Round to the nearest tenth.
                </p>
                <div class="graphie" id="triangle">
                    TRIANGLE = addTriangle(_.extend(TRIANGLE, {
                        xPos: 1,
                        yPos: 1,
                        width: 10,
                        height: 6,
                        rot: ROTATION
                    }));
                    init({
                        range: [[0, TRIANGLE.width + 2],
                            [0, TRIANGLE.height + 2]]
                    });

                    TRIANGLE.draw();
                </div>
            </div>
            <div class="solution" data-forms="integer, decimal" data-inexact="" data-max-error="0.09"><var>SOLUTION</var>
            </div>

            <div class="hints">
                <div>
                    <p>You can use the law of cosines:</p>
                    <p><code>\qquad
                        \pink{<var>UNKNOWN_SIDE</var>}^2 \quad = \quad
                        \blue{<var>"abc"[(UNKNOWN + 1) % 3]</var>}^2 +
                        \green{<var>"abc"[(UNKNOWN + 2) % 3]</var>}^2 -
                        2\blue{<var>"abc"[(UNKNOWN + 1) % 3]</var>}
                        \green{<var>"abc"[(UNKNOWN + 2) % 3]</var>}
                        \space\cos(\pink{<var>"ABC"[UNKNOWN]</var>})
                    </code></p>
                    <div class="graphie" data-update="triangle">
                        TRIANGLE.sideLabels = _.map(SIDES, function(s, n) {
                            return s == null ? "abc"[n] :
                                "abc"[n] + " = " + s;
                        });
                        TRIANGLE.sideLabels[UNKNOWN] = "\\pink{" +
                            TRIANGLE.sideLabels[UNKNOWN] + "}";
                        TRIANGLE.angleLabels[UNKNOWN] = "\\pink{" +
                            TRIANGLE.angleLabels[UNKNOWN] + "}";
                        TRIANGLE.sideLabels[(UNKNOWN + 1) % 3] = "\\blue{" +
                            TRIANGLE.sideLabels[(UNKNOWN + 1) % 3] + "}";
                        TRIANGLE.sideLabels[(UNKNOWN + 2) % 3] = "\\green{" +
                            TRIANGLE.sideLabels[(UNKNOWN + 2) % 3] + "}";
                        TRIANGLE.color = GRAY;
                        TRIANGLE.draw();
                    </div>
                </div>

                <div>
                    <p>Plug in the known values:</p>
                    <p><code>\qquad
                        \pink{<var>UNKNOWN_SIDE</var>}^2 \quad = \quad
                        \blue{<var>KNOWN_SIDE_1</var>}^2 +
                        \green{<var>KNOWN_SIDE_2</var>}^2 -
                        2(\blue{<var>KNOWN_SIDE_1</var>})
                        (\green{<var>KNOWN_SIDE_2</var>})
                        \space\cos(\pink{<var>ANGLES[UNKNOWN]</var>^\circ})
                    </code></p>
                </div>

                <div>
                    <p><code>\qquad
                        \pink{<var>UNKNOWN_SIDE</var>}^2 \quad = \quad
                        <var>
                            KNOWN_SIDE_1 * KNOWN_SIDE_1 +
                            KNOWN_SIDE_2 * KNOWN_SIDE_2
                        </var> - <var>
                            2 * KNOWN_SIDE_1 * KNOWN_SIDE_2
                        </var>
                        \cdot\cos(\pink{<var>ANGLES[UNKNOWN]</var>^\circ})
                    </code></p>
                </div>

                <div>
                    <p>Evaluate and simplify the right side:</p>
                    <p><code>\qquad
                        \pink{<var>UNKNOWN_SIDE</var>}^2 \quad \approx \quad
                        <var>roundTo(9,
                            KNOWN_SIDE_1 * KNOWN_SIDE_1 +
                            KNOWN_SIDE_2 * KNOWN_SIDE_2 -
                            2 * KNOWN_SIDE_1 * KNOWN_SIDE_2 *
                            cos(ANGLES[UNKNOWN] * Math.PI / 180))
                        </var>
                    </code></p>
                </div>

                <div>
                    <p>Take the positive square root of both sides (we only
                    need to worry about the positive square root because the
                    side of a triangle can't have negative length):</p>
                    <p><code>\qquad
                        \pink{<var>UNKNOWN_SIDE</var>} \quad \approx \quad
                        \sqrt{<var>roundTo(9,
                            KNOWN_SIDE_1 * KNOWN_SIDE_1 +
                            KNOWN_SIDE_2 * KNOWN_SIDE_2 -
                            2 * KNOWN_SIDE_1 * KNOWN_SIDE_2 *
                            cos(ANGLES[UNKNOWN] * Math.PI / 180))
                        </var>}
                    </code></p>
                </div>

                <div>
                    <p>Evaluate and round to the nearest tenth:</p>
                    <p><code>
                        \qquad \pink{<var>UNKNOWN_MEASURE</var>}
                        \quad = \quad \pink{<var>UNKNOWN_SIDE</var>}
                        \quad \approx \quad <var>SOLUTION</var>
                    </code></p>
                    <div class="graphie" data-update="triangle">
                        TRIANGLE.sideLabels[UNKNOWN] = "\\pink{" +
                            UNKNOWN_SIDE + " \\approx " + SOLUTION + "}";
                        TRIANGLE.draw();
                    </div>
                </div>
            </div>
        </div>

        <div id="sss-find-angle" data-calculator="">
            <div class="vars" data-ensure="
!TRIANGLE.isRight() &amp;&amp;
TRIANGLE.isScalene() &amp;&amp;
TRIANGLE.isNotDegenerate()">
                <var id="SIDES" data-ensure="
SIDES[1] + SIDES[2] &gt; SIDES[0] &amp;&amp;
SIDES[0] + SIDES[2] &gt; SIDES[1] &amp;&amp;
SIDES[0] + SIDES[1] &gt; SIDES[2]
">randRange(5, 15, 3)</var>
                <var id="TRIANGLE">solveTriangle({
                    sides: SIDES.slice(),
                    angles: [null, null, null],
                    sideLabels: SIDES.slice(),
                    vertexLabels: ["A", "B", "C"]
                })</var>
                <var id="UNKNOWN">randRange(0, 2)</var>
                <var id="UNKNOWN_ANGLE">"ABC"[UNKNOWN]</var>
                <var id="KNOWN_SIDE_1">SIDES[(UNKNOWN + 1) % 3]</var>
                <var id="KNOWN_SIDE_2">SIDES[(UNKNOWN + 2) % 3]</var>
                <var id="COS_UNKNOWN">fraction(
                    KNOWN_SIDE_1 * KNOWN_SIDE_1 +
                    KNOWN_SIDE_2 * KNOWN_SIDE_2 -
                    SIDES[UNKNOWN] * SIDES[UNKNOWN],
                    2 * KNOWN_SIDE_1 * KNOWN_SIDE_2)
                </var>
                <var id="SOLUTION">roundTo(0, acos(
                    (KNOWN_SIDE_1 * KNOWN_SIDE_1 +
                    KNOWN_SIDE_2 * KNOWN_SIDE_2 -
                    SIDES[UNKNOWN] * SIDES[UNKNOWN]) / (2 *
                    KNOWN_SIDE_1 * KNOWN_SIDE_2)) /
                    PI * 180)
                </var>
                <!-- Limit rotation such that the final triangle fills up more
width than height -->
                <var id="ROTATION">
                    rand(2) ? randRange(-20, 20) : randRange(160, 200)
                </var>
            </div>

            <p class="question">
                Find <code>m\angle <var>UNKNOWN_ANGLE</var></code>.
            </p>

            <div class="problem">
                <p>
                    Round to the nearest degree.
                </p>
                <div class="graphie" id="triangle">
                    TRIANGLE = addTriangle(_.extend(TRIANGLE, {
                        xPos: 1,
                        yPos: 1,
                        width: 10,
                        height: 6,
                        rot: ROTATION
                    }));
                    init({
                        range: [[0, TRIANGLE.width + 2],
                            [0, TRIANGLE.height + 2]]
                    });

                    TRIANGLE.draw();
                </div>
            </div>
            <div class="solution" data-type="multiple">
                <span class="sol" data-forms="integer" data-inexact="" data-max-error="0.5"><var>SOLUTION</var>
                </span><code>\Large{^\circ}</code>
            </div>

            <div class="hints">
                <div>
                    <p>You can use the law of cosines:</p>
                    <p><code>\qquad
                        \pink{<var>"abc"[UNKNOWN]</var>}^2 \quad = \quad
                        \blue{<var>"abc"[(UNKNOWN + 1) % 3]</var>}^2 +
                        \green{<var>"abc"[(UNKNOWN + 2) % 3]</var>}^2 -
                        2\blue{<var>"abc"[(UNKNOWN + 1) % 3]</var>}
                        \green{<var>"abc"[(UNKNOWN + 2) % 3]</var>}
                        \space\cos(\pink{<var>"ABC"[UNKNOWN]</var>})
                    </code></p>
                    <div class="graphie" data-update="triangle">
                        TRIANGLE.sideLabels = _.map(SIDES, function(s, n) {
                            return "abc"[n] + " = " + s;
                        });
                        TRIANGLE.sideLabels[UNKNOWN] = "\\pink{" +
                            TRIANGLE.sideLabels[UNKNOWN] + "}";
                        TRIANGLE.vertexLabels[UNKNOWN] = "\\pink{" +
                            "ABC"[UNKNOWN] + "}";
                        TRIANGLE.sideLabels[(UNKNOWN + 1) % 3] = "\\blue{" +
                            TRIANGLE.sideLabels[(UNKNOWN + 1) % 3] + "}";
                        TRIANGLE.sideLabels[(UNKNOWN + 2) % 3] = "\\green{" +
                            TRIANGLE.sideLabels[(UNKNOWN + 2) % 3] + "}";
                        TRIANGLE.color = GRAY;
                        TRIANGLE.draw();
                    </div>
                </div>

                <div>
                    <p>
                        Rewrite the law of cosines to solve for
                        <code>\cos(\pink{<var>"ABC"[UNKNOWN]</var>})</code>:
                    </p>
                    <p><code>\qquad
                        \cos(\pink{<var>"ABC"[UNKNOWN]</var>}) \quad = \quad
                        \dfrac{
                        \blue{<var>"abc"[(UNKNOWN + 1) % 3]</var>}^2 +
                        \green{<var>"abc"[(UNKNOWN + 2) % 3]</var>}^2 -
                        \pink{<var>"abc"[UNKNOWN]</var>}^2
                        }{2\blue{<var>"abc"[(UNKNOWN + 1) % 3]</var>}
                        \green{<var>"abc"[(UNKNOWN + 2) % 3]</var>}}
                    </code></p>
                </div>

                <div>
                    <p>Plug in the known values:</p>
                    <p><code>\qquad
                        \cos(\pink{<var>"ABC"[UNKNOWN]</var>}) \quad = \quad
                        \dfrac{
                        \blue{<var>KNOWN_SIDE_1</var>}^2 +
                        \green{<var>KNOWN_SIDE_2</var>}^2 -
                        \pink{<var>SIDES[UNKNOWN]</var>}^2
                        }{2(\blue{<var>KNOWN_SIDE_1</var>})
                        (\green{<var>KNOWN_SIDE_2</var>})}
                    </code></p>
                </div>

                <div>
                    <p>Simplify the right side:</p>
                    <p><code>\qquad
                        \cos(\pink{<var>"ABC"[UNKNOWN]</var>}) \quad = \quad
                        <var>COS_UNKNOWN</var>
                    </code></p>
                </div>

                <div>
                    <p>
                        Evaluate the inverse cosine to find
                        <code>m\angle <var>UNKNOWN_ANGLE</var></code>
                        and round to the nearest degree:
                    </p>
                    <p><code>\qquad
                        \pink{m\angle <var>UNKNOWN_ANGLE</var>}
                        \quad = \quad \cos^{-1}\left(<var>COS_UNKNOWN</var>\right)
                        \quad \approx \quad \pink{<var>SOLUTION</var>^\circ}
                    </code></p>
                    <div class="graphie" data-update="triangle">
                        TRIANGLE.angleLabels[UNKNOWN] = "\\pink{" +
                            SOLUTION + "^\\circ}";
                        TRIANGLE.draw();
                    </div>
                </div>
            </div>
        </div>

    </div>

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