// Numbas version: finer_feedback_settings {"name": "Lengths of vectors and dot products", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Lengths of vectors and dot products", "tags": [], "metadata": {"description": "

Calculations of the lengths of two 3D vectors, the distance between their terminal points, their sum, difference, and dot and cross products.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

Given the vectors $\\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]}}$ find:

", "advice": "

For the general 3-component vectors $\\boldsymbol{a}=\\pmatrix{a_1,a_2,a_3}$ and $\\boldsymbol{b}=\\pmatrix{b_1,b_2,b_3}$, we have

\n

a)

\n

Lengths: $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}$, which are scalar quantities.

\n

 

\n

b)

\n

Distance between the terminal points: $d=\\sqrt{(a_1-b_1)^2+(a_2-b_2)^2+(a_3-b_3)^2}$, which is a scalar quantity.

\n

 

\n

c)

\n

Sum $\\boldsymbol{a}+\\boldsymbol{b}=\\pmatrix{a_1+b_1,a_2+b_2,a_3+b_3}$ and difference $\\boldsymbol{a}-\\boldsymbol{b}=\\pmatrix{a_1-b_1,a_2-b_2,a_3-b_3}$, which are vector quantities.

\n

 

\n

d)

\n

Dot product: $\\boldsymbol{a\\cdot b}=a_1b_1+a_2b_2+a_3b_3$, which is a scalar quantity.

\n

 

\n

e)

\n

Cross product: $\\boldsymbol{a}\\times\\boldsymbol{b}=\\pmatrix{a_2b_3-a_3b_2,a_3b_1-a_1b_3,a_1b_2-a_2b_1}$, which is a vector quantity.

\n

 

\n

In this question, therefore, we have:

\n

a)

\n

Lengths: $a=\\lvert\\boldsymbol{a}\\rvert=\\sqrt{\\var{a[0]^2}+\\var{a[1]^2}+\\var{a[2]^2}}=\\var{lena}$ and $b=\\lvert\\boldsymbol{b}\\rvert=\\sqrt{\\var{b[0]^2}+\\var{b[1]^2}+\\var{b[2]^2}}=\\var{lenb}$.

\n

 

\n

b)

\n

Distance between the terminal points: $d=\\sqrt{(\\simplify[std]{{a[0]}-{b[0]}})^2+(\\simplify[std]{{a[1]}-{b[1]}})^2+(\\simplify[std]{{a[2]}-{b[2]}})^2}=\\var{dist}$.

\n

 

\n

c)

\n

Sum $\\boldsymbol{a}+\\boldsymbol{b}=\\pmatrix{\\simplify[std]{{a[0]}+{b[0]}},\\simplify[std]{{a[1]}+{b[1]}},\\simplify[std]{{a[2]}+{b[2]}}}=\\pmatrix{\\var{sumab[0]},\\var{sumab[1]},\\var{sumab[2]}}$ and difference $\\boldsymbol{a}-\\boldsymbol{b}=\\pmatrix{\\simplify[std]{{a[0]}-{b[0]}},\\simplify[std]{{a[1]}-{b[1]}},\\simplify[std]{{a[2]}-{b[2]}}}=\\pmatrix{\\var{diffab[0]},\\var{diffab[1]},\\var{diffab[2]}}$.

\n

 

\n

d)

\n

Dot product: $\\boldsymbol{a\\cdot b}=(\\var{a[0]}\\times\\var{b[0]})+(\\var{a[1]}\\times\\var{b[1]})+(\\var{a[2]}\\times\\var{b[2]})=\\var{dotab}$.

\n

 

\n

e)

\n

Cross product: $\\boldsymbol{a}\\times\\boldsymbol{b}=\\pmatrix{\\simplify[std]{{a[1]*b[2]}-{a[2]*b[1]}},\\simplify[std]{{a[2]*b[0]}-{a[0]*b[2]}},\\simplify[std]{{a[0]*b[1]}-{a[1]*b[0]}}}=\\pmatrix{\\var{crossab[0]},\\var{crossab[1]},\\var{crossab[2]}}$.

", "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "extensions": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "description": "", "templateType": "anything"}, "crossab": {"name": "crossab", "group": "Ungrouped variables", "definition": "cross(a,b)", "description": "", "templateType": "anything"}, "lena": {"name": "lena", "group": "Ungrouped variables", "definition": "precround(abs(a),2)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "description": "", "templateType": "anything"}, "dotab": {"name": "dotab", "group": "Ungrouped variables", "definition": "dot(a,b)", "description": "", "templateType": "anything"}, "sumab": {"name": "sumab", "group": "Ungrouped variables", "definition": "a+b", "description": "", "templateType": "anything"}, "dist": {"name": "dist", "group": "Ungrouped variables", "definition": "precround(abs(a-b),2)", "description": "", "templateType": "anything"}, "lenb": {"name": "lenb", "group": "Ungrouped variables", "definition": "precround(abs(b),2)", "description": "", "templateType": "anything"}, "diffab": {"name": "diffab", "group": "Ungrouped variables", "definition": "a-b", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "lenb", "lena", "b", "dist", "dotab", "diffab", "sumab", "crossab"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Their lengths: $a=\\lvert\\boldsymbol{a}\\rvert=$ [[0]], $b=\\lvert\\boldsymbol{b}\\rvert=$ [[1]].  (Enter your answers to 2d.p.)

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "lena-0.01", "maxValue": "lena+0.01", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "lenb-0.01", "maxValue": "lenb+0.01", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Their dot product $\\boldsymbol{a\\cdot b}=$ [[0]].

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "dotab", "maxValue": "dotab", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Jessica Claridge", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1728/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Jessica Claridge", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1728/"}]}