// Numbas version: exam_results_page_options {"name": "Samantha's copy of Create an algebraic expression from a word problem, simplify, and evaluate", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"description": "

Given a description in words of the costs of some items in terms of an unknown cost, write down an expression for the total cost of a selection of items. Then simplify the expression, and finally evaluate it at a given point.

\n

The word problem is about the costs of sweets in a sweet shop.

", "licence": "Creative Commons Attribution 4.0 International"}, "tags": ["algebraic expressions", "collect terms", "create algebraic expressions", "simplify algebraic expressions", "simplifying algebraic expressions", "taxonomy"], "statement": "

{name} eats a lot of sweets. You are trying to work out the cost of the sweets that {name} ate last week.

\n

{name} ate $\\var{a1}$ packets of lollipops, $\\var{b1}$ packets of toffee and $\\simplify{{c1}}$ packets of jelly sweets.

\n

You know that a packet of toffee costs $£1$ more than a packet of lollipops, and a packet of jelly sweets costs half as much as a packet of toffees.

", "functions": {}, "variables": {"b1": {"definition": "random(2..10 except a1)", "group": "Number of packets eaten", "templateType": "anything", "description": "

Number of packets of toffee eaten

", "name": "b1"}, "name": {"definition": "random('Jerry','Jessica')", "group": "Ungrouped variables", "templateType": "anything", "description": "", "name": "name"}, "c1": {"definition": "random(2..5)*2", "group": "Number of packets eaten", "templateType": "anything", "description": "

Number of packets of jelly sweets eaten.

", "name": "c1"}, "total": {"definition": "(a1+b1+c1/2)*2 + b1+c1/2", "group": "Ungrouped variables", "templateType": "anything", "description": "

The total spent.

", "name": "total"}, "a1": {"definition": "random(5..10)", "group": "Number of packets eaten", "templateType": "anything", "description": "

Number of packets of lollipops eaten

", "name": "a1"}}, "name": "Samantha's copy of Create an algebraic expression from a word problem, simplify, and evaluate", "advice": "

a)

\n

We are told that the price of a packet of lollipops is represented by the letter $x$.

\n

A packet of toffee costs $£1$ more than a packet of lollipops, i.e. $x+1$.

\n

A packet of jelly sweets costs half as much as a packet of toffee, so $\\frac{1}{2}(x+1)$.

\n

b)

\n

To find the total cost, multiply the expressions above for the cost of each kind of sweet by the number of packets eaten, and add them together.

\n

Without simplifying, we obtain:

\n

\\begin{align}
\\text{Cost} &= \\simplify[]{{a1}x+{b1}(x+1) + {c1}*(1/2)*(x+1)} \\\\
&= \\simplify[]{{a1}x+{b1}(x+1) + {c1/2}*(x+1)}
\\text{.}
\\end{align}

\n

c)

\n

The first step in simplifying this expression is to expand both sets of brackets:

\n

\\begin{align}
\\simplify[]{ {a1}x + {b1}(x+1) + {c1/2}*(x+1)} &= \\simplify[]{ {a1}x + {b1}x + {b1}*1 + {c1/2}x + {c1/2}*1} \\\\
&= \\simplify[] { {a1}x + {b1}x + {b1} + {c1/2}x + {c1/2} } \\text{.}
\\end{align}

\n

Finally, collect like terms:

\n

\\begin{align}
\\simplify[] { {a1}x + {b1}x + {b1} + {c1/2}x + {c1/2} } &= \\simplify[]{ {a1+b1+c1/2}x + {b1+c1/2} } \\text{.}
\\end{align}

\n

\n

d)

\n

Once we know that the price of a packet of lollipops is $£2$, we can substitute this for $x$ in the equation above.

\n

\\begin{align}
\\text{Cost}&=\\simplify{ {a1+b1+c1/2}x+{b1+c1/2} }\\\\
&=\\var{a1+b1+c1/2} \\times 2+\\var{b1+c1/2} \\\\
&=\\var{(a1+b1+c1/2)*2+b1+c1/2} \\text{.}
\\end{align}

\n

So {name} spent $£\\var{total}$ on sweets last week.

", "variable_groups": [{"name": "Number of packets eaten", "variables": ["a1", "b1", "c1"]}], "extensions": ["stats"], "parts": [{"showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

Let the cost of a packet of lollipops be $£x$.

\n

