ArticleslgStudy

mathematics

Sum of squares function

Sum of squares function is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Sum of squares function rather than just read about it. In short: In number theory, the sum of squares function is an arithmetic function that gives the number of representations for a given positive integer n as the sum of k squares, where representations that differ only in the order of the summands or in the signs of the numbers being squared are counted as different. It is denoted by rk(n).

Sum of squares function — main illustration
Sum of squares function — illustration

Key takeaways

  • Sum of squares function belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Sum of squares function to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Sum of squares function from memory before moving on to harder problems.

Reference excerpt

In number theory, the sum of squares function is an arithmetic function that gives the number of representations for a given positive integer n as the sum of k squares, where representations that differ only in the order of the summands or in the signs of the numbers being squared are counted as different. It is denoted by rk(n).

Definition The function is defined as

rk(n)=|{(a1,a2,…,ak)∈ℤk : n=a12+a22+⋯+ak2}| where | | denotes the cardinality of a set. In other words, rk(n) is the number of ways n can be written as a sum of k squares. For example, r2(1)=4 since 1=02+(±1)2=(±1)2+02 where each sum has two sign combinations, and also r2(2)=4 since 2=(±1)2+(±1)2 with four sign combinations. On the other hand, r2(3)=0 because there is no way to represent 3 as a sum of two squares.

Formulae

k = 2

The number of ways to write a natural number as sum of two squares is given by r2(n). It is given explicitly by

r2(n)=4(d1(n)−d3(n)) where d1(n) is the number of divisors of n which are congruent to 1 modulo 4 and d3(n) is the number of divisors of n which are congruent to 3 modulo 4. Using sums, the expression can be written as:

r2(n)=4∑d∣nd≡1,3(mod4)(−1)(d−1)/2 The prime factorization n=2gp1f1p2f2⋯q1h1q2h2⋯, where pi are the prime factors of the form pi≡1(mod4), and qi are the prime factors of the form qi≡3(mod4) gives another formula

r2(n)=4(f1+1)(f2+1)⋯, if all exponents h1,h2,⋯ are even. If one or more hi are odd, then r2(n)=0.

k = 3

Gauss proved that for a squarefree number n>4,

r3(n)={24h(−n),if n≡3(mod8),0if n≡7(mod8),12h(−4n)otherwise, where h(m) denotes the class number of an integer m. There exist extensions of Gauss' formula to arbitrary integer n.

k = 4

The number of ways to represent n as the sum of four squares was due to Carl Gustav Jakob Jacobi and it is eight times the sum of all its divisors which are not divisible by 4, i.e.

r4(n)=8∑d∣n, 4∤dd. Representing n=2km, where m is an odd integer, one can express r4(n) in terms of the divisor function as follows:

r4(n)=8σ(2min⁡{k,1}m).

k = 6 The number of ways to represent n as the sum of six squares is given by

r6(n)=4∑d∣nd2(4(−4n/d)−(−4d)), where (⋅⋅) is the Kronecker symbol.

k = 8 Jacobi also found an explicit formula for the case k=8:

r8(n)=16∑d∣n(−1)n+dd3.

Generating function The generating function of the sequence rk(n) for fixed k can be expressed in terms of the Jacobi theta function:

ϑ(0;q)k=ϑ3k(q)=∑n=0∞rk(n)qn, where

ϑ(0;q)=∑n=−∞∞qn2=1+2q+2q4+2q9+2q16+⋯.

Numerical values The first 30 values for rk(n),k=1,…,8 are listed in the table below:

See also Integer partition Jacobi's four-square theorem Gauss circle problem

References

Further reading Grosswald, Emil (1985). Representations of integers as sums of squares. Springer-Verlag. ISBN 0-387-96126-7.

External links Weisstein, Eric W. "Sum of Squares Function". MathWorld. Sloane, N. J. A. (ed.). "Sequence A122141 (number of ways of writing n as a sum of d squares)". The On-Line Encyclopedia of Integer Sequences. OEIS Foundation. Sloane, N. J. A. (ed.). "Sequence A004018 (Theta series of square lattice, r_2(n))". The On-Line Encyclopedia of Integer Sequences. OEIS Foundation.

Worked examples

Example 1 — a first encounter with Sum of squares function

Start with the simplest possible case. Write down what Sum of squares function claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Sum of squares function before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Sum of squares function ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Sum of squares function

In research
Sum of squares function appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Sum of squares function in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Sum of squares function is common in secondary-school and first-year university syllabi. It links to neighbouring topics Arithmetic functions, Integer factorization algorithms, Squares in number theory, so understanding it makes those chapters shorter.
In everyday life
Look for Sum of squares function outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Sum of squares function” →

How to study Sum of squares function in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Sum of squares function means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Sum of squares function out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Sum of squares function in simple terms?

In number theory, the sum of squares function is an arithmetic function that gives the number of representations for a given positive integer n as the sum of k squares, where representations that differ only in the order of the summands or in the signs of the numbers being squared are counted as di…

Why does Sum of squares function matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Sum of squares function?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Sum of squares function.

Tags

  • Arithmetic functions
  • Integer factorization algorithms
  • Squares in number theory

Keep exploring