// Numbas version: exam_results_page_options {"name": "Dot product and angle between two vectors", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

Note that in this advice, the full calculator display is used in the calculation of each step; any rounding is purely for display clarity.

\n

The dot product of two vectors $\\boldsymbol{a}=\\pmatrix{a_1,a_2,a_3}$ and $\\boldsymbol{b}=\\pmatrix{b_1,b_2,b_3}$ is given by

\n

\\[\\boldsymbol{a\\cdot b}=a_1b_1+a_2b_2+a_3b_3\\]

\n

\n

$\\lvert\\boldsymbol{a}\\rvert=\\sqrt{a_1^2+a_2^2+a_3^2}$ ,$\\lvert\\boldsymbol{b}\\rvert=\\sqrt{b_1^2+b_2^2+b_3^2}$ are the lengths of the vectors $\\boldsymbol{a}$ and $\\boldsymbol{b}$.

\n

\n

and so

\n

\\[\\cos(\\theta)=\\frac{\\boldsymbol{a\\cdot b}}{\\lvert\\boldsymbol{a}\\rvert \\lvert\\boldsymbol{b}\\rvert}=\\frac{a_1b_1+a_2b_2+a_3b_3}{\\lvert\\boldsymbol{a}\\rvert \\lvert\\boldsymbol{b}\\rvert}.\\]

\n

In part a) therefore, we have

\n

\\[\\cos(\\theta)=\\frac{\\var{dot(a,b)}}{\\var{precround(lena,2)}\\times\\var{precround(lenb,2)}}=\\frac{\\var{dot(a,b)}}{\\var{precround(lena*lenb,2)}}=\\var{ans1} \\; \\text{to 2d.p.,}\\]

\n

Which gives an angle $\\theta =\\var{ansrad}$ radians to 1 d.p.

