Skip to content

# public Khan /khan-exercises

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Add pythagorean identity trig exercise

Summary:
Apologies in advance for the awful logic in convert-values... I considered doing something object-oriented but it
seems like it will be almost as ugly that way. Also there is some overlap in the problem types, but there is
actually significant difference in the hints for each, and since the hints are the meat of the exercise anyway,
it seemed ok to keep them as separate.

Reviewers: eater

Reviewed By: eater

CC: emily, eater

Differential Revision: http://phabricator.khanacademy.org/D601
• Loading branch information...
commit b6b17379c1c91a9c874990f4772501f4dc3ff232 1 parent c069833
authored

Showing 2 changed files with 745 additions and 0 deletions.

1. exercises/pythagorean_identities.html
2. utils/convert-values.js
560  exercises/pythagorean_identities.html
 ... ... @@ -0,0 +1,560 @@ 1 + 2 + 3 + 4 +  5 + Pythagorean trig identities 6 +  7 + 8 + 9 +
10 +
11 +
12 +
13 +  14 + shuffle(["\\sin\\theta", "\\cos\\theta", 15 + "\\tan\\theta", "\\sec\\theta", "\\csc\\theta", 16 + "\\cot\\theta"]).slice(0,3) 17 +  18 + randFromArray(OPTIONS) 19 + random() < 0.5 20 +
21 +

22 +

23 + (\sin^2 \theta + \cos^2 \theta)(FUNC)  24 + = \; ? 25 +
26 +
27 + \dfrac{FUNC} 28 + {\sin^2 \theta + \cos^2 \theta} = \; ? 29 +
30 +

31 +
FUNC
32 + 33 +
34 +
• op
•  35 +
36 +
37 +
38 + We can use the identity  39 + \blue{\sin^2 \theta} + \orange{\cos^2 \theta} 40 + = 1 41 + to simplify this expression. 42 +
43 + init({ 44 + range: [[-1.2, 1.2], [-1.3, 1.3]], 45 + scale: 130 46 + }); 47 + with(KhanUtil.currentGraph) { 48 + style({ 49 + stroke: "#ddd", 50 + strokeWidth: 1, 51 + arrows: "->" 52 + }); 53 + circle([0, 0], 1); 54 + line([-1.2, 0], [1.2, 0]); 55 + line([0, -1.2], [0, 1.2]); 56 + line([1.2, 0], [-1.2, 0]); 57 + line([0, 1.2], [0, -1.2]); 58 + style({ 59 + strokeWidth: 2.5, 60 + arrows: "" 61 + }); 62 + ang = 2*Math.PI/3; 63 + line([0, 0], [cos(ang), sin(ang)], 64 + {stroke: "black"}); 65 + label([cos(ang)/2, sin(ang)/2],  66 + "1", "above right"); 67 + line([0, 0], [cos(ang), 0],  68 + {stroke: ORANGE}); 69 + label([cos(ang), sin(ang)/2],  70 + "\\blue{\\sin\\theta}", "left"); 71 + line([cos(ang), 0],  72 + [cos(ang), sin(ang)], 73 + {stroke: BLUE}); 74 + label([cos(ang)/2, 0],  75 + "\\orange{\\cos\\theta}", "below"); 76 + arc([0,0], 0.2, 0, 120,  77 + {stroke: "black", arrows: "->"}); 78 + label([0,0.1], "\\theta", "above right"); 79 + } 80 +
81 + We can see why this is true by using the  82 + Pythagorean Theorem. 83 +
84 +

85 + So, (\sin^2 \theta + \cos^2 \theta)(FUNC)  86 + = 1 \cdot FUNC = FUNC 87 +

88 +

89 + So, \dfrac{FUNC} 90 + {\sin^2 \theta + \cos^2 \theta} =  91 + \dfrac{FUNC}{1} = FUNC 92 +

93 +
94 +
95 +
96 +
97 + random() < 0.5 98 + random() < 0.5 99 +  100 + SIN ? ["1 - \\sin^2\\theta", "\\cos^2\\theta"] 101 + : ["1 - \\cos^2\\theta", "\\sin^2\\theta"] 102 +  103 +  104 + trig.getOptionsResult(EQUIV, (MULT ? "*" : "/")) 105 +  106 +  107 + MULT ?  108 + trig.showSimplified(FUNC) : trig.showSimplified(FUNC, true) 109 +  110 +
111 + 112 +

