Multi-part algebra

From arithmetic to algebra

In the previous section, you saw how to define a solution model for multi-part arithmetic exercises. We will now extend this to questions that involve algebra. The difference between algebra and arithmetic questions is that the solution uses variables and equations. Here are two examples of multi-part problems that involve algebra:

  1. "Find the formula of the linear line intersecting (1,3)(1,3) and (3,1)(3,-1)."
  2. "A rectangular piece of land has an area of 2400m22400 m^2. The length of the land is 20m20 m longer than the width. What is the total length LL of a fence surrounding this land?"

We will create both examples using the Multistep question type. You can try them in the live examples below:

Live example: The multi-part algebra problems.

Example 1: The formula of a line

Consider the first example.

Example problem 1

Find the formula y=mx+by=mx+b for the line intersecting (1,3)(1,3) and (3,1)(3,-1).

The solution to this problem requires the following parts:

  1. Calculate the slope, mm
  2. Find the yy-offset, bb, by substituting one of the given points
  3. Write the formula for yy.

We turn this into a solution model as follows:

Part Description Calculation Marks
yy the requested formula y=mx+by=m\cdot x+b 1
mm the slope 1331\frac{-1-3}{3-1} 1
bb the yy-intercept Solve 3=m1+b3=m\cdot 1+b for bb 1

Note that we did not define the part for yy as y=52xy=5-2x, which is the answer to the problem. Instead, we keep variables mm and bb to let Algebrakit know these are required to find the solution. You can also see that the slope mm is needed to calculate the yy-offset. Algebrakit will calculate the slope first, followed by the yy-intercept, and the solution.

Now let's create this question in Multistep.

  • Add two new exercise parts and name them mm and bb.
  • Add the descriptions to the parts as given in the solution model.
  • Set the tasks corresponding to the calculations in the solution model. Choose task Solve equations for exercise part mm and Simplify for the other exercise parts.
  • In the menu of the part names yy, mm and bb, check the option student variable as shown in the screenshot below.

Enabling student variables Figure: Enabling student variables.

Student variables

An important step is checking option Student variable in the exercise parts yy, mm and bb. Names of exercise parts are just references to other parts and are not visible to students. However, when you configure a part name as a student variable, it becomes a variable students can use in their work.

If you do not configure mm and bb as student variables, Algebrakit will not correctly interpret expressions that involve these variables. Here are some examples.

Student input Evaluation with student variables Evaluation without student variables
y=mx+by=mx+b Correct intermediate step. Algebrakit understands mm and bb still need to be calculated. Incorrect. Algebrakit does not allow using mm or bb.
2-2 Correct intermediate step. The input is assumed to correspond to the slope. Same
m=2m=-2 Correct intermediate step. Algebrakit understands that mm is the slope, which equals -2. Incorrect. Algebrakit does not interpret mm as the slope.
m3+b=1m\cdot 3+b=-1 Correct intermediate step. Algebrakit knows that m=2m=-2 and b=5b=5, so the relation is valid. Incorrect. Algebrakit does not allow using mm or bb.

This is a significant improvement. Students can now build their solutions by writing formulas and equations first and solving them later. From a didactical point of view, we transitioned from arithmetic to algebraic thinking.

Example 2: An algebra word problem

We will now create the second example question:

Example problem 2

A rectangular piece of land has an area of 2400m22400 m^2. The length of the land is 20m20 m longer than the width.

What is the total length LL of a fence that surrounds this land?

You can solve this problem in two ways:

  1. Calculating the width first:
    • Find the width ww by solving equation w(w+20)=2400w(w+20)=2400
    • Find the circumference as 2w+2(w+20)2w+2(w+20).
  2. Calculating the length first:
    • Find the height ll by solving equation l(l20)=2400l(l-20)=2400
    • Find the circumference as 2l+2(l20)2l+2(l-20).

Which results in the following solution models:

Part Description Calculation Marks
ww the width of the land Solve w(w+20)=2400w(w+20)=2400 1
LL the length of the fence 2w+2(w+20)2w+2(w+20) 1
Part Description Calculation Marks
ll the length of the land Solve l(l20)=2400l(l-20)=2400 1
LL the length of the fence 2l+2(l20)2l+2(l-20) 1

You add these to Multistep as follows:

  • Add two new exercise parts with names ww and ll. Rename the solution part to LL.
  • Check the Student variable option on all three exercise parts.
  • Add the descriptions to all exercise parts
  • Set the tasks. Use the Simplify task for LL and the Solve equations task for ww and ll.

If you test the exercise, you will see that Algebrakit complains about student variable ww.

Error message when a student variables does not have a single value

The issue is that the equation w(w+20)=2400w(w+20)=2400 has two solutions: w=60w=-60 and w=40w=40. To not complicate things, Algebrakit only allows using ww as a student variable if it has a single result. You can solve this problem by adding the domain w>0w>0 to the equation, as shown below:

Adding a domain to enforce a single result Figure: Adding a domain to enforce a single result.

Add a domain to exercise part ll as well. You should now be able to run the question.

Free variables

The exercise already works well. You can apply algebraic thinking, using formulas and equations for variables LL, ww, and ll, and Algebrakit will understand. But we can go even further.

The instruction does not mention variables ww and ll. Even more, the question does not indicate that you should variables at all. It is apparently up to the student to come up with that approach. This is an example of modelling, an important mathematical skill.

So now we have the problem that the solution model assumes students use variables ww or ll, but we don't want to include that information in the instruction. The solution is to declare ww and ll as free variables. This means that students do not have to use the same variable name but are free to choose.

You declare a free variable in the symbols tab on the top bar.

Defining free variables Figure: Defining free variables.

The example below shows an example of a correct solution to this problem.

Choosing custom variable names when solving the question Figure: Choosing custom variable names when solving the question.


A free variable must be a single symbol. So students cannot use a variable name like 'widthwidth'.

Restrictions when using student variables

These examples show how student variables are a powerful concept that helps students to apply algebraic thinking. However, there are a few limitations when using this technique.

  • Student variables must have exactly one solution. We saw this already in the second example. If the variable is defined by an equation, you might have to add a domain. Note that it is also not ok if the equation has no solutions.
  • Student variables cannot refer to each other. Assume aa and bb are student variables. If the task for aa depends on bb and the task for bb depends on aa, then Algebrakit will show an error message if you try to run the exercise. The reason is that no order exists to calculate the results for each part. This is currently not supported.