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

108 lines (106 sloc) 6.439 kb
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers math-format graphie-geometry">
<head>
<meta http-equiv="Content-Type" content="text/html; 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>
Jump to Line
Something went wrong with that request. Please try again.