113 +

114 + (IDENT)(FUNC) = \; ? 115 +
116 +
117 + \dfrac{IDENT}{FUNC}  118 + = \; ? 119 +
120 +

121 + 122 +
ANS 123 +
124 + 125 +
126 +
• op
•  127 +
128 + 129 +
130 +
131 + We can use the identity  132 + \blue{\sin^2 \theta} + \orange{\cos^2 \theta} 133 + = 1 134 + to simplify this expression. 135 +
136 + init({ 137 + range: [[-1.2, 1.2], [-1.3, 1.3]], 138 + scale: 130 139 + }); 140 + with(KhanUtil.currentGraph) { 141 + style({ 142 + stroke: "#ddd", 143 + strokeWidth: 1, 144 + arrows: "->" 145 + }); 146 + circle([0, 0], 1); 147 + line([-1.2, 0], [1.2, 0]); 148 + line([0, -1.2], [0, 1.2]); 149 + line([1.2, 0], [-1.2, 0]); 150 + line([0, 1.2], [0, -1.2]); 151 + style({ 152 + strokeWidth: 2.5, 153 + arrows: "" 154 + }); 155 + ang = 2*Math.PI/3; 156 + line([0, 0], [cos(ang), sin(ang)], 157 + {stroke: "black"}); 158 + label([cos(ang)/2, sin(ang)/2],  159 + "1", "above right"); 160 + line([0, 0], [cos(ang), 0],  161 + {stroke: ORANGE}); 162 + label([cos(ang), sin(ang)/2],  163 + "\\blue{\\sin\\theta}", "left"); 164 + line([cos(ang), 0],  165 + [cos(ang), sin(ang)], 166 + {stroke: BLUE}); 167 + label([cos(ang)/2, 0],  168 + "\\orange{\\cos\\theta}", "below"); 169 + arc([0,0], 0.2, 0, 120,  170 + {stroke: "black", arrows: "->"}); 171 + label([0,0.1], "\\theta", "above right"); 172 + } 173 +
174 + We can see why this is true by using the  175 + Pythagorean Theorem. 176 +

177 +
178 +
179 + So, IDENT = EQUIV 180 +

181 +
182 +
183 + Plugging into our expression, we get 184 +
185 +

\qquad (EQUIV)(FUNC)  186 +

187 +
188 +
189 +

\qquad \dfrac{EQUIV} 190 + {FUNC}

191 +
192 +
193 +
194 + To make simplifying easier, let's put everything 195 + in terms of \sin and \cos.  196 + FUNC = FUNC_SIMP 197 + , so we can plug that in to get 198 +
199 +

\qquad 200 + \left(EQUIV\right) 201 + \left(FUNC_SIMP\right)  202 +

203 +
204 +
205 +

\qquad \dfrac{EQUIV} 206 + {FUNC_SIMP} 207 +

208 +
209 +
210 +
211 + This is ANS. 212 +
213 +
214 +
215 +
216 +
217 + random() < 0.5 218 + random() < 0.5 219 +  220 + TAN ? ["1 + \\tan^2\\theta", "\\sec^2\\theta"] 221 + : ["\\sec^2\\theta-1", "\\tan^2\\theta"] 222 +  223 +  224 + trig.getOptionsResult(EQUIV, (MULT ? "*" : "/")) 225 +  226 +  227 + [trig.showSimplified(FUNC, !MULT), 228 + trig.showSimplified(EQUIV, !MULT)] 229 +  230 +  231 + trig.showSimplified(ANS) 232 +  233 +
234 + 235 +

236 +

237 + (IDENT)(FUNC) = \; ? 238 +
239 +
240 + \dfrac{IDENT}{FUNC}  241 + = \; ? 242 +
243 +

