// Numbas version: exam_results_page_options {"name": "Marte's copy of Expand brackets and collect like terms", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "metadata": {"description": "

Eight expressions, of increasing complexity. The student must simplify them by expanding brackets and collecting like terms.

", "licence": "Creative Commons Attribution 4.0 International"}, "preamble": {"css": "", "js": ""}, "variable_groups": [{"name": "B group", "variables": ["a1", "b1", "c1"]}, {"name": "Part a", "variables": ["a", "b", "c", "d", "f", "g", "h", "j"]}], "variablesTest": {"maxRuns": 100, "condition": ""}, "parts": [{"scripts": {}, "gaps": [{"checkingaccuracy": 0.001, "expectedvariablenames": [], "vsetrange": [0, 1], "maxlength": {"message": "

You must collect like terms to fully simplify.

", "length": "0", "partialCredit": 0}, "showCorrectAnswer": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "showpreview": true, "type": "jme", "scripts": {"mark": {"order": "after", "script": "if(this.credit==0) {\n return;\n}\n// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match against \nvar rule = Numbas.jme.compile('m_number*x');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n// If not, take away marks\nif(!m) {\n //this.setCredit(0,'You haven\\'t simplified: your answer is not in the simplified form ');\n this.setCredit(0);\n this.markingComment('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n this.giveWarning('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n}"}}, "notallowed": {"showStrings": true, "partialCredit": 0, "strings": ["(", ")"], "message": "

"}, "variableReplacements": [], "vsetrangepoints": 5, "answersimplification": "all", "showFeedbackIcon": true, "answer": "({c}+{c}+{c})x", "checkvariablenames": false, "checkingtype": "absdiff"}], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

$\\var{c}x+\\var{c}x+\\var{c}x=$ []

", "marks": 0, "type": "gapfill"}, {"scripts": {}, "gaps": [{"checkingaccuracy": 0.001, "expectedvariablenames": [], "vsetrange": [0, 1], "showCorrectAnswer": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "showpreview": true, "type": "jme", "scripts": {"mark": {"order": "after", "script": "if(this.credit==0) {\n return;\n}\n// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match against \nvar rule = Numbas.jme.compile('m_number*x^2+m_number*x+m_number');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n// If not, take away marks\nif(!m) {\n //this.setCredit(0,'You haven\\'t simplified: your answer is not in the simplified form ');\n this.setCredit(0);\n this.markingComment('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n this.giveWarning('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n}"}}, "notallowed": {"showStrings": true, "partialCredit": 0, "strings": ["(", ")"], "message": "

"}, "variableReplacements": [], "vsetrangepoints": 5, "answersimplification": "all", "showFeedbackIcon": true, "answer": "({a}+{a})x^2+({a}+{a})x+{a}", "checkvariablenames": false, "checkingtype": "absdiff"}], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

$\\var{a}x^2+\\var{a}x^2+\\var{a}x+\\var{a}x +\\var{a}=$ []

", "marks": 0, "type": "gapfill"}, {"scripts": {}, "gaps": [{"checkingaccuracy": 0.001, "expectedvariablenames": [], "vsetrange": [0, 1], "maxlength": {"message": "

", "length": "0", "partialCredit": 0}, "showCorrectAnswer": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "showpreview": true, "type": "jme", "scripts": {"mark": {"order": "after", "script": "if(this.credit==0) {\n return;\n}\n// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match against \nvar rule = Numbas.jme.compile('m_number*y^5');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n// If not, take away marks\nif(!m) {\n //this.setCredit(0,'You haven\\'t simplified: your answer is not in the simplified form ');\n this.setCredit(0);\n this.markingComment('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n this.giveWarning('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n}"}}, "notallowed": {"showStrings": true, "partialCredit": 0, "strings": ["(", ")"], "message": "

"}, "variableReplacements": [], "vsetrangepoints": 5, "answersimplification": "all", "showFeedbackIcon": true, "answer": "({b}+{b}+{b}+{b}+{b})y^5", "checkvariablenames": false, "checkingtype": "absdiff"}], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

$\\var{b}y^5+\\var{b}y^5+\\var{b}y^5+\\var{b}y^5+\\var{b}y^5=$ []

", "marks": 0, "type": "gapfill"}, {"scripts": {}, "gaps": [{"checkingaccuracy": 0.001, "expectedvariablenames": ["a", "b", "c"], "vsetrange": [0, 1], "maxlength": {"message": "

