Skip to content
Your progress

Checking your sign-in…

Who's learning?

Each profile keeps its own read lessons, badges, streak, and practice scores on this device.

Lesson 2 of 11

The weighted sum

Show on a big screen

8 min

Text size

Adding shop prices, you keep one running total. It grows with each price you add. The rule's sum works the same way.

Two inputs: gauge 6, days 1. Sum starts at 0.
Step 1 of 3
  1. Two inputs: gauge 6, days 1. Sum starts at 0.
  2. Gauge scaled by weight 6: sum becomes 36.
  3. Days scaled by weight 4: sum becomes 40.

The rule

Each input is scaled by its own weight. The scaled values add into one sum.

  • Input — a number the rule reads — the gauge or the days.
  • Weighted sum — every input times its own weight, all added together.

Scaled by its weight means multiplied by it. The starter weights are gauge weight 6 and days weight 4. Now work out another day yourself: gauge 2, days 1. Gauge: 2 × 6 = 12. Days: 1 × 4 = 4. The sum is 12 + 4 = 16. The log is the caretaker's list of 12 days. Every day in it works the same way. One multiply per input, then one add.

The lab below steps one sum, line by line. Predict each running total before you reveal it.

Loading lab…

Try the lab to finish this lesson.