244 + 245 +
ANS 246 +
247 + 248 +
249 +
• op
•  250 +
251 + 252 +
253 +
254 + We can derive a useful identity from  255 + \blue{\sin^2 \theta} + \orange{\cos^2 \theta} 256 + = 1 257 + to simplify this expression. 258 +
259 + init({ 260 + range: [[-1.2, 1.2], [-1.3, 1.3]], 261 + scale: 130 262 + }); 263 + with(KhanUtil.currentGraph) { 264 + style({ 265 + stroke: "#ddd", 266 + strokeWidth: 1, 267 + arrows: "->" 268 + }); 269 + circle([0, 0], 1); 270 + line([-1.2, 0], [1.2, 0]); 271 + line([0, -1.2], [0, 1.2]); 272 + line([1.2, 0], [-1.2, 0]); 273 + line([0, 1.2], [0, -1.2]); 274 + style({ 275 + strokeWidth: 2.5, 276 + arrows: "" 277 + }); 278 + ang = 2*Math.PI/3; 279 + line([0, 0], [cos(ang), sin(ang)], 280 + {stroke: "black"}); 281 + label([cos(ang)/2, sin(ang)/2],  282 + "1", "above right"); 283 + line([0, 0], [cos(ang), 0],  284 + {stroke: ORANGE}); 285 + label([cos(ang), sin(ang)/2],  286 + "\\blue{\\sin\\theta}", "left"); 287 + line([cos(ang), 0],  288 + [cos(ang), sin(ang)], 289 + {stroke: BLUE}); 290 + label([cos(ang)/2, 0],  291 + "\\orange{\\cos\\theta}", "below"); 292 + arc([0,0], 0.2, 0, 120,  293 + {stroke: "black", arrows: "->"}); 294 + label([0,0.1], "\\theta", "above right"); 295 + } 296 +
297 + We can see why this identity is true by using the  298 + Pythagorean Theorem. 299 +

300 +
301 +
302 + Dividing both sides by \cos^2\theta, we get 303 +

\qquad \dfrac{\sin^2\theta}{\cos^2\theta}  304 + + \dfrac{\cos^2\theta}{\cos^2\theta}  305 + = \dfrac{1}{\cos^2\theta}

306 +
307 + \qquad 1 + \tan^2\theta = \sec^2\theta 308 +
309 +

\qquad IDENT  310 + = EQUIV

311 +
312 +
313 + Plugging into our expression, we get 314 +
315 +

\qquad 316 + \left(EQUIV\right) 317 + \left(FUNC\right)  318 +

319 +
320 +
321 +

\qquad 322 + \dfrac{EQUIV} 323 + {FUNC} 324 +

325 +
326 +
327 +
328 + To make simplifying easier, let's put everything 329 + in terms of \sin and \cos. 330 + We know EQUIV  331 + = EQUIV_SIMP 332 + and FUNC = FUNC_SIMP 333 + , so we can substitute to get 334 +
335 +

\qquad  336 + \left(EQUIV\right) 337 + \left(FUNC_SIMP\right)  338 +

339 +

\qquad  340 + \left(EQUIV_SIMP\right) 341 + \left(FUNC_SIMP\right)  342 +

343 +
344 +
345 +

\qquad \dfrac{EQUIV} 346 + {FUNC_SIMP}

347 +

\qquad \dfrac{EQUIV_SIMP} 348 + {FUNC_SIMP}

349 +
350 +
351 +
352 + To make simplifying easier, let's put everything 353 + in terms of \sin and \cos. 354 + We know EQUIV  355 + = EQUIV_SIMP, so we can substitute 356 + to get 357 +
358 +

\qquad 359 + \left(EQUIV\right) 360 + \left(FUNC_SIMP\right)  361 +

362 +

\qquad 363 + \left(EQUIV_SIMP\right) 364 + \left(FUNC_SIMP\right)  365 +

366 +
367 +
368 +

\qquad 369 + \dfrac{EQUIV} 370 + {FUNC_SIMP} 371 +

372 +

\qquad 373 + \dfrac{EQUIV_SIMP} 374 + {FUNC_SIMP} 375 +

