randVar() pickLabels()
A_POINTS.join("") B_POINTS.join("")
randRange(1, 5)/2 randRange(1, 5)/2
randomSides() scaleSides(BASE_SIDES, SCALE_A) triangleAngles(A_SIDES) scaleSides(BASE_SIDES, SCALE_B) triangleAngles(B_SIDES) randRange(0, 2) SOLUTION_INDEX === 2 ? 0 : SOLUTION_INDEX + 1 SOLUTION_INDEX === 0 ? 2 : SOLUTION_INDEX - 1 B_SIDES[SOLUTION_INDEX] insertVariable(SOLUTION_INDEX, X, B_SIDES) fractionReduce(B_SIDES[PROP_INDEX], A_SIDES[PROP_INDEX]) function(){ var trA = new Triangle( [ 0, -2 ], A_ANGLES, 5*SCALE_A, {} ); trA.labels = {"sides": [A_SIDES[2], A_SIDES[0], A_SIDES[1]], "points" : A_POINTS }; trA.rotate( randRange( 0, 360 ) ); trA.color = BLUE; // trA.boxOut( [ [ [ -1, -10 ], [ -1, 20 ] ] ], [ 0.5, 0 ] ); // trA.boxOut( TR.sides, [ 0, -1 ] ); return trA; }() function(){ var trB = new Triangle( [ 8, -6 ], B_ANGLES, 5*SCALE_B, {} ); trB.labels = {"sides": [B_LABELS[2], B_LABELS[0], B_LABELS[1]], "points" : B_POINTS }; trB.rotate( randRange( 0, 360 ) ); trB.color = RED; // trB.boxOut( [ [ [ 13, -10 ], [ 13, 20 ] ] ], [ -0.5, 0 ] ); // trB.boxOut( TR.sides, [ 0, -1 ] ); trB.boxOut( TR_A.sides, [ 0, -1 ] ); return trB; }()

Triangle `A_NAME` is similar to triangle `B_NAME`.

Solve for `X`.

TR_A.rotate( randRange( 0, 360 ) ); TR_B.rotate( randRange( 0, 360 ) ); var aBounding = TR_A.boundingRange(1); var bBounding = TR_B.boundingRange(1); var minX = Math.min(aBounding[0][0], bBounding[0][0]); var maxX = Math.max(aBounding[0][1], bBounding[0][1]); var minY = Math.min(aBounding[1][0], bBounding[1][0]); var maxY = Math.max(aBounding[1][1], bBounding[1][1]); init({ range: [ [minX, maxX ], [ minY, maxY ] ], scale: 500 / (maxX - minX) }) style({ stroke: BLUE, }); TR_A.draw(); TR_A.drawLabels(); style({ stroke: RED, }); TR_B.draw(); TR_B.drawLabels();
SOLUTION

`X =`

Similar triangles have proportional sides.

Therefore, we can set up equivalent proportions and solve for `X`.

`\dfrac{\red{B_LABELS[SOLUTION_INDEX]}}{\blue{A_SIDES[SOLUTION_INDEX]}} = \dfrac{\red{B_LABELS[PROP_INDEX]}}{\blue{A_SIDES[PROP_INDEX]}}`

Note: As each corresponding `\dfrac{\red{side}}{\blue{side}}` proportion is equivalent, you could use the other sides (i.e., `\dfrac{\red{B_LABELS[SOLUTION_INDEX]}}{\blue{A_SIDES[SOLUTION_INDEX]}} = \dfrac{\red{B_LABELS[ALTERNATE_INDEX]}}{\blue{A_SIDES[ALTERNATE_INDEX]}}`)

Reduce the proportion on the right hand side.

`\dfrac{\red{B_LABELS[SOLUTION_INDEX]}}{\blue{A_SIDES[SOLUTION_INDEX]}} = \cancel{\dfrac{\red{B_LABELS[PROP_INDEX]}}{\blue{A_SIDES[PROP_INDEX]}}}{\green{fractionReduce(B_LABELS[PROP_INDEX], A_SIDES[PROP_INDEX])}}`

Multiply each side by `A_SIDES[SOLUTION_INDEX]` and simplify.

`\cancel{A_SIDES[SOLUTION_INDEX]} \times \dfrac{\red{B_LABELS[SOLUTION_INDEX]}}{\cancel{\blue{A_SIDES[SOLUTION_INDEX]}}} = \green{fractionReduce(B_LABELS[PROP_INDEX], A_SIDES[PROP_INDEX])} \times A_SIDES[SOLUTION_INDEX]`

`\red{X}` is equal to `SOLUTION`.