Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 108 lines (106 sloc) 5.145 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
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers math-format graphie-geometry">
<head>
<meta charset="UTF-8" />
<title>Triangle Inequality Theorem</title>
<script src="../khan-exercise.js"></script>
<script>
function randomTriangleWithSides(){
var a = KhanUtil.randRange( 25, 150 );
var b = KhanUtil.randRange( 25, 180 - a );
if ( a + b > 170 ){
a = Math.max( 30, a - 15 );
b = Math.max( 30, b - 15 );
}
var c = 180 - a - b;
var sa = KhanUtil.randRange( 4, 8 );
var sb = sa * Math.sin( b * Math.PI / 180 ) / Math.sin( a * Math.PI / 180 );
var sc = sa * Math.sin( c * Math.PI / 180 ) / Math.sin( a * Math.PI / 180 );
return [ [ a, b, c] , [ sa.toFixed( 1 ), sb.toFixed( 1 ), sc.toFixed( 1 ) ] ];
}
</script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="MAIN">randomTriangleWithSides()</var>
<var id="HIDDEN">rand( 3 )</var>
<var id="ANSWER">MAIN[ 1 ][ HIDDEN ]</var>
<var id="KNOWN">MAIN[ 1 ].slice( 0, HIDDEN ).concat( MAIN[ 1 ].slice( HIDDEN + 1 ) )</var>
<var id="MAX">roundTo( 1, parseFloat( KNOWN[ 0 ] ) + parseFloat( KNOWN[ 1 ] ) )</var>
<var id="MIN">roundTo( 1, abs( KNOWN[ 0 ] - KNOWN[ 1 ] ) )</var>
</div>

<div class="problems">
<div id="range">
<div class="problem">
What is the range of possible sizes for side x?
</div>
<div class="question">
<div class="graphie">
init({
range: [ [ -1, 10 ], [ -7.5, 1 ] ]
})
var tr = new Triangle( [ 3, -6.5 ], MAIN[ 0 ], 5, { "sides" : [ HIDDEN !== 2 ? MAIN[ 1 ][ 2 ] : "x", HIDDEN !== 0 ? MAIN[ 1 ][ 0 ] : "x", HIDDEN !== 1 ? MAIN[ 1 ][ 1 ] : "x" ] } );
tr.boxOut( [ [ [ -1, -10 ], [ -1, 10 ] ] ], [ 1, 0 ] );
tr.boxOut( [ [ [ 10, -10 ], [ 10, 10 ] ] ], [ -1, 0 ] );
tr.draw();
tr.drawLabels();
</div>
</div>
<div class="solution" data-type="multiple">
<p><span class="sol"><var>MIN</var></span> <code>&lt; x &lt;</code> <span class="sol"><var>MAX</var></span></p>
<span class="example">two <em>exact</em> decimals, like <code>0.75</code></span>
</div>
<div class="hints">
<p>The triangle inequality theorem states that any side of a triangle is always shorter than the sum of the other two sides.</p>
<p>Therefore the the third side must be less than <code><var>KNOWN[ 0 ]</var> + <var>KNOWN[ 1 ]</var> = <var>MAX</var></code></p>
<p>By the same theorem, the third side must be also larger than the difference between the other two sides.</p>
<p>Therefore the third side must be larger than <code><var>KNOWN[0] &lt; KNOWN[1] ? KNOWN[1] : KNOWN[0]</var> - <var>KNOWN[0] &lt; KNOWN[1] ? KNOWN[0] : KNOWN[1]</var> = <var>MIN</var></code></p>
<p>So <code><var>MIN</var> &lt; x &lt; <var>MAX</var></code></p>
</div>
</div>
<div id="possible">
<div class="vars">
<var id="MAIN">randomTriangleWithSides()</var>
<var id="POSSIBLE">( randRange( 0, 1 ) === 0 )</var>
</div>
<div class="problem">
Can this triangle exist?
</div>
<div class="question">
<div class="graphie">
init({
range: [ [-1, 10 ], [ -7.5, 1 ] ]
})
if( !POSSIBLE ){
var side = randRange( 0, 2 );
var sideValue = ( parseFloat( MAIN[ 1 ][ ( side + 1 ) % 3 ] ) + parseFloat( MAIN[ 1 ][ ( side + 2 ) % 3 ] ) + randRange( 1, 3 ) ).toFixed( 1 );
MAIN[ 1 ][ side ] = sideValue;
}
var tr = new Triangle( [ 3, -6.9 ], MAIN[ 0 ], 5, { "sides" : [ MAIN[ 1 ][ 2 ], MAIN[ 1 ][ 0 ], MAIN[ 1 ][ 1 ] ] } );
tr.boxOut( [ [ [ -1, -10 ], [ -1, 10 ] ] ], [ 1, 0 ] );
tr.boxOut( [ [ [ 10, -10 ], [ 10, 10 ] ] ], [ -1, 0 ] );
tr.draw();
tr.drawLabels();
</div>
</div>
<div class="solution"><var>POSSIBLE ? "Yes" : "No"</var></div>
<ul class="choices" data-category="true">
<li>Yes</li>
<li>No</li>
</ul>
<div class="hints">
<p>Triangle inequality theorem states that a side must be smaller than the sum of the other two sides.</p>
<p>Let's check for all three sides:</p>
<div data-each="MAIN[ 1 ] as i, v">
<p><code><var>MAIN[ 1 ][ i ]</var> + <var>MAIN[ 1 ][ ( i + 1 ) % 3 ]</var> = <var>( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ).toFixed( 1 )</var></code></p>
<p><code><var>MAIN[ 1 ][ ( i + 2 ) % 3 ]</var></code> is <span data-if="parseFloat( MAIN[ 1 ][ ( i + 2 ) % 3 ] ) >= ( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ) ">not</span> smaller than <code><var>( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ).toFixed( 1 )</var></code> so the theorem <span data-if="parseFloat( MAIN[ 1 ][ ( i + 2 ) % 3 ] ) >= ( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) )">does not hold</span><span data-else>holds</span>.</p>
</div>
<p data-if="POSSIBLE">All three sides conform to the inequality theorem, so this triangle can exist.</p>
<p data-else>Not all three sides conform to the inequality theorem, so this triangle cannot exist.</p>
</div>
</div>
</div>
</div>
</body>
</html>
Something went wrong with that request. Please try again.