Write an expression in terms of $x$ for the cost of each kind of sweet:

\n

Lollipops: £[[0]]

\n

Toffees: £[[1]]

\n

Jelly sweets: £[[2]]

", "variableReplacements": [], "marks": 0, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "scripts": {}, "gaps": [{"checkingtype": "absdiff", "type": "jme", "vsetrange": [0, 1], "checkvariablenames": false, "scripts": {}, "variableReplacementStrategy": "originalfirst", "expectedvariablenames": [], "answer": "x", "showCorrectAnswer": true, "showFeedbackIcon": true, "vsetrangepoints": 5, "showpreview": true, "variableReplacements": [], "checkingaccuracy": 0.001, "marks": 1}, {"checkingtype": "absdiff", "type": "jme", "vsetrange": [0, 1], "checkvariablenames": false, "scripts": {}, "variableReplacementStrategy": "originalfirst", "expectedvariablenames": [], "answer": "x+1", "showCorrectAnswer": true, "showFeedbackIcon": true, "vsetrangepoints": 5, "showpreview": true, "variableReplacements": [], "checkingaccuracy": 0.001, "marks": 1}, {"checkingtype": "absdiff", "type": "jme", "vsetrange": [0, 1], "checkvariablenames": false, "scripts": {}, "variableReplacementStrategy": "originalfirst", "expectedvariablenames": [], "answer": "1/2(x+1)", "showCorrectAnswer": true, "showFeedbackIcon": true, "vsetrangepoints": 5, "showpreview": true, "variableReplacements": [], "checkingaccuracy": 0.001, "marks": 1}]}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

Write an algebraic expression for the overall cost of the sweets {name} ate, in terms of $x$.

\n

£[[0]]

", "variableReplacements": [], "marks": 0, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "scripts": {}, "gaps": [{"answersimplification": "all", "checkingtype": "absdiff", "type": "jme", "vsetrange": [0, 1], "checkvariablenames": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "scripts": {}, "expectedvariablenames": ["x"], "answer": "({a1}+{b1}+{c1}/2)x+({b1}+{c1}/2)", "showCorrectAnswer": true, "showFeedbackIcon": true, "vsetrangepoints": 5, "showpreview": true, "variableReplacements": [], "checkingaccuracy": 0.001}]}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

Now simplify your expression for the total cost.

\n

£[[0]]

", "variableReplacements": [], "marks": 0, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "scripts": {}, "gaps": [{"answersimplification": "all", "checkingtype": "absdiff", "type": "jme", "vsetrange": [0, 1], "checkvariablenames": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "scripts": {"mark": {"order": "after", "script": "// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchExpression('m_number*x+m_number',this.studentAnswer,true);\n// If not, take away marks\nif(!m) {\n this.multCredit(0,'Your answer is not fully simplified.');\n}"}}, "expectedvariablenames": ["x"], "answer": "({a1}+{b1}+{c1}/2)x+({b1}+{c1}/2)", "showCorrectAnswer": true, "showFeedbackIcon": true, "vsetrangepoints": 5, "showpreview": true, "variableReplacements": [], "checkingaccuracy": 0.001}]}, {"showCorrectAnswer": true, "showFeedbackIcon": true, "prompt": "

You find out that a packet of lollipops costs $£2$.

\n

Calculate {name}'s total expenditure on sweets last week.

\n

£[[0]]

", "variableReplacements": [], "marks": 0, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "scripts": {}, "gaps": [{"answersimplification": "all", "checkingtype": "absdiff", "type": "jme", "vsetrange": [0, 1], "checkvariablenames": true, "marks": 1, "variableReplacementStrategy": "originalfirst", "scripts": {}, "expectedvariablenames": ["x"], "answer": "({a1}+{b1}+{c1}/2)2+{b1}+{c1}/2", "showCorrectAnswer": true, "showFeedbackIcon": true, "vsetrangepoints": 5, "showpreview": true, "variableReplacements": [], "checkingaccuracy": 0.001, "notallowed": {"strings": ["(", ")"], "message": "

Don't use brackets

", "partialCredit": 0, "showStrings": true}}]}], "preamble": {"css": "", "js": ""}, "variablesTest": {"condition": "gcd(a1,b1+c1/2)=1", "maxRuns": 100}, "rulesets": {}, "ungrouped_variables": ["name", "total"], "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Samantha Konig", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2560/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Samantha Konig", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2560/"}]}