", "length": "0", "partialCredit": 0}, "showCorrectAnswer": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "showpreview": true, "type": "jme", "scripts": {"mark": {"order": "after", "script": "if(this.credit==0) {\n return;\n}\n// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match against \n// we just want two sets of brackets, each containing two terms\n// or one of the brackets might not have a constant term\n// or for repeated roots, you might write (x+a)^2\nvar rule = Numbas.jme.compile('m_number*a*b*c+m_number*a*b+m_number*a+m_number*b+m_number*c');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n// If not, take away marks\nif(!m) {\n //this.setCredit(0,'You haven\\'t simplified: your answer is not in the simplified form ');\n this.setCredit(0);\n this.markingComment('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n this.giveWarning('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n}"}}, "notallowed": {"showStrings": true, "partialCredit": 0, "strings": ["(", ")"], "message": "

"}, "variableReplacements": [], "vsetrangepoints": 5, "showFeedbackIcon": true, "answer": "{d}a*b+({d}+{d})a*b*c+{d}a+{d}b+{d}c", "checkvariablenames": true, "checkingtype": "absdiff"}], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

$\\var{d}ab+\\var{d}abc+\\var{d}a+\\var{d}b+\\var{d}c+\\var{d}abc=$ []

", "marks": 0, "type": "gapfill"}, {"scripts": {}, "gaps": [{"checkingaccuracy": 0.001, "expectedvariablenames": ["a", "b"], "vsetrange": [0, 1], "maxlength": {"message": "

", "length": "0", "partialCredit": 0}, "showCorrectAnswer": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "showpreview": true, "type": "jme", "scripts": {"mark": {"order": "after", "script": "if(this.credit==0) {\n return;\n}\n// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match against \n// we just want two sets of brackets, each containing two terms\n// or one of the brackets might not have a constant term\n// or for repeated roots, you might write (x+a)^2\nvar rule = Numbas.jme.compile('m_any(m_number*a^2*b+m_number*a*b^2+m_number*a*b)');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n// If not, take away marks\nif(!m) {\n //this.setCredit(0,'You haven\\'t simplified: your answer is not in the simplified form ');\n this.setCredit(0);\n this.markingComment('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n this.giveWarning('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n}"}}, "notallowed": {"showStrings": true, "partialCredit": 0, "strings": ["(", ")"], "message": "

\n

$ab^2$ should be written $ba^2$ and $b^2a$ should be written $ab^2$.

\n

"}, "variableReplacements": [], "vsetrangepoints": 5, "answersimplification": "all", "showFeedbackIcon": true, "answer": "({f}+{f})a^2b+({f}+{f})a*b^2+({f})a*b", "checkvariablenames": true, "checkingtype": "absdiff"}], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

$\\var{f}a^2b+\\var{f}ab^2+\\var{f}ab+\\var{f}a^2b+\\var{f}ab^2=$ []

", "marks": 0, "type": "gapfill"}, {"scripts": {}, "gaps": [{"checkingaccuracy": 0.001, "expectedvariablenames": [], "vsetrange": [0, 1], "maxlength": {"message": "

You must condense your answer to fully simplify. *'s are not needed to indicate multiplication here.

", "length": "0", "partialCredit": 0}, "showCorrectAnswer": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "showpreview": true, "type": "jme", "scripts": {"mark": {"order": "after", "script": "if(this.credit==0) {\n return;\n}\n// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match against \n// we just want two sets of brackets, each containing two terms\n// or one of the brackets might not have a constant term\n// or for repeated roots, you might write (x+a)^2\nvar rule = Numbas.jme.compile('m_number*x+m_number*y');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n// If not, take away marks\nif(!m) {\n //this.setCredit(0,'You haven\\'t simplified: your answer is not in the simplified form ');\n this.setCredit(0);\n this.markingComment('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n this.giveWarning('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n}"}}, "notallowed": {"showStrings": true, "partialCredit": 0, "strings": ["(", ")"], "message": "

"}, "variableReplacements": [], "vsetrangepoints": 5, "answersimplification": "all", "showFeedbackIcon": true, "answer": "({g}{g}+{g})x+({g}{g}+{g})y", "checkvariablenames": false, "checkingtype": "absdiff"}], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

$\\var{g}(\\var{g}x+\\var{g}y)+\\var{g}x+\\var{g}y=$ []

\n

", "marks": 0, "type": "gapfill"}, {"scripts": {}, "gaps": [{"checkingaccuracy": 0.001, "musthave": {"showStrings": false, "partialCredit": 0, "strings": ["*"], "message": ""}, "expectedvariablenames": ["x", "z"], "vsetrange": [0, 1], "maxlength": {"message": "

