Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 6

Summation and Product Notation

Recommended resources

Welcome to our next lesson. We've spent the last few sessions building a solid foundation in core mathematical concepts, from functions to trigonometry. Today, we'll learn about a powerful form of mathematical shorthand that is indispensable in computer science, statistics, and AI: summation and product notation.

You'll often encounter situations where you need to add or multiply a long sequence of numbers that follow a specific pattern. For example, in AI, you might need to sum up the errors from every data point to see how well your model is performing. Writing this out manually (error1 + error2 + error3 + ...) would be tedious and imprecise. Today's lesson introduces the formal, compact notation for doing just that.

Our learning outcome is to compute with summation (Σ) and product (Π) notation. We will break down what these symbols mean, how to read them, and how to use them. This notation is the direct mathematical equivalent of the loops you will soon be writing in your first programming language, so understanding the principle here will give you a significant head start.

1. The Language of Sums: Sigma (Σ) Notation

Imagine you want to add the first 100 integers. You could write , but this relies on the reader guessing the pattern. Summation notation, which uses the capital Greek letter Sigma (Σ), provides a precise way to express this.

The following video from Khan Academy gives a clear introduction to why this notation is needed and how it works.

Sigma notation for sums | Sequences, series and induction | Precalculus | Khan Academy

This video introduces the fundamental concept of Sigma notation as a tool for representing long sums concisely.

Please watch from the beginning up to the second example. Pay attention to how the instructor translates a simple sum (1+2+...+100) into Σ notation.

As the video explained, the notation has several key parts. Let's break down its anatomy.

The components of summation notation. The large Sigma indicates a sum. The variable below it is the index, which starts at the lower limit and increments by one until it reaches the upper limit. The expression to the right is what gets calculated and added for each value of the index.

Here is a more precise breakdown of the image above:

  • Index of Summation (e.g., , , ): This is a temporary variable that takes on integer values, one by one. In the image, the index is n.
  • Lower Limit (or First Value): The integer where the index starts. In the image, this is 1.
  • Upper Limit (or Last Value): The integer where the index ends. In the image, this is n.
  • Expression (or "nth term"): The rule or formula that is calculated for each value of the index. The results are then added together. In the image, the expression is simply n.

So, the notation means:

  1. Start with . The expression is 1. Current sum is 1.
  2. Increment to . The expression is 2. Current sum is .
  3. Increment to . The expression is 3. Current sum is .
  4. Increment to . The expression is 4. Current sum is .
  5. Increment to . The expression is 5. Current sum is .
  6. Stop, because we have reached the upper limit. The final result is 15.

The Connection to Programming

This step-by-step process—initialize, check condition, execute, increment—is exactly how a for loop works in programming. Thinking of summation notation as a "math loop" is a very powerful analogy that will serve you well.

The following article makes this connection explicit with code examples. While you haven't started programming yet, the structure of the examples should feel intuitive based on our breakdown.

Math for devs - Sum and Product Notation - DEV Community

This article breaks down both summation and product notation and directly connects them to the concept of 'for loops' in programming.

First, review the section "Understanding the anatomy" to reinforce the components. Next, work through the worked Examples. Don't just look at the answers; try to calculate the first few terms yourself to see how the total is built up. Finally, read the section "Summation and product notations are just for loops". This is the key insight. Notice how the lower and upper bounds of the Σ become the start and end conditions of the for loop, and the expression inside the Σ becomes the body of the loop.


2. The Language of Products: Pi (Π) Notation

Just as we have a symbol for repeated addition, we also have one for repeated multiplication. This is product notation, and it uses the capital Greek letter Pi (Π).

The structure is identical to Sigma notation: it has an index, a lower limit, an upper limit, and an expression. The only difference is that you multiply the terms instead of adding them.

The next video gives a quick and clear introduction to Π notation, directly comparing it to the Σ notation we just learned.

Π Product Notation

In this video, Eddie Woo introduces Pi notation and shows how it relates to concepts like factorials.

Watch the first part of the video, from the beginning. Focus on the core distinction: Σ means "add them up," while Π means "multiply them."

For example, to express the product , we could write:

This notation is fundamental to many areas of mathematics, particularly in probability, where the probability of several independent events occurring is the product of their individual probabilities.

As a preview for our next lesson, product notation gives us a formal way to define the factorial of a number , written as , which is the product of all positive integers up to .


3. Deeper Properties

Since you prefer to understand the underlying principles, let's explore a few formal properties and conventions. These rules help us manipulate and simplify expressions involving summations.

[PDF] Notes on summations and related topics

This document from Yale University provides a more formal, rigorous treatment of these notations. We will look at a few specific, important rules.

Please read the following short excerpts: Double Sums: In section 1.7, read the paragraph that starts "Nothing says...". This introduces nested sums, which correspond to nested for loops in programming. Summation Identities: In section 2.2, read the first two paragraphs explaining linearity. This covers the rules for pulling out constants and splitting sums. Empty Sums vs. Empty Products: In section 3, read the paragraph that explains the convention for empty sums and products. It starts "The other difference...". This is a crucial concept.

Let's summarize those key points from the reading:

  • Linearity: You can pull a constant multiplier out of a summation. For example, . This is just an application of the distributive property: .
  • Splitting Sums: A summation of a sum is the sum of the summations. For instance, .
  • Double Sums: A nested sum like means you loop through the outer index , and for each value of , you loop through all values of the inner index . This is very common in algorithms involving grids or matrices.
  • Empty Operations:
    • An empty sum (where the upper limit is less than the lower limit, e.g., ) is defined as 0. This is the additive identity—adding it to any number leaves that number unchanged.
    • An empty product (e.g., ) is defined as 1. This is the multiplicative identity—multiplying any number by it leaves that number unchanged. These conventions prevent exceptions and errors in mathematical formulas and algorithms.

Conclusion

In this lesson, we demystified two essential mathematical notations that you will see everywhere on your journey into CS and AI. They provide a precise and compact language for expressing repeated addition and multiplication.

Here are our main takeaways:

  • Summation Notation (Σ) is used for repeated addition.
  • Product Notation (Π) is used for repeated multiplication.
  • Both notations are defined by an index, a lower limit, an upper limit, and an expression to be evaluated.
  • These notations are the mathematical counterparts to for loops in programming, a concept we will explore in depth soon.
  • By convention, an empty sum is 0 (the additive identity) and an empty product is 1 (the multiplicative identity).

This lesson and the next one conclude our first module on mathematical foundations. You are now equipped with the fundamental notation needed to understand more advanced topics. In our next, very brief lesson, we will focus on a special application of product notation: factorials.