randFromArray([ ["in", "inch"], ["ft", "foot"], ["m", "meter"], ["cm", "centimeter"], ["", "unit"] ])
randRange(1, 8)

One side of a square is S plural(UNIT_TEXT, S) long. What is its perimeter?

4 * S plural(UNIT_TEXT)
init({ range: [[-1, 6], [-1, 6]] }); path([[0, 0], [5, 0], [5, 5], [0, 5], true], { stroke: BLUE, fill: "#eee" }); path([[0, 0], [0, 5]], { "stroke": PINK }); label([0, 2.5], S + "\\text{ " + UNIT + "}", "left", { "color": PINK });

The perimeter is the total length of all the sides of the shape added together.

path([[0, 0], [0, 5]], { strokeWidth: 4, stroke: PINK }); path([[0, 5], [5, 5]], { strokeWidth: 4, stroke: BLUE }); path([[5, 5], [5, 0]], { strokeWidth: 4, stroke: "purple" }); path([[5, 0], [0, 0]], { strokeWidth: 4, stroke: GREEN });

Add up the lengths of the sides:

\qquad\text{perimeter} = \pink{S} + \blue{S} + \purple{S} + \green{S}

\qquad\text{perimeter} = S * 4\text{ UNIT}

randRange(1, 8)

The perimeter of a square is 4 * S plural(UNIT_TEXT). How long is each side?

S plural(UNIT_TEXT)
init({ range: [[-1, 6], [-1, 6]] }); path([[0, 0], [5, 0], [5, 5], [0, 5], true], { stroke: BLUE, fill: "#eee" }); path([[0, 0], [0, 5]], { "stroke": PINK }); label([0, 2.5], "\\text{? " + UNIT + "}", "left", { "color": PINK });
path([[0, 0], [0, 5]], { strokeWidth: 4, stroke: PINK }); path([[0, 5], [5, 5]], { strokeWidth: 4, stroke: BLUE }); path([[5, 5], [5, 0]], { strokeWidth: 4, stroke: PURPLE }); path([[5, 0], [0, 0]], { strokeWidth: 4, stroke: GREEN });

The perimeter is the total length of all the sides of the shape added together.

\qquad \pink{\text{?}} + \blue{\text{?}} + \purple{\text{?}} + \green{\text{?}} = 4 * S\text{ UNIT}

\qquad \pink{S} + \blue{S} + \purple{S} + \green{S} = 4 * S\text{ UNIT}

The sides of a square are all the same length, so each side must be S plural(UNIT_TEXT, S) long.

randRange(1, 8) randRange(1, 8)

A rectangle is L plural(UNIT_TEXT, L) long and W plural(UNIT_TEXT, W) wide. What is its perimeter?

2 * L + 2 * W plural(UNIT_TEXT)
init({ range: [[-1, L + 1], [-1, W + 1]], scale: 200 / max(L, W) }); path([[0, 0], [L, 0], [L, W], [0, W], true], { stroke: BLUE, fill: "#eee" }); label([L / 2, W], L + "\\text{ " + UNIT + "}", "above"); label([L, W / 2], W + "\\text{ " + UNIT + "}", "right");

The perimeter is the total length of all the sides of the shape added together.

path([[0, 0], [0, W]], { strokeWidth: 4, stroke: PINK }); path([[0, W], [L, W]], { strokeWidth: 4, stroke: BLUE }); path([[L, W], [L, 0]], { strokeWidth: 4, stroke: PURPLE }); path([[L, 0], [0, 0]], { strokeWidth: 4, stroke: GREEN });

Add up the lengths of the sides:

\qquad\text{perimeter} = \pink{W} + \blue{L} + \purple{W} + \green{L}

\qquad\text{perimeter} = 2 * L + 2 * W\text{ UNIT}