376 +
377 +
378 +
379 + This is ANS_SIMP = ANS. 380 +
381 +
382 + This is ANS. 383 +
384 +
385 +
386 +
387 +
388 + random() < 0.5 389 + random() < 0.5 390 +  391 + COT ? ["1 + \\cot^2\\theta", "\\csc^2\\theta"] 392 + : ["\\csc^2\\theta-1", "\\cot^2\\theta"] 393 +  394 +  395 + trig.getOptionsResult(EQUIV, (MULT ? "*" : "/")) 396 +  397 +  398 + [trig.showSimplified(FUNC, !MULT), 399 + trig.showSimplified(EQUIV, !MULT)] 400 +  401 +  402 + trig.showSimplified(ANS) 403 +  404 +
405 + 406 +

407 +

408 + (IDENT)(FUNC) = \; ? 409 +
410 +
411 + \dfrac{IDENT}{FUNC}  412 + = \; ? 413 +
414 +

415 + 416 +
ANS 417 +
418 + 419 +
420 +
• op
•  421 +
422 + 423 +
424 +
425 + We can derive a useful identity from  426 + \blue{\sin^2 \theta} + \orange{\cos^2 \theta} 427 + = 1 428 + to simplify this expression. 429 +
430 + init({ 431 + range: [[-1.2, 1.2], [-1.3, 1.3]], 432 + scale: 130 433 + }); 434 + with(KhanUtil.currentGraph) { 435 + style({ 436 + stroke: "#ddd", 437 + strokeWidth: 1, 438 + arrows: "->" 439 + }); 440 + circle([0, 0], 1); 441 + line([-1.2, 0], [1.2, 0]); 442 + line([0, -1.2], [0, 1.2]); 443 + line([1.2, 0], [-1.2, 0]); 444 + line([0, 1.2], [0, -1.2]); 445 + style({ 446 + strokeWidth: 2.5, 447 + arrows: "" 448 + }); 449 + ang = 2*Math.PI/3; 450 + line([0, 0], [cos(ang), sin(ang)], 451 + {stroke: "black"}); 452 + label([cos(ang)/2, sin(ang)/2],  453 + "1", "above right"); 454 + line([0, 0], [cos(ang), 0],  455 + {stroke: ORANGE}); 456 + label([cos(ang), sin(ang)/2],  457 + "\\blue{\\sin\\theta}", "left"); 458 + line([cos(ang), 0],  459 + [cos(ang), sin(ang)], 460 + {stroke: BLUE}); 461 + label([cos(ang)/2, 0],  462 + "\\orange{\\cos\\theta}", "below"); 463 + arc([0,0], 0.2, 0, 120,  464 + {stroke: "black", arrows: "->"}); 465 + label([0,0.1], "\\theta", "above right"); 466 + } 467 +
468 + We can see why this identity is true by using the  469 + Pythagorean Theorem. 470 +

471 +
472 +
473 + Dividing both sides by \sin^2\theta, we get 474 +

\qquad \dfrac{\sin^2\theta}{\sin^2\theta}  475 + + \dfrac{\cos^2\theta}{\sin^2\theta}  476 + = \dfrac{1}{\sin^2\theta}

477 +
478 + \qquad 1 + \cot^2\theta = \csc^2\theta 479 +
480 +

\qquad IDENT  481 + = EQUIV

482 +
483 +
484 + Plugging into our expression, we get 485 +
486 +

\qquad 487 + \left(EQUIV\right) 488 + \left(FUNC\right)  489 +

490 +
491 +
492 +

\qquad 493 + \dfrac{EQUIV} 494 + {FUNC} 495 +

496 +
497 +
498 +
499 + To make simplifying easier, let's put everything 500 + in terms of \sin and \cos. 501 + We know EQUIV  502 + = EQUIV_SIMP 503 + and FUNC = FUNC_SIMP 504 + , so we can substitute to get 505 +
506 +

\qquad  507 + \left(EQUIV\right) 508 + \left(FUNC_SIMP\right)  509 +

510 +

\qquad  511 + \left(EQUIV_SIMP\right) 512 + \left(FUNC_SIMP\right)  513 +

514 +
515 +
516 +

\qquad \dfrac{EQUIV} 517 + {FUNC_SIMP}

518 +

\qquad \dfrac{EQUIV_SIMP} 519 + {FUNC_SIMP}

520 +
521 +
522 +
523 + To make simplifying easier, let's put everything 524 + in terms of \sin and \cos. 525 + We know EQUIV  526 + = EQUIV_SIMP, so we can substitute 527 + to get 528 +
529 +