", "length": "0", "partialCredit": 0}, "showCorrectAnswer": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "showpreview": true, "type": "jme", "scripts": {"mark": {"order": "after", "script": "if(this.credit==0) {\n return;\n}\n// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match against \n// we just want two sets of brackets, each containing two terms\n// or one of the brackets might not have a constant term\n// or for repeated roots, you might write (x+a)^2\nvar rule = Numbas.jme.compile('m_any(m_number*x*z+m_number*x^2+m_number*x+m_number*z+m_number*z^2)');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n// If not, take away marks\nif(!m) {\n //this.setCredit(0,'You haven\\'t simplified: your answer is not in the simplified form ');\n this.setCredit(0);\n this.markingComment('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n this.giveWarning('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n}"}}, "notallowed": {"showStrings": true, "partialCredit": 0, "strings": ["(", ")"], "message": "

"}, "variableReplacements": [], "vsetrangepoints": 5, "answersimplification": "all", "showFeedbackIcon": true, "answer": "({h}{h}+{h})x^2+({h}{h})z*x+{h}x+{h}z^2+{h}z", "checkvariablenames": true, "checkingtype": "absdiff"}], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

$\\var{h}x(\\var{h}x+\\var{h}z)+\\var{h}x+\\var{h}z+\\var{h}x^2+\\var{h}z^2=$ []

", "marks": 0, "type": "gapfill"}, {"scripts": {}, "gaps": [{"checkingaccuracy": 0.001, "expectedvariablenames": ["x", "y"], "vsetrange": [0, 1], "maxlength": {"message": "

", "length": "0", "partialCredit": 0}, "showCorrectAnswer": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "showpreview": true, "type": "jme", "scripts": {"mark": {"order": "after", "script": "if(this.credit==0) {\n return;\n}\ndebugger;\n// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match against \n// we just want two sets of brackets, each containing two terms\n// or one of the brackets might not have a constant term\n// or for repeated roots, you might write (x+a)^2\nvar rule = Numbas.jme.compile('m_any(m_number*x+m_pm(m_number*y))');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n// If not, take away marks\nif(!m) {\n //this.setCredit(0,'You haven\\'t simplified: your answer is not in the simplified form ');\n this.setCredit(0);\n this.markingComment('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n this.giveWarning('You haven\\'t simplified: you still have two or more like terms that should be collected together.');\n}"}}, "notallowed": {"showStrings": true, "partialCredit": 0, "strings": ["(", ")"], "message": "

"}, "variableReplacements": [], "vsetrangepoints": 5, "answersimplification": "all", "showFeedbackIcon": true, "answer": "({j}{j}+{j}{j}+{j}{j})x-({j}{j}+{j}{j}+{j}{j})y", "checkvariablenames": true, "checkingtype": "absdiff"}], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

$\\var{j}(\\var{j}x-\\var{j}y)+\\var{j}(\\var{j}x-\\var{j}y)+\\var{j}(\\var{j}x-\\var{j}y)=$ []

", "marks": 0, "type": "gapfill"}], "ungrouped_variables": [], "functions": {}, "tags": ["collecting terms", "expanding brackets", "simplifying algebraic expressions", "simplifying expressions", "taxonomy"], "statement": "

For each expression below, collect like terms and expand brackets.

\n

The * symbol is required between algebraic symbols, e.g. $5ab^2$ should be written 5*a*b^2.

", "variables": {"b1": {"templateType": "anything", "description": "", "name": "b1", "definition": "random(2..10 except a1)", "group": "B group"}, "a1": {"templateType": "anything", "description": "", "name": "a1", "definition": "random(5..10)", "group": "B group"}, "c1": {"templateType": "anything", "description": "", "name": "c1", "definition": "random(2..5)*2", "group": "B group"}, "f": {"templateType": "anything", "description": "", "name": "f", "definition": "repeat(random(2..20),7)", "group": "Part a"}, "g": {"templateType": "anything", "description": "", "name": "g", "definition": "repeat(random(2..15),7)", "group": "Part a"}, "b": {"templateType": "anything", "description": "", "name": "b", "definition": "repeat(random(2..10),5)", "group": "Part a"}, "d": {"templateType": "anything", "description": "", "name": "d", "definition": "repeat(random(2..33),6)", "group": "Part a"}, "j": {"templateType": "anything", "description": "", "name": "j", "definition": "repeat(random(2..20),9)", "group": "Part a"}, "h": {"templateType": "anything", "description": "", "name": "h", "definition": "repeat(random(2..20),7)", "group": "Part a"}, "c": {"templateType": "anything", "description": "", "name": "c", "definition": "repeat(random(2..10),5)", "group": "Part a"}, "a": {"templateType": "anything", "description": "

random variables for part 1

", "name": "a", "definition": "repeat(random(5..15),5)", "group": "Part a"}}, "advice": "

When simplifying expressions, only terms of the same type or like terms can be added together.

