// Numbas version: exam_results_page_options {"name": "Lovkush's copy of Randomly give two of hypotenuse, opposite, and adjacent side of a triangle", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "parts": [{"marks": 0, "type": "gapfill", "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "prompt": "

What is the length of the {missing}?

\n

[[0]]m

", "scripts": {}, "gaps": [{"type": "numberentry", "correctAnswerFraction": false, "maxValue": "sides[missing]", "showCorrectAnswer": true, "mustBeReducedPC": 0, "minValue": "sides[missing]", "allowFractions": false, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "scripts": {}, "mustBeReduced": false}]}], "variable_groups": [], "variables": {"missing": {"group": "Ungrouped variables", "definition": "random(keys(sides))", "templateType": "anything", "name": "missing", "description": "

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

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

The name of the first side given to the student.

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

The length of the hypotenuse.

"}, "adjacent": {"group": "Ungrouped variables", "definition": "(opposite^2-1)/2", "templateType": "anything", "name": "adjacent", "description": "

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

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

The length of the opposite side.

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

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

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

The name of the second side given to the student.

"}, "signs": {"group": "Ungrouped variables", "definition": "[\"opposite side\": 1, \"adjacent side\": 1, \"hypotenuse\": -1]", "templateType": "anything", "name": "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

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

"}}, "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.

"}, "statement": "

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

", "name": "Lovkush's copy of Randomly give two of hypotenuse, opposite, and adjacent side of a triangle", "ungrouped_variables": ["opposite", "adjacent", "hypotenuse", "sides", "missing", "first_given", "second_given", "signs"], "tags": [], "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": {"maxRuns": 100, "condition": ""}, "rulesets": {}, "extensions": [], "preamble": {"css": "", "js": ""}, "type": "question", "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}]}]}], "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}]}