", "variable_groups": [], "preamble": {"css": "", "js": ""}, "extensions": [], "variables": {"b": {"definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "templateType": "anything", "name": "b", "group": "Ungrouped variables", "description": ""}, "c": {"definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "templateType": "anything", "name": "c", "group": "Ungrouped variables", "description": ""}, "lenb": {"definition": "abs(b)", "templateType": "anything", "name": "lenb", "group": "Ungrouped variables", "description": ""}, "dot_of_ab": {"definition": "dot(a,b)", "templateType": "anything", "name": "dot_of_ab", "group": "Ungrouped variables", "description": ""}, "lena": {"definition": "abs(a)", "templateType": "anything", "name": "lena", "group": "Ungrouped variables", "description": ""}, "ans2": {"definition": "precround(dot(c,d)/(lenc*lend),2)", "templateType": "anything", "name": "ans2", "group": "Ungrouped variables", "description": ""}, "d": {"definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "templateType": "anything", "name": "d", "group": "Ungrouped variables", "description": ""}, "a": {"definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "templateType": "anything", "name": "a", "group": "Ungrouped variables", "description": ""}, "ansrad": {"definition": "precround(arccos(ans1),1)", "templateType": "anything", "name": "ansrad", "group": "Ungrouped variables", "description": ""}, "lend": {"definition": "abs(d)", "templateType": "anything", "name": "lend", "group": "Ungrouped variables", "description": ""}, "dot_of_cd": {"definition": "dot(c,d)", "templateType": "anything", "name": "dot_of_cd", "group": "Ungrouped variables", "description": ""}, "lenc": {"definition": "abs(c)", "templateType": "anything", "name": "lenc", "group": "Ungrouped variables", "description": ""}, "ans1": {"definition": "precround(dot(a,b)/(lena*lenb),2)", "templateType": "anything", "name": "ans1", "group": "Ungrouped variables", "description": ""}, "ansrad2": {"definition": "precround(arccos(ans2),1)", "templateType": "anything", "name": "ansrad2", "group": "Ungrouped variables", "description": ""}}, "statement": "

Find the angle  $ \\theta $  between the following pairs of vectors.

", "tags": [], "functions": {}, "name": "Dot product and angle between two vectors", "parts": [{"marks": 0, "variableReplacementStrategy": "originalfirst", "scripts": {}, "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacements": [], "gaps": [{"correctAnswerStyle": "plain", "correctAnswerFraction": false, "scripts": {}, "minValue": "ans1-0.005", "notationStyles": ["plain", "en", "si-en"], "maxValue": "ans1+0.005", "showCorrectAnswer": true, "allowFractions": false, "variableReplacements": [], "mustBeReducedPC": 0, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "showFeedbackIcon": true}, {"correctAnswerStyle": "plain", "correctAnswerFraction": false, "scripts": {}, "minValue": "ansrad-0.05", "notationStyles": ["plain", "en", "si-en"], "maxValue": "ansrad+0.05", "showCorrectAnswer": true, "allowFractions": false, "variableReplacements": [], "mustBeReducedPC": 0, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "showFeedbackIcon": true}, {"correctAnswerStyle": "plain", "correctAnswerFraction": false, "scripts": {}, "minValue": "dot_of_ab-0.001", "notationStyles": ["plain", "en", "si-en"], "maxValue": "dot_of_ab+0.001", "showCorrectAnswer": true, "allowFractions": false, "variableReplacements": [], "mustBeReducedPC": 0, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "showFeedbackIcon": true}], "type": "gapfill", "prompt": "

$\\boldsymbol{a}=\\pmatrix{\\var{a[0]},\\var{a[1]},\\var{a[2]}}$ and $\\boldsymbol{b}=\\pmatrix{\\var{b[0]},\\var{b[1]},\\var{b[2]}}$

\n

$\\boldsymbol{a} \\cdot \\boldsymbol{b}=$ [[2]]

\n

$\\cos({\\theta})=$ [[0]]  (Give your answer to 2d.p.)

\n

$\\theta=$ [[1]](Give your answer, in radians, to 1d.p.)

"}, {"marks": 0, "variableReplacementStrategy": "originalfirst", "scripts": {}, "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacements": [], "gaps": [{"correctAnswerStyle": "plain", "correctAnswerFraction": false, "scripts": {}, "minValue": "ans2-0.005", "notationStyles": ["plain", "en", "si-en"], "maxValue": "ans2+0.005", "showCorrectAnswer": true, "allowFractions": false, "variableReplacements": [], "mustBeReducedPC": 0, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "showFeedbackIcon": true}, {"correctAnswerStyle": "plain", "correctAnswerFraction": false, "scripts": {}, "minValue": "ansrad2-0.05", "notationStyles": ["plain", "en", "si-en"], "maxValue": "ansrad2+0.05", "showCorrectAnswer": true, "allowFractions": false, "variableReplacements": [], "mustBeReducedPC": 0, "type": "numberentry", "marks": 1, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "showFeedbackIcon": true}, {"vsetrangepoints": 5, "scripts": {}, "checkvariablenames": false, "answer": "{dot_of_cd}", "showCorrectAnswer": true, "checkingaccuracy": 0.001, "variableReplacements": [], "type": "jme", "marks": 1, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "showpreview": true, "checkingtype": "absdiff", "vsetrange": [0, 1], "expectedvariablenames": []}], "type": "gapfill", "prompt": "

 $ \\boldsymbol{c}=\\var{c[0]}i  + \\var{c[1]}j + \\var{c[2]}k$ and $ \\boldsymbol{d}= \\var{d[0]}i+ \\var{d[1]}j+\\var{d[2]}k$

\n

$\\boldsymbol{c} \\cdot \\boldsymbol{d}=$ [[2]]

\n

$\\cos({\\theta})=$ [[0]]  (Give your answer to 2d.p.)

\n

$\\theta=$ [[1]]  (Give your answer, in radians, to 1d.p.)

"}], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Find the dot product and the angle between two vectors

"}, "ungrouped_variables": ["a", "lenb", "c", "b", "lenc", "d", "lend", "ans1", "ans2", "lena", "ansrad", "ansrad2", "dot_of_ab", "dot_of_cd"], "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "type": "question", "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}]}]}], "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}]}