// Numbas version: finer_feedback_settings
{"name": "Linear graphs: Find the equation of a line 2", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Linear graphs: Find the equation of a line 2", "tags": [], "metadata": {"description": "
Find the equation of the line that passes through given points
", "licence": "None specified"}, "statement": "", "advice": "You can calculate the gradient first, and then substitute this into the equation $y=mx+c$, and rearrange to find $c$.
\nIt is more efficient, however, to calculate the whole thing in one go, using the equation:
$\\frac{y - y_1}{x - x_1} = \\frac{y_2 - y_1}{x_2 - x_1}$
and then rearrange this into any suitable form.
In this question we have:
$(x_1, y_1) = (\\var{ax}, \\var{ay})$ and $(x_2, y_2) = (\\var{bx}, \\var{by})$
Therefore
\n\\[ \\begin{split} \\frac{y - y_1}{x - x_1} &= \\frac{y_2 - y_1}{x_2 - x_1} \\\\ \\\\
\\frac{y - \\var{ay}}{x - \\var{ax}} &= \\frac{\\var{by} - \\var{ay}}{\\var{bx} - \\var{ax}} \\\\ \\\\
\\frac{y - \\var{ay}}{x - \\var{ax}} &= \\frac{\\var{by-ay}}{\\var{bx-ax}} \\\\ \\\\
\\var{bx-ax}(y - \\var{ay}) &= \\var{by-ay}(x - \\var{ax})\\\\ \\\\
\\simplify{{bx-ax}(y - {ay})} &= \\simplify{{by-ay}(x - {ax})} \\\\ \\\\
\\var{(bx-ax)}y - \\var{(bx-ax)*ay} &= \\var{(by-ay)}x + \\var{(ay-by)*ax} \\\\ \\\\
\\var{(bx-ax)}y &= \\var{(by-ay)}x + \\var{(ay-by)*ax+(bx-ax)*ay} \\\\ \\\\
y &= \\simplify{({by-ay}/{bx-ax})x + {(ay-by)*ax/(bx-ax)+(bx-ax)*ay/(bx-ax)}}
\\end{split} \\]
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"ax": {"name": "ax", "group": "Ungrouped variables", "definition": "random(-10..10 except 0)", "description": "", "templateType": "anything", "can_override": false}, "bx": {"name": "bx", "group": "Ungrouped variables", "definition": "random(-10..10 except 0 except ax)", "description": "", "templateType": "anything", "can_override": false}, "ay": {"name": "ay", "group": "Ungrouped variables", "definition": "random(-10..10 except 0)", "description": "", "templateType": "anything", "can_override": false}, "by": {"name": "by", "group": "Ungrouped variables", "definition": "random(-10..10 except 0 except ay)", "description": "", "templateType": "anything", "can_override": false}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "(ay-by)/(ax-bx)", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "ay - m*ax", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "precround(m,1) = m AND precround(c,1)=c", "maxRuns": 100}, "ungrouped_variables": ["ax", "bx", "ay", "by", "m", "c"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Find the equation of the line that passes through the points:
\n$(\\var{ax},\\var{ay})$ and $(\\var{bx}, \\var{by})$.
", "answer": "y = {m}x+{c}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": "0.1", "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}, {"name": "y", "value": ""}]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}, {"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}]}], "contributors": [{"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}, {"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}