// Numbas version: exam_results_page_options {"name": "Randomly give two of hypotenuse, opposite, and adjacent side of a triangle", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"second_given": {"description": "

The name of the second side given to the student.

", "group": "Ungrouped variables", "definition": "if(missing=\"hypotenuse\",\"adjacent side\",\"hypotenuse\")", "templateType": "anything", "name": "second_given"}, "hypotenuse": {"description": "

The length of the hypotenuse.

", "group": "Ungrouped variables", "definition": "adjacent+1", "templateType": "anything", "name": "hypotenuse"}, "opposite": {"description": "

The length of the opposite side.

", "group": "Ungrouped variables", "definition": "random(3..13#2)", "templateType": "anything", "name": "opposite"}, "missing": {"description": "

The name of the side which the student has to work out.

", "group": "Ungrouped variables", "definition": "random(keys(sides))", "templateType": "anything", "name": "missing"}, "first_given": {"description": "

The name of the first side given to the student.

", "group": "Ungrouped variables", "definition": "if(missing=\"opposite side\",\"adjacent side\",\"opposite side\")", "templateType": "anything", "name": "first_given"}, "sides": {"description": "

A dictionary giving the lengths of the sides. Used in the statement and to set the correct answer.

", "group": "Ungrouped variables", "definition": "[\"opposite side\":opposite,\"adjacent side\":adjacent,\"hypotenuse\":hypotenuse]", "templateType": "anything", "name": "sides"}, "signs": {"description": "

Signs of each of the components in the equation $a^2 + b^2 - c^2 = 0$. Used in the working-out in the advice.

\n

In the equation $\\text{missing} = \\sqrt{ \\pm \\text{first}^2 \\pm \\text{second}^2}$, note that:

\n
\n
• when the hypotenuse is missing, both sides in the square root are positive: $\\sqrt{ \\text{first}^2 + \\text{second}^2} = \\sqrt{a^2+b^2}$
• \n
• when either of the other sides is missing, it's $\\sqrt{- \\text{first}^2 + \\text{second}^2} = \\sqrt{-(a \\text{ or } b)^2 + c^2}$.
• \n
\n

So, only the first side in the square root changes sign depending on the missing side.

", "group": "Ungrouped variables", "definition": "[\"opposite side\": 1, \"adjacent side\": 1, \"hypotenuse\": -1]", "templateType": "anything", "name": "signs"}, "adjacent": {"description": "

The length of the adjacent side. The sides will always form a Pythagorean triple.

", "group": "Ungrouped variables", "definition": "(opposite^2-1)/2", "templateType": "anything", "name": "adjacent"}}, "extensions": [], "functions": {}, "advice": "

We are given the {first_given} and the {second_given}.

\n

We can use Pythagoras' theorem to work out the {missing}.

\n

Pythagoras' theorem states that

\n

\$a^2 + b^2 = c^2 \\text{,} \$

\n

where $a$ is the opposite side, $b$ is the adjacent side, and $c$ is the hypotenuse.

\n

Substituting the values into this equation, we have

\n

\$\\var{opposite}^2 + \\var{adjacent}^2 = c^2 \$\$\\var{opposite}^2 + b^2 = \\var{hypotenuse}^2 \$\$a^2 + \\var{adjacent}^2 = \\var{hypotenuse}^2 \$

\n

So the {missing} is

\n

\$\\simplify[noleadingminus,unitfactor]{ sqrt({signs[second_given]}*{sides[first_given]}^2 + {sides[second_given]}^2)} = \\sqrt{\\var{sides[missing]^2}} = \\var{sides[missing]}\\text{m} \$

", "variablesTest": {"condition": "", "maxRuns": 100}, "type": "question", "statement": "

You are told that a triangle has {first_given} side {sides[first_given]}m, and {second_given} side {sides[second_given]}m.

", "name": "Randomly give two of hypotenuse, opposite, and adjacent side of a triangle", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Some clever variable-substitution trickery to randomly pick two sides of a right-angled triangle to give to a student, and ask for the other.

\n

The sides are set up so they're always Pythagorean triples, and the opposite side is always odd.

\n

As ever, most of the tricky stuff is in the advice.

\n

Because this was created quickly to show how to set up the randomisation, there's no diagram. It would benefit greatly from a diagram.

"}, "tags": [], "parts": [{"marks": 0, "showFeedbackIcon": true, "prompt": "

What is the length of the {missing}?

\n

[[0]]m

", "showCorrectAnswer": true, "variableReplacements": [], "gaps": [{"mustBeReducedPC": 0, "showCorrectAnswer": true, "variableReplacements": [], "maxValue": "sides[missing]", "allowFractions": false, "marks": 1, "correctAnswerStyle": "plain", "type": "numberentry", "showFeedbackIcon": true, "correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "sides[missing]", "scripts": {}, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false}], "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "gapfill"}], "rulesets": {}, "preamble": {"js": "", "css": ""}, "ungrouped_variables": ["opposite", "adjacent", "hypotenuse", "sides", "missing", "first_given", "second_given", "signs"], "variable_groups": [], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}