// Numbas version: exam_results_page_options {"name": "Harry's copy of Dot product - find angles between two pairs of vectors, ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "statement": "

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

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

It is also given by

\n

\\[\\boldsymbol{a\\cdot b}=ab\\cos(\\theta)\\]

\n

where $a=\\lvert\\boldsymbol{a}\\rvert=\\sqrt{a_1^2+a_2^2+a_3^2}$ and $b=\\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

Equating the two expressions gives

\n

\\[a_1b_1+a_2b_2+a_3b_3=ab\\cos(\\theta)\\]

\n

and so

\n

\\[\\cos(\\theta)=\\frac{a_1b_1+a_2b_2+a_3b_3}{ab}.\\]

\n

In part a) therefore, we have

\n

\\[\\cos(\\theta)=\\frac{\\simplify[std]{{a[0]*b[0]}+{a[1]*b[1]}+{a[2]*b[2]}}}{\\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

and in part b) we have

\n

\\[\\cos(\\theta)=\\frac{\\simplify[std]{{c[0]*d[0]}+{c[1]*d[1]}+{c[2]*d[2]}+{c[3]*d[3]}}}{\\var{precround(lenc,2)}\\times\\var{precround(lend,2)}}=\\frac{\\var{dot(c,d)}}{\\var{precround(lenc*lend,2)}}=\\var{ans2} \\; \\text{to 2d.p.}\\]

", "variable_groups": [], "variables": {"d": {"name": "d", "templateType": "anything", "description": "", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "group": "Ungrouped variables"}, "lenb": {"name": "lenb", "templateType": "anything", "description": "", "definition": "abs(b)", "group": "Ungrouped variables"}, "lena": {"name": "lena", "templateType": "anything", "description": "", "definition": "abs(a)", "group": "Ungrouped variables"}, "c": {"name": "c", "templateType": "anything", "description": "", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "group": "Ungrouped variables"}, "a": {"name": "a", "templateType": "anything", "description": "", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "group": "Ungrouped variables"}, "ansrad": {"name": "ansrad", "templateType": "anything", "description": "", "definition": "precround(arccos(ans1),1)", "group": "Ungrouped variables"}, "lenc": {"name": "lenc", "templateType": "anything", "description": "", "definition": "abs(c)", "group": "Ungrouped variables"}, "b": {"name": "b", "templateType": "anything", "description": "", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "group": "Ungrouped variables"}, "ans1": {"name": "ans1", "templateType": "anything", "description": "", "definition": "precround(dot(a,b)/(lena*lenb),2)", "group": "Ungrouped variables"}, "dot_of_ab": {"name": "dot_of_ab", "templateType": "anything", "description": "", "definition": "dot(a,b)", "group": "Ungrouped variables"}, "ans2": {"name": "ans2", "templateType": "anything", "description": "", "definition": "precround(dot(c,d)/(lenc*lend),2)", "group": "Ungrouped variables"}, "ansrad2": {"name": "ansrad2", "templateType": "anything", "description": "", "definition": "precround(arccos(ans2),1)", "group": "Ungrouped variables"}, "lend": {"name": "lend", "templateType": "anything", "description": "", "definition": "abs(d)", "group": "Ungrouped variables"}, "dot_of_cd": {"name": "dot_of_cd", "templateType": "anything", "description": "", "definition": "dot(c,d)", "group": "Ungrouped variables"}}, "tags": [], "ungrouped_variables": ["a", "lenb", "c", "b", "lenc", "d", "lend", "ans1", "ans2", "lena", "ansrad", "ansrad2", "dot_of_ab", "dot_of_cd"], "parts": [{"marks": 0, "showCorrectAnswer": true, "type": "gapfill", "scripts": {}, "gaps": [{"marks": 1, "maxValue": "ans1+0.005", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReduced": false, "variableReplacements": [], "allowFractions": false, "minValue": "ans1-0.005", "showFeedbackIcon": true, "type": "numberentry", "scripts": {}, "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"]}, {"marks": 1, "maxValue": "ansrad+0.05", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReduced": false, "variableReplacements": [], "allowFractions": false, "minValue": "ansrad-0.05", "showFeedbackIcon": true, "type": "numberentry", "scripts": {}, "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"]}, {"marks": 1, "maxValue": "dot_of_ab+0.001", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReduced": false, "variableReplacements": [], "allowFractions": false, "minValue": "dot_of_ab-0.001", "showFeedbackIcon": true, "type": "numberentry", "scripts": {}, "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"]}], "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "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, "showCorrectAnswer": true, "type": "gapfill", "scripts": {}, "gaps": [{"marks": 1, "maxValue": "ans2+0.005", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReduced": false, "variableReplacements": [], "allowFractions": false, "minValue": "ans2-0.005", "showFeedbackIcon": true, "type": "numberentry", "scripts": {}, "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"]}, {"marks": 1, "maxValue": "ansrad2+0.05", "showCorrectAnswer": true, "correctAnswerFraction": false, "mustBeReduced": false, "variableReplacements": [], "allowFractions": false, "minValue": "ansrad2-0.05", "showFeedbackIcon": true, "type": "numberentry", "scripts": {}, "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"]}, {"marks": 1, "vsetrange": [0, 1], "showCorrectAnswer": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "checkvariablenames": false, "checkingaccuracy": 0.001, "showFeedbackIcon": true, "answer": "{dot_of_cd}", "type": "jme", "scripts": {}, "checkingtype": "absdiff", "vsetrangepoints": 5, "showpreview": true, "expectedvariablenames": []}], "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "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.)

"}], "preamble": {"js": "", "css": ""}, "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "name": "Harry's copy of Dot product - find angles between two pairs of vectors, ", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Find the cosine of the angle between two pairs of 3D and 4D vectors.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "extensions": [], "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/"}]}