# Khan/khan-exercises

### Subversion checkout URL

You can clone with
or
.
Older
100644 107 lines (105 sloc) 4.929 kB
 b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 1 2 3 4 5 Triangle Inequality Theorem 6 7 22 23 24
25
26 randomTriangleWithSides() 27 rand( 3 ) 28 MAIN[ 1 ][ HIDDEN ] 29 MAIN[ 1 ].slice( 0, HIDDEN ).concat( MAIN[ 1 ].slice( HIDDEN + 1 ) ) 92d6acd fix #2801 igorT authored Sep 17, 2011 30 ( parseFloat( KNOWN[ 0 ] ) + parseFloat( KNOWN[ 1 ] ) ).toFixed( 1 ) b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 31 Math.abs( KNOWN[ 0 ] - KNOWN[ 1 ] ).toFixed( 1 ) 32
33 34
35
36
26b0aff triangle inequality exercise finished igorT authored Sep 13, 2011 37 What is the range of possible sizes for side x? b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 38
39
40
41 init({ 4dbb802 polish of geometry igorT authored Sep 16, 2011 42 range: [ [ -1, 10 ], [ -7.5, 1 ] ] b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 43 }) cef3c71 made angle marking appear in similar triangles igorT authored Sep 15, 2011 44 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" } ); 4dbb802 polish of geometry igorT authored Sep 16, 2011 45 tr.boxOut( [ [ [ -1, -10 ], [ -1, 10 ] ] ], [ 1, 0 ] ); 46 tr.boxOut( [ [ [ 10, -10 ], [ 10, 10 ] ] ], [ -1, 0 ] ); b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 47 tr.draw(); 48 tr.drawLabels(); 49
50
51
52

Maximum = MAX

53

Minimum = MIN

54
55
56

Triangle inequality theorem states that a side cannot be larger than the sum of the other two sides.

26b0aff triangle inequality exercise finished igorT authored Sep 13, 2011 57

Therefore the the third side cannot be larger than KNOWN[ 0 ] + KNOWN[ 1 ] = MAX

58

By the same theorem, the side can also not be smaller than the difference between the two sides.

59

Therefore the third side cannot be smaller than | KNOWN[ 0 ] - KNOWN[ 1 ] | = MIN

b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 60
61
cef3c71 made angle marking appear in similar triangles igorT authored Sep 16, 2011 62
26b0aff triangle inequality exercise finished igorT authored Sep 13, 2011 63
64 randomTriangleWithSides() 65 ( randRange( 0, 1 ) === 0 ) cef3c71 made angle marking appear in similar triangles igorT authored Sep 16, 2011 66
b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 67
26b0aff triangle inequality exercise finished igorT authored Sep 13, 2011 68 Can this triangle exist? b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 69
70
71
72 init({ 4dbb802 polish of geometry igorT authored Sep 16, 2011 73 range: [ [-1, 10 ], [ -7.5, 1 ] ] b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 74 }) 26b0aff triangle inequality exercise finished igorT authored Sep 13, 2011 75 if( !POSSIBLE ){ 76 var side = randRange( 0, 2 ); 4dbb802 polish of geometry igorT authored Sep 16, 2011 77 var sideValue = ( parseFloat( MAIN[ 1 ][ ( side + 1 ) % 3 ] ) + parseFloat( MAIN[ 1 ][ ( side + 2 ) % 3 ] ) + randRange( 1, 3 ) ).toFixed( 1 ); 26b0aff triangle inequality exercise finished igorT authored Sep 13, 2011 78 MAIN[ 1 ][ side ] = sideValue; 79 } 4dbb802 polish of geometry igorT authored Sep 16, 2011 80 var tr = new Triangle( [ 3, -6.9 ], MAIN[ 0 ], 5, { "c" : MAIN[ 1 ][ 2 ], "a" : MAIN[ 1 ][ 0 ] , "b" : MAIN[ 1 ][ 1 ] } ); 81 tr.boxOut( [ [ [ -1, -10 ], [ -1, 10 ] ] ], [ 1, 0 ] ); 82 tr.boxOut( [ [ [ 10, -10 ], [ 10, 10 ] ] ], [ -1, 0 ] ); b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 83 tr.draw(); 84 tr.drawLabels(); 85
86
26b0aff triangle inequality exercise finished igorT authored Sep 13, 2011 87
POSSIBLE ? "Yes" : "No"
88
89
• Yes
• 90
• No
• 91
b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 92
26b0aff triangle inequality exercise finished igorT authored Sep 13, 2011 93

Triangle inequality theorem states that a side must be smaller than the sum of the other two sides.

94

Lets check for all three sides:

95
96

MAIN[ 1 ][ i ] + MAIN[ 1 ][ ( i + 1 ) % 3 ] = ( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ).toFixed( 1 )

97

MAIN[ 1 ][ ( i + 2 ) % 3 ] is not smaller than ( parseFloat( MAIN[ 1 ][ i ] ) + parseFloat( MAIN[ 1 ][ ( i + 1 ) % 3 ] ) ).toFixed( 1 ) so the theorem does not holdholds.

98
99

All three sides conform to the inequality theorem, so this triangle can exist.

100

Not all three sides conform to the inequality theorem, so this triangle cannot exist.

b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 101
102
103
8531c06 triangle_inequality fixes spicyj authored Sep 3, 2011 104
b03482a New exercise for triangle inequalities igorT authored Sep 2, 2011 105 106
Something went wrong with that request. Please try again.