Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

107 lines (105 sloc) 4.929 kb
<!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">( parseFloat( KNOWN[ 0 ] ) + parseFloat( KNOWN[ 1 ] ) ).toFixed( 1 )</var>
<var id="MIN">Math.abs( KNOWN[ 0 ] - KNOWN[ 1 ] ).toFixed( 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, { "c" : HIDDEN !== 2 ? MAIN[ 1 ][ 2 ] : "x" , "a" : HIDDEN !== 0 ? MAIN[ 1 ][ 0 ] : "x" , "b" : 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>Maximum = <span class="sol"><var>MAX</var></span></p>
<p>Minimum = <span class="sol"><var>MIN</var></span></p>
</div>
<div class="hints">
<p>Triangle inequality theorem states that a side cannot be larger than the sum of the other two sides.</p>
<p>Therefore the the third side cannot be larger than <code><var>KNOWN[ 0 ]</var> + <var>KNOWN[ 1 ]</var> = <var>MAX</var></code></p>
<p>By the same theorem, the side can also not be smaller than the difference between the two sides.<p>
<p>Therefore the third side cannot be smaller than <code>| <var>KNOWN[ 0 ]</var> - <var>KNOWN[ 1 ]</var> | = <var>MIN</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, { "c" : MAIN[ 1 ][ 2 ], "a" : MAIN[ 1 ][ 0 ] , "b" : 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>Lets 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 <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>
Jump to Line
Something went wrong with that request. Please try again.