// Numbas version: finer_feedback_settings {"name": "Jo\u00ebl's copy of Extract common factors of polynomials", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"showFeedbackIcon": true, "showCorrectAnswer": true, "customMarkingAlgorithm": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "sortAnswers": false, "gaps": [{"showFeedbackIcon": true, "showCorrectAnswer": true, "checkingType": "absdiff", "vsetRangePoints": 5, "showPreview": true, "vsetRange": [0, 1], "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "answer": "2({a[0]}x+{b[0]})", "expectedVariableNames": [], "variableReplacements": [], "unitTests": [], "type": "jme", "scripts": {"mark": {"order": "after", "script": "question.mark_factorised(this);"}}, "marks": 1, "checkVariableNames": false, "checkingAccuracy": 0.001, "variableReplacementStrategy": "originalfirst", "failureRate": 1}], "unitTests": [], "prompt": "

$\\simplify{{2*a[0]}x+{2*b[0]}}=$ [[0]]

", "type": "gapfill", "scripts": {}, "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"showFeedbackIcon": true, "showCorrectAnswer": true, "customMarkingAlgorithm": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "sortAnswers": false, "gaps": [{"showFeedbackIcon": true, "showCorrectAnswer": true, "checkingType": "absdiff", "vsetRangePoints": 5, "showPreview": true, "vsetRange": [0, 1], "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "answer": "6*y*({a[1]}+{b[1]}*y)", "expectedVariableNames": [], "variableReplacements": [], "unitTests": [], "type": "jme", "scripts": {"mark": {"order": "after", "script": "question.mark_factorised(this);"}}, "marks": 1, "checkVariableNames": false, "checkingAccuracy": 0.001, "variableReplacementStrategy": "originalfirst", "failureRate": 1}], "unitTests": [], "prompt": "

$\\simplify{6{a[1]}y+6{b[1]}y^2}=$ [[0]]

", "type": "gapfill", "scripts": {}, "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"showFeedbackIcon": true, "showCorrectAnswer": true, "customMarkingAlgorithm": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "sortAnswers": false, "gaps": [{"showFeedbackIcon": true, "showCorrectAnswer": true, "checkingType": "absdiff", "vsetRangePoints": 5, "showPreview": true, "vsetRange": [0, 1], "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "answer": "x*y*z*({a[2]}+{b[2]}x*y*z)", "expectedVariableNames": [], "variableReplacements": [], "unitTests": [], "type": "jme", "scripts": {"mark": {"order": "after", "script": "question.mark_factorised(this);"}}, "marks": 1, "checkVariableNames": false, "checkingAccuracy": 0.001, "variableReplacementStrategy": "originalfirst", "failureRate": 1}], "unitTests": [], "prompt": "

$\\simplify{{a[2]}x*y*z+{b[2]}x^2y^2z^2}=$ [[0]]

", "type": "gapfill", "scripts": {}, "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"showFeedbackIcon": true, "showCorrectAnswer": true, "customMarkingAlgorithm": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "sortAnswers": false, "gaps": [{"showFeedbackIcon": true, "showCorrectAnswer": true, "checkingType": "absdiff", "vsetRangePoints": 5, "showPreview": true, "vsetRange": [0, 1], "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "answer": "5({a[3]}d+{b[3]}r+m)", "expectedVariableNames": [], "variableReplacements": [], "unitTests": [], "type": "jme", "scripts": {"mark": {"order": "after", "script": "question.mark_factorised(this);"}}, "marks": 1, "checkVariableNames": false, "checkingAccuracy": 0.001, "variableReplacementStrategy": "originalfirst", "failureRate": 1}], "unitTests": [], "prompt": "

$\\simplify{5{a[3]}d+5{b[3]}r+5m}=$ [[0]]

", "type": "gapfill", "scripts": {}, "marks": 0, "variableReplacementStrategy": "originalfirst"}, {"showFeedbackIcon": true, "showCorrectAnswer": true, "customMarkingAlgorithm": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "sortAnswers": false, "gaps": [{"showFeedbackIcon": true, "showCorrectAnswer": true, "checkingType": "absdiff", "vsetRangePoints": 5, "showPreview": true, "vsetRange": [0, 1], "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "answer": "6c*d*({a[4]}d+{b[4]}c+{c[1]}c*d)", "expectedVariableNames": [], "variableReplacements": [], "unitTests": [], "type": "jme", "scripts": {"mark": {"order": "after", "script": "question.mark_factorised(this);"}}, "marks": 1, "checkVariableNames": false, "checkingAccuracy": 0.001, "variableReplacementStrategy": "originalfirst", "failureRate": 1}], "unitTests": [], "prompt": "

$\\simplify{6{a[4]}c*d^2+6{b[4]}c^2d+6{c[1]}c^2d^2}=$ [[0]]

", "type": "gapfill", "scripts": {}, "marks": 0, "variableReplacementStrategy": "originalfirst"}], "ungrouped_variables": ["a", "b", "c", "x1", "x2", "x3", "x4", "x5", "x6", "x7"], "name": "Jo\u00ebl's copy of Extract common factors of polynomials", "variables": {"x1": {"group": "Ungrouped variables", "description": "", "definition": "random(1..5)", "name": "x1", "templateType": "anything"}, "x2": {"group": "Ungrouped variables", "description": "", "definition": "random(1..5)", "name": "x2", "templateType": "anything"}, "b": {"group": "Ungrouped variables", "description": "

Vector of the other every other random prime number

", "definition": "repeat(random(2, 7, 13, 23, 31, 41, 53),50)", "name": "b", "templateType": "anything"}, "a": {"group": "Ungrouped variables", "description": "

Vector of every other random prime number

", "definition": "repeat(random([3, 11, 17, 29, 37, 43] except b),50)", "name": "a", "templateType": "anything"}, "x3": {"group": "Ungrouped variables", "description": "", "definition": "random(1..5 except [x2])", "name": "x3", "templateType": "anything"}, "x7": {"group": "Ungrouped variables", "description": "", "definition": "random(1..5)", "name": "x7", "templateType": "anything"}, "c": {"group": "Ungrouped variables", "description": "

extra primes for when you need a third constant

", "definition": "repeat(random([ 5, 19, 47] ),50)", "name": "c", "templateType": "anything"}, "x4": {"group": "Ungrouped variables", "description": "", "definition": "random(-5..-1)\n\n", "name": "x4", "templateType": "anything"}, "x5": {"group": "Ungrouped variables", "description": "", "definition": "random(1..5)", "name": "x5", "templateType": "anything"}, "x6": {"group": "Ungrouped variables", "description": "", "definition": "random(1..5)", "name": "x6", "templateType": "anything"}}, "preamble": {"js": "question.mark_factorised = function(part) {\n var match = Numbas.jme.display.matchExpression;\n var unwrap = Numbas.jme.unwrapValue;\n var getCommutingTerms = Numbas.jme.display.getCommutingTerms;\n var matchTree = Numbas.jme.display.matchTree;\n\n var expr = part.studentAnswer;\n\n // is the student's answer in the form `factors*(terms)`?\n var m = match('m_all(m_any(m_number,m_type(name),m_type(name)^m_number))*(m_all(??)+m_nothing);rest', expr, true);\n if(!m) {\n part.multCredit(0,\"You don't seem to have extracted a common factor.\");\n return;\n }\n \n var terms = getCommutingTerms(m.rest,'+').terms;\n \n var gcd; // greatest common divisor of the coefficients of each term\n var min_degrees = {}; // minimum degree of each variable across the terms - if greater than 0, that variable is a common factor\n \n // for each term, collect the scalar part and the degree of each of the variables\n terms.map(function(t,i) { \n var factors = getCommutingTerms(t,'*').terms;\n var degrees = {};\n var n = 1;\n factors.forEach(function(f) {\n var tok = f.tok;\n var scalar = 1;\n var name = null;\n var degree = 0;\n var m = Numbas.jme.display.matchTree(Numbas.jme.compile('m_any(m_number;n, m_type(name);name, m_number;n*m_type(name);name, m_type(name);name^(m_number;degree), m_number;n*m_type(name);name^m_number;degree )'),f,true)\n\n console.log(Numbas.jme.display.treeToJME(f));\n\n if(!m) {\n console.log(' no match');\n return;\n }\n console.log(' match',m.n,m.name,m.degree);\n if(m.n) {\n n *= unwrap(m.n.tok);\n }\n if(m.name) {\n name = m.name.tok.name;\n if(m.degree) {\n degree = unwrap(m.degree.tok);\n } else {\n degree = 1;\n }\n degrees[name] = (degrees[name] || 0) + degree;\n }\n });\n console.log(Numbas.jme.display.treeToJME(t), degrees, n);\n \n if(i==0) {\n gcd = n;\n } else {\n gcd = Numbas.math.gcd(gcd,n);\n }\n \n Object.keys(degrees).forEach(function(k) {\n if(i==0) {\n min_degrees[k] = degrees[k];\n } else {\n min_degrees[k] = Math.min(min_degrees[k] || 0, degrees[k]);\n }\n });\n Object.keys(min_degrees).forEach(function(k) {\n if(degrees[k]===undefined) {\n min_degrees[k] = 0;\n }\n });\n \n });\n \n var common_factors = [];\n if(gcd>1) {\n common_factors.push(gcd);\n }\n Object.keys(min_degrees).filter(function(k){return min_degrees[k]>0}).forEach(function(k) {\n common_factors.push(k+'^'+min_degrees[k])\n });\n \n if(common_factors.length==0) {\n return true;\n } else {\n part.multCredit(0,\"Your terms still have a common factor of $\"+Numbas.jme.display.exprToLaTeX(common_factors.join('*'),'all',Numbas.jme.builtinScope)+\"$.\");\n }\n};", "css": ""}, "rulesets": {}, "tags": ["common factors", "common factors of linear algebraic equations", "common factors of quadratic equations", "finding common factors", "Linear equations", "linear equations", "quadratic equations", "Quadratic Equations", "Quadratic equations", "taxonomy"], "statement": "

An expression can be factorised by finding common factors of each term in the expression.

\n

Completely factorise the following expressions by finding their common factors.

\n

Make sure that you include a multiplication symbol * between each algebraic variable, and before brackets, e.g. a*b*(x+1) instead of ab(x+1). Otherwise, the system might not accept your answer.

", "extensions": [], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Factorise polynomials by identifying common factors. The first expression has a constant common factor; the rest have common factors involving variables.

"}, "variable_groups": [], "variablesTest": {"condition": "", "maxRuns": "1000"}, "functions": {}, "advice": "

In order to factorise the expressions, the factors that make up each term in the expression need to be identified and, where these factors are the same for all terms in the expression, those factors can be taken outside the brackets. Stop when the remaining terms have no more common factors.

\n

a)

\n

Both terms have a common factor of $2$.

\n

\\begin{align}
\\simplify{2{a[0]}x+2{b[0]}}&=
(\\simplify[]{2{a[0]}})x+2\\times\\var{b[0]}\\\\
&=\\simplify[]{2({a[0]}x+{b[0]})}
\\end{align}

\n

b)

\n

Both terms have common factors of $6$ and $y$.

\n

\\begin{align}
\\simplify{6{a[1]}y+6{b[1]}y^2}&= 6 \\times \\var{a[1]} y + 6 \\times \\var{b[1]} y^2 \\\\
&= 6 \\times (\\simplify{{a[1]}y + {b[1]}y^2}) \\\\
&=6y(\\simplify[]{{a[1]}+{b[1]}y})
\\end{align}

\n

c)

\n

Both terms have common factors of $x$, $y$ and $z$.

\n

\\begin{align}
\\simplify{{a[2]}x*y*z+{b[2]}x^2y^2z^2}&=\\var{a[2]} \\times xyz + \\var{b[2]} \\times xyz \\times xyz\\\\
&=xyz(\\var{a[2]} + \\var{b[2]} xyz)
\\end{align}

\n

d)

\n

All three terms have a common factor of $5$.

\n

\\begin{align}
\\simplify{5{a[3]}d+5{b[3]}r+5m}&= 5 \\times \\var{a[3]} d+5 \\times \\var{b[3]} r + 5 m \\\\
&=\\simplify[]{5({a[3]}d+{b[3]}r+m)}
\\end{align}

\n

e)

\n

All the terms have common factors of $6$, $c$ and $d$.

\n

\\begin{align}
\\simplify{6{a[4]}cd^2+6{b[4]}c^2d+6{c[1]}c^2d^2} &= 6 \\times \\var{a[4]} c d^2 \\;+\\; 6 \\times \\var{b[4]} c^2 d \\;+\\; 6 \\times \\var{c[1]} c^2 d^2 \\\\
&= 6(\\var{a[4]} c d^2 + \\var{b[4]} c^2 d + \\var{c[1]} c^2 d^2) \\\\
&=6cd(\\var{a[4]}d+\\var{b[4]}c+\\var{c[1]}cd)
\\end{align}

\n

", "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Jo Cohen", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2679/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Jo Cohen", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2679/"}]}