\qquad 530 + \left(EQUIV\right) 531 + \left(FUNC_SIMP\right)  532 +

533 +

\qquad 534 + \left(EQUIV_SIMP\right) 535 + \left(FUNC_SIMP\right)  536 +

537 +
538 +
539 +

\qquad 540 + \dfrac{EQUIV} 541 + {FUNC_SIMP} 542 +

543 +

\qquad 544 + \dfrac{EQUIV_SIMP} 545 + {FUNC_SIMP} 546 +

547 +
548 +
549 +
550 + This is ANS_SIMP = ANS. 551 +
552 +
553 + This is ANS. 554 +
555 +
556 +
557 +
558 +
559 + 560 +
185  utils/convert-values.js
 @@ -216,3 +216,188 @@ $.extend(KhanUtil, { 216 216  return toReturn; 217 217  } 218 218  }); 219 + 220 +// I would love to hear a better way of doing this than this mess 221 +$.extend(KhanUtil, { 222 + trig: { 223 + // given the simplification of a trig identity and an operation, 224 + // finds a pair (function, result) such that that simplification 225 + // operation'd with function equals result, and result is not a  226 + // horrible mess of trig functions with sin^4 everywhere and all that 227 + getOptionsResult: function(firstPart, operation) { 228 + var options; 229 + var func; 230 + if(firstPart === "\\cos^2\\theta") { 231 + options = ["1", "\\cot^2\\theta",  232 + "\\cos^2\\theta \\cdot \\sin^2\\theta"]; 233 + } 234 + else if(firstPart === "\\sin^2\\theta") { 235 + options = ["1", "\\tan^2\\theta",  236 + "\\cos^2\\theta \\cdot \\sin^2\\theta"]; 237 + } 238 + else if(firstPart === "\\tan^2\\theta") { 239 + options = ["1", "\\sin^2\\theta", 240 + "\\sec^2\\theta"]; 241 + } 242 + else if(firstPart === "\\sec^2\\theta") { 243 + options = ["1", "\\tan^2\\theta", "\\csc^2\\theta"]; 244 + } 245 + else if(firstPart === "\\cot^2\\theta") { 246 + options = ["1", "\\cos^2\\theta", "\\csc^2\\theta"]; 247 + } 248 + else if(firstPart === "\\csc^2\\theta") { 249 + options = ["1", "\\cot^2\\theta", "\\sec^2\\theta"]; 250 + } 251 + 252 + var result = KhanUtil.randFromArray(options); 253 + if(operation === "*") { 254 + if(result === "1") { 255 + if(firstPart === "\\cos^2\\theta") { 256 + func = "\\sec^2\\theta"; 257 + } 258 + else if(firstPart === "\\sin^2\\theta") { 259 + func = "\\csc^2\\theta"; 260 + } 261 + else if(firstPart === "\\tan^2\\theta") { 262 + func = "\\cot^2\\theta"; 263 + } 264 + else if(firstPart === "\\sec^2\\theta") { 265 + func = "\\cos^2\\theta"; 266 + } 267 + else if(firstPart === "\\cot^2\\theta") { 268 + func = "\\tan^2\\theta"; 269 + } 270 + else if(firstPart === "\\csc^2\\theta") { 271 + func = "\\sin^2\\theta"; 272 + } 273 + } 274 + else if(result === "\\tan^2\\theta") { 275 + if(firstPart === "\\sin^2\\theta") { 276 + func = "\\sec^2\\theta"; 277 + } 278 + else if(firstPart === "\\sec^2\\theta") { 279 + func = "\\sin^2\\theta"; 280 + } 281 + } 282 + else if(result === "\\cot^2\\theta") { 283 + if(firstPart === "\\cos^2\\theta") { 284 + func = "\\csc^2\\theta"; 285 + } 286 + else if(firstPart === "\\csc^2\\theta") { 287 + func = "\\cos^2\\theta"; 288 + } 289 + } 290 + else if(result === "\\cos^2\\theta \\cdot \\sin^2\\theta") { 291 + if(firstPart === "\\cos^2\\theta") { 292 + func = "\\sin^2\\theta"; 293 + } 294 + else if(firstPart === "\\sin^2\\theta") { 295 + func = "\\cos^2\\theta"; 296 + } 297 + } 298 + else if(result === "\\sin^2\\theta") { 299 + if(firstPart === "\\tan^2\\theta") { 300 + func = "\\cos^2\\theta"; 301 + } 302 + } 303 + else if(result === "\\cos^2\\theta") { 304 + if(firstPart === "\\cot^2\\theta") { 305 + func = "\\sin^2\\theta"; 306 + } 307 + } 308 + else if(result === "\\sec^2\\theta") { 309 + if(firstPart === "\\tan^2\\theta") { 310 + func = "\\csc^2\\theta"; 311 + } 312 + else if(firstPart === "\\csc^2\\theta") { 313 + func = "\\tan^2\\theta"; 314 + } 315 + } 316 + else if(result === "\\csc^2\\theta") { 317 + if(firstPart === "\\sec^2\\theta") { 318 + func = "\\cot^2\\theta"; 319 + } 320 + else if(firstPart === "\\cot^2\\theta") { 321 + func = "\\sec^2\\theta"; 322 + } 323 + } 324 + } 325 + 326 + else if(operation === "/") { 327 + if(result === "1") { 328 + func = firstPart; 329 + } 330 + else if(result === "\\tan^2\\theta") { 331 + if(firstPart === "\\sin^2\\theta") { 332 + func = "\\cos^2\\theta"; 333 + } 334 + else if(firstPart === "\\sec^2\\theta") { 335 + func = "\\csc^2\\theta"; 336 + } 337 + } 338 + else if(result === "\\cot^2\\theta") { 339 + if(firstPart === "\\cos^2\\theta") { 340 + func = "\\sin^2\\theta"; 341 + } 342 + else if(firstPart === "\\csc^2\\theta") { 343 + func = "\\sec^2\\theta"; 344 + } 345 + } 346 + else if (result === "\\cos^2\\theta \\cdot \\sin^2\\theta") { 347 + if(firstPart === "\\cos^2\\theta") { 348 + func = "\\csc^2\\theta"; 349 + } 350 + else if(firstPart === "\\sin^2\\theta") { 351 + func = "\\sec^2\\theta"; 352 + } 353 + } 354 + else if (result === "\\sin^2\\theta") { 355 + if(firstPart === "\\tan^2\\theta") { 356 + func = "\\sec^2\\theta"; 357 + } 358 + } 359 + else if(result === "\\cos^2\\theta") { 360 + if(firstPart === "\\cot^2\\theta") { 361 + func = "\\csc^2\\theta"; 362 + } 363 + } 364 + else if (result === "\\sec^2\\theta") { 365 + if(firstPart === "\\tan^2\\theta") { 366 + func = "\\sin^2\\theta"; 367 + } 368 + else if(firstPart === "\\csc^2\\theta") { 369 + func = "\\cot^2\\theta"; 370 + } 371 + } 372 + else if (result === "\\csc^2\\theta") { 373 + if(firstPart === "\\sec^2\\theta") { 374 + func = "\\tan^2\\theta"; 375 + } 376 + else if(firstPart === "\\cot^2\\theta") { 377 + func = "\\cos^2\\theta"; 378 + } 379 + } 380 + } 381 + return [options, func, result]; 382 + }, 383 + 384 + // expresses the given trig^2 function in terms of sin and cosine 385 + showSimplified: function(func, small) { 386 + d = small ? "\\frac" : "\\dfrac"; 387 + switch(func) { 388 + case "\\sin^2\\theta" :  389 + return func; 390 + case "\\cos^2\\theta" : 391 + return func; 392 + case "\\csc^2\\theta" : 393 + return d+"{1}{\\sin^2\\theta}"; 394 + case "\\sec^2\\theta" : 395 + return d+"{1}{\\cos^2\\theta}"; 396 + case "\\tan^2\\theta" : 397 + return d+"{\\sin^2\\theta}{\\cos^2\\theta}"; 398 + case "\\cot^2\\theta" : 399 + return d+"{\\cos^2\\theta}{\\sin^2\\theta}"; 400 + } 401 + } 402 + } 403 +});

## 0 notes on commit b6b1737

Please sign in to comment.
Something went wrong with that request. Please try again.