// Numbas version: finer_feedback_settings {"name": "Minimum distance between a point and a line in 3D", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [{"variables": ["directions", "p"], "name": "Vector p"}, {"variables": ["s1", "a", "b", "g", "x_0"], "name": "Vector x_0"}, {"variables": ["c", "d", "f", "v"], "name": "Vector v"}, {"variables": ["top"], "name": "Answer"}], "variables": {"s1": {"group": "Vector x_0", "templateType": "anything", "definition": "random(-1,1)", "description": "", "name": "s1"}, "v": {"group": "Vector v", "templateType": "anything", "definition": "vector(random(-9..9 except -1..1),random(-9..9 except -1..1),random(2..9))", "description": "", "name": "v"}, "d": {"group": "Vector v", "templateType": "anything", "definition": "random(-1,1)*random(2..9)", "description": "", "name": "d"}, "top": {"group": "Answer", "templateType": "anything", "definition": "cross(p-x_0,v)", "description": "

Top of the formula for the minimum distance: $(p-x_0) \\times v$.

", "name": "top"}, "f": {"group": "Vector v", "templateType": "anything", "definition": "random(2..9)", "description": "", "name": "f"}, "directions": {"group": "Vector p", "templateType": "anything", "definition": "map(id(3)[x],x,shuffle(0..2))", "description": "

Shuffled list of axis vectors

", "name": "directions"}, "b": {"group": "Vector x_0", "templateType": "anything", "definition": "random(-1,1)*random(2..9)", "description": "", "name": "b"}, "a": {"group": "Vector x_0", "templateType": "anything", "definition": "s1*random(2..9)", "description": "", "name": "a"}, "g": {"group": "Vector x_0", "templateType": "anything", "definition": "s1*random(2..9)", "description": "", "name": "g"}, "p": {"group": "Vector p", "templateType": "anything", "definition": "random(-1,1)*directions[0] + random(-5..5 except -1..1)*directions[1]", "description": "", "name": "p"}, "x_0": {"group": "Vector x_0", "templateType": "anything", "definition": "vector(random(2..9),0,random(2..9))*random(-1,1) + vector(0,random(2..9),0)*random(-1,1)", "description": "", "name": "x_0"}, "c": {"group": "Vector v", "templateType": "anything", "definition": "random(-1,1)*random(2..9)", "description": "", "name": "c"}}, "ungrouped_variables": [], "name": "Minimum distance between a point and a line in 3D", "functions": {}, "preamble": {"css": "", "js": ""}, "parts": [{"customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "steps": [{"variableReplacementStrategy": "originalfirst", "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "scripts": {}, "customMarkingAlgorithm": "", "type": "information", "showCorrectAnswer": true, "unitTests": [], "prompt": "

The minimum distance between the line and the point is given by

\n

\\[ \\frac{\\left\\lVert(\\boldsymbol{p} - \\boldsymbol{x_0})\\times \\boldsymbol{v} \\right\\rVert}{\\lVert \\boldsymbol{v} \\rVert}\\]

", "variableReplacements": [], "marks": 0}], "prompt": "

Distance = [[0]]

\n

Enter your answer exactly, using the function sqrt(x) if necessary. Do not use decimals.

\n

You can get help by clicking on Show steps.

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"answer": "sqrt({abs(top)^2}/{abs(v)^2})", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkingType": "absdiff", "extendBaseMarkingAlgorithm": true, "expectedVariableNames": [], "showPreview": true, "notallowed": {"message": "

Enter all numbers as integers, do not use decimals

", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "unitTests": [], "checkVariableNames": false, "vsetRange": [0, 1], "vsetRangePoints": 5, "failureRate": 1, "scripts": {}, "answerSimplification": "std", "type": "jme", "checkingAccuracy": 0.001, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 2, "showFeedbackIcon": true}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "stepsPenalty": 0, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

In $\\mathbb{R}^3$ find the distance between the point $\\boldsymbol{p} = \\var{p}$ and the line through the point $\\boldsymbol{x_0} = \\var{x_0}$ that is parallel to the vector $\\boldsymbol{v} = \\var{v}$.

", "tags": ["checked2015", "cross product of vectors", "distance between a point and a line", "distance between two points", "equation of a line through a point and in the direction of a vector", "minimum distance", "minimum distance between a point and a line in three space", "modulus of a vector", "three dimensional vector geometry", "vector", "Vector", "vector geometry", "vector product", "vectors"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "extensions": [], "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Find minimum distance between a point and a line in 3-space. The line goes through a given point in the direction of a given vector.

\n

The correct solution is given, however the accuracy of 0.001  is not enough as in some cases answers near to the correct solution are also marked as correct.

"}, "advice": "

The line through $\\boldsymbol{x_0} = \\var{x_0}$ in the direction of $\\boldsymbol{v}=\\var{v}$ has equation:

\n

\\[ \\boldsymbol{r} = \\boldsymbol{x_0} + \\lambda \\boldsymbol{v} = \\var{x_0} + \\lambda \\var{v} \\]

\n

The minimum distance between this line and the point $\\boldsymbol{p} = \\var{p}$ is given by

\n

\\[ \\frac{\\left\\lVert(\\boldsymbol{p}-\\boldsymbol{x_0}) \\times \\boldsymbol{v} \\right\\rVert}{\\lVert \\boldsymbol{v} \\rVert} \\]

\n

Now,

\n

\\begin{align}
\\boldsymbol{p} - \\boldsymbol{x_0} &= \\var{p-x_0} \\Rightarrow \\\\[1em]
(\\boldsymbol{p}-\\boldsymbol{x_0}) \\times \\boldsymbol{v} &= \\var{p-x_0} \\times \\var{v} \\\\[1em]
&= \\var{top}
\\end{align}

\n

Since

\n

\\begin{align}
\\left\\lVert \\begin{matrix} \\var{top[0]} \\\\ \\var{top[1]} \\\\ \\var{top[2]} \\end{matrix} \\right \\rVert &= \\simplify[]{sqrt({top[0]}^2 + {top[1]}^2 + {top[2]}^2)} \\\\ &= \\sqrt{\\var{abs(top)^2}}
\\end{align}

\n

and $\\lVert \\boldsymbol{v} \\rVert = \\simplify[]{sqrt({v[0]}^2 + {v[1]}^2 + {v[2]}^2)} = \\sqrt{\\var{abs(v)^2}}$, the distance is then:

\n

\\[\\simplify{sqrt({abs(top)^2}/{abs(v)^2})}\\]

", "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}