// Numbas version: finer_feedback_settings {"name": "Lengths of and distance between vectors, dot and cross products,", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"notes": "", "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"}, "type": "question", "preamble": {"css": "", "js": ""}, "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"]}, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "name": "Lengths of and distance between vectors, dot and cross products,", "ungrouped_variables": ["a", "lenb", "lena", "b", "dist", "dotab", "diffab", "sumab", "crossab"], "showQuestionGroupNames": false, "functions": {}, "tags": ["checked2015", "MAS1602", "MAS2104"], "variablesTest": {"condition": "", "maxRuns": 100}, "variable_groups": [], "variables": {"b": {"name": "b", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "dotab": {"name": "dotab", "definition": "dot(a,b)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "crossab": {"name": "crossab", "definition": "cross(a,b)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "dist": {"name": "dist", "definition": "precround(abs(a-b),2)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "lena": {"name": "lena", "definition": "precround(abs(a),2)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "sumab": {"name": "sumab", "definition": "a+b", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "lenb": {"name": "lenb", "definition": "precround(abs(b),2)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "a": {"name": "a", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "diffab": {"name": "diffab", "definition": "a-b", "group": "Ungrouped variables", "description": "", "templateType": "anything"}}, "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:

", "parts": [{"type": "gapfill", "scripts": {}, "marks": 0, "prompt": "

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

", "showCorrectAnswer": true, "gaps": [{"maxValue": "lena+0.01", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "lena-0.01", "showCorrectAnswer": true, "correctAnswerFraction": false}, {"maxValue": "lenb+0.01", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "lenb-0.01", "showCorrectAnswer": true, "correctAnswerFraction": false}]}, {"type": "gapfill", "scripts": {}, "marks": 0, "prompt": "

The distance, $d=$ [[0]], between $\\boldsymbol{a}$ and $\\boldsymbol{b}$, assuming their common initial point is at the origin.  (Enter your answer to 2d.p.)

", "showCorrectAnswer": true, "gaps": [{"maxValue": "dist+0.01", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "dist-0.01", "showCorrectAnswer": true, "correctAnswerFraction": false}]}, {"type": "gapfill", "scripts": {}, "marks": 0, "prompt": "

Their sum, $\\boldsymbol{a}+\\boldsymbol{b}=($[[0]]$,$[[1]]$,$[[2]]$)$, and difference, $\\boldsymbol{a}-\\boldsymbol{b}=($[[3]]$,$[[4]]$,$[[5]]$)$.

", "showCorrectAnswer": true, "gaps": [{"maxValue": "sumab[0]", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "sumab[0]", "showCorrectAnswer": true, "correctAnswerFraction": false}, {"maxValue": "sumab[1]", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "sumab[1]", "showCorrectAnswer": true, "correctAnswerFraction": false}, {"maxValue": "sumab[2]", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "sumab[2]", "showCorrectAnswer": true, "correctAnswerFraction": false}, {"maxValue": "diffab[0]", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "diffab[0]", "showCorrectAnswer": true, "correctAnswerFraction": false}, {"maxValue": "diffab[1]", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "diffab[1]", "showCorrectAnswer": true, "correctAnswerFraction": false}, {"maxValue": "diffab[2]", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "diffab[2]", "showCorrectAnswer": true, "correctAnswerFraction": false}]}, {"type": "gapfill", "scripts": {}, "marks": 0, "prompt": "

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

", "showCorrectAnswer": true, "gaps": [{"maxValue": "dotab", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "dotab", "showCorrectAnswer": true, "correctAnswerFraction": false}]}, {"type": "gapfill", "scripts": {}, "marks": 0, "prompt": "

Their cross product $\\boldsymbol{a}\\times\\boldsymbol{b}=($[[0]]$,$[[1]]$,$[[2]]$)$.

", "showCorrectAnswer": true, "gaps": [{"maxValue": "crossab[0]", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "crossab[0]", "showCorrectAnswer": true, "correctAnswerFraction": false}, {"maxValue": "crossab[1]", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "crossab[1]", "showCorrectAnswer": true, "correctAnswerFraction": false}, {"maxValue": "crossab[2]", "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "marks": 1, "minValue": "crossab[2]", "showCorrectAnswer": true, "correctAnswerFraction": false}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}