\n

Algebraic symbols or letters can be added together provided that they are raised to the same power. For example, we can add $x^2+x^2=2x^2$, but we cannot collect both $x^2$ and $x$ into one term.

\n

#### a)

\n

\\\begin{align} \\var{c}x+\\var{c}x+\\var{c}x&=(\\var{c}+\\var{c}+\\var{c})x\\\\ &=\\simplify{({c}+{c}+{c})}x \\end{align} \

\n

#### b)

\n

\\\begin{align} \\var{a}x^2+\\var{a}x^2+\\var{a}x+\\var{a}x +\\var{a}&=(\\var{a}+\\var{a})x^2+(\\var{a}+\\var{a})x +\\var{a}\\\\ &=\\simplify{({a}+{a})}x^2+\\simplify{({a}+{a})}x+\\var{a} \\end{align} \

\n

#### c)

\n

\\\begin{align} \\var{b}y^5+\\var{b}y^5+\\var{b}y^5+\\var{b}y^5+\\var{b}y^5&=(\\var{b}+\\var{b}+\\var{b}+\\var{b}+\\var{b})y^5\\\\ &=\\simplify{({b}+{b}+{b}+{b}+{b})}y^5 \\end{align} \

\n

#### d)

\n

\\\begin{align} \\var{d}ab+\\var{d}abc+\\var{d}a+\\var{d}b+\\var{d}c+\\var{d}abc &=(\\var{d}+\\var{d})abc+\\var{d}ab+\\var{d}a+\\var{d}b+\\var{d}c\\\\ &=\\simplify{{d}+{d}}abc+\\var{d}ab+\\var{d}a+\\var{d}b+\\var{d}c \\end{align} \

\n

#### e)

\n

\\\begin{align} \\var{f}a^2b+\\var{f}ab^2+\\var{f}ab+\\var{f}a^2b+\\var{f}ab^2 &=(\\var{f}+\\var{f})a^2b+(\\var{f}+\\var{f})ab^2+\\var{f}ab\\\\ &=\\simplify{{f}+{f}}a^2b+\\simplify{{f}+{f}}ab^2+\\var{f}ab \\end{align} \

\n

#### f)

\n

\\\begin{align} \\var{g}(\\var{g}x+\\var{g}y)+\\var{g}x+\\var{g}y &=(\\var{g}\\times \\var{g}+\\var{g})x+(\\var{g} \\times\\var{g}+\\var{g})y\\\\ &=(\\simplify{{g}*{g}}+\\var{g})x+(\\simplify{{g}*{g}}+\\var{g})y\\\\ &=\\simplify{{g}*{g}+{g}}x+\\simplify{{g}*{g}+{g}}y \\end{align} \

\n

#### g)

\n

\\\begin{align} \\var{h}x(\\var{h}x+\\var{h}z)+\\var{h}x+\\var{h}z+\\var{h}x^2+\\var{h}z^2 &=(\\simplify[]{{h}{h}}+\\var{h})x^2+(\\simplify[]{{h}{h}})zx+\\var{h}x+\\var{h}z^2+\\var{h}z\\\\ &=(\\simplify{{h}{h}}+\\var{h})x^2+(\\simplify[]{{h}{h}})zx+\\var{h}x+\\var{h}z^2+\\var{h}z\\\\ &=\\simplify{{h}*{h}+{h}}x^2+\\simplify{{h}*{h}}zx+\\simplify{{h}x+{h}}z^2+\\var{h}z \\end{align} \

\n

#### h)

\n

\\\begin{align} \\var{j}(\\var{j}x-\\var{j}y)+\\var{j}(\\var{j}x-\\var{j}y)+\\var{j}(\\var{j}x-\\var{j}y) &= (\\simplify[]{{j}{j}}+\\simplify[]{{j}{j}}+\\simplify[]{{j}{j}})x-(\\simplify[]{{j}{j}}+\\simplify[]{{j}{j}}+\\simplify[]{{j}{j}})y\\\\ &= (\\simplify{{j}{j}}+\\simplify{{j}{j}}+\\simplify{{j}{j}})x-(\\simplify{{j}{j}}+\\simplify{{j}{j}}+\\simplify{{j}{j}})y\\\\ &= \\simplify{({j}*{j}+{j*j}+{j}*{j})x}-\\simplify{({j}*{j}+{j}{j}+{j}*{j})y} \\end{align} \

\n", "name": "Marte's copy of Expand brackets and collect like terms", "extensions": ["stats"], "type": "question", "contributors": [{"name": "Marte Br\u00e5talien", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2349/"}]}]}], "contributors": [{"name": "Marte Br\u00e5talien", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2349/"}]}