ArticleslgStudy

mathematics

Euler's totient function

Euler's totient 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 Euler's totient function rather than just read about it. In short: In number theory, Euler's totient function counts the positive integers up to a given integer n that are relatively prime to n. It is written using the Greek letter phi as φ(n) or ϕ(n), and may also be called Euler's phi function.

Euler's totient function — main illustration
Euler's totient function — illustration

Key takeaways

  • Euler's totient 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 Euler's totient function to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Euler's totient function from memory before moving on to harder problems.

Reference excerpt

In number theory, Euler's totient function counts the positive integers up to a given integer n that are relatively prime to n. It is written using the Greek letter phi as φ(n) or ϕ(n), and may also be called Euler's phi function. In other words, it is the number of integers k in the range 1≤k≤n for which the greatest common divisor gcd⁡(n,k) is equal to 1. The integers k of this form are sometimes referred to as totatives of n. For example, the totatives of n=9 are the six numbers 1, 2, 4, 5, 7 and 8. They are all relatively prime to 9, but the other three numbers in this range, 3, 6, and 9 are not, since gcd⁡(9,3)=gcd⁡(9,6)=3 and gcd⁡(9,9)=9. Therefore, φ(9)=6. As another example, φ(1)=1 since for n=1 the only integer in the range from 1 to n is 1 itself, and gcd⁡(1,1)=1. Euler's totient function is a multiplicative function, meaning that if two numbers m and n are relatively prime, then φ(mn)=φ(m)φ(n). This function gives the order of the multiplicative group of integers modulo n (the group of units of the ring ℤ/nℤ). It is also used for defining the RSA encryption system.

History, terminology, and notation Leonhard Euler introduced the function in 1763. However, he did not at that time choose any specific symbol to denote it. In a 1784 publication, Euler studied the function further, choosing the Greek letter π to denote it: he wrote πD for "the multitude of numbers less than D, and which have no common divisor with it". This definition varies from the current definition for the totient function at D=1 but is otherwise the same. The now-standard notation φ(A) comes from Gauss's 1801 treatise Disquisitiones Arithmeticae, although Gauss did not use parentheses around the argument and wrote φA. Thus, it is often called Euler's phi function or simply the phi function. In 1879, J. J. Sylvester coined the term totient for this function, so it is also referred to as Euler's totient function, the Euler totient, or Euler's totient. Jordan's totient is a generalization of Euler's. The cototient of n is defined as n−φ(n). It counts the number of positive integers less than or equal to n that have at least one prime factor in common with n.

Computing Euler's totient function There are several formulae for computing φ(n).

Euler's product formula It states φ(n)=n∏p∣n(1−1p), where the product is over the distinct prime numbers dividing n. An equivalent formulation is φ(n)=p1k1−1(p1−1)p2k2−1(p2−1)⋯prkr−1(pr−1), where n=p1k1p2k2⋯prkr is the prime factorization of n (that is, p1,p2,…,pr are distinct prime numbers). The proof of these formulae depends on two important facts.

Phi is a multiplicative function This means that if gcd⁡(m,n)=1, then φ(m)φ(n)=φ(mn). Proof outline: Let A,B,C be the sets of positive integers which are coprime to and less than m, n, mn, respectively, so that |A|=φ(m), etc. Then there is a bijection between A×B and C by the Chinese remainder theorem.

Value of phi for a prime power argument If p is prime and k≥1, then φ(pk)=pk−pk−1=pk−1(p−1)=pk(1−1p). Proof: Since p is a prime number, the only possible values of gcd⁡(pk,m) are 1,p,p2,…,pk, and the only way to have gcd⁡(pk,m)>1 is if m is a multiple of p, that is, m∈{p,2p,3p,…,pk−1p=pk}, and there are pk−1 such multiples not greater than pk. Therefore, the other pk−pk−1 numbers are all relatively prime to pk.

Proof of Euler's product formula The fundamental theorem of arithmetic states that if n > 1 there is a unique expression n=p1k1p2k2⋯prkr, where p1 < p2 < ... < pr are prime numbers and each ki ≥ 1. (The case n = 1 corresponds to the empty product.) Repeatedly using the multiplicative property of φ and the formula for φ(pk) gives φ(n)=φ(p1k1)φ(p2k2)⋯φ(prkr)=p1k1(1−1p1)p2k2(1−1p2)⋯prkr(1−1pr)=p1k1p2k2⋯prkr(1−1p1)(1−1p2)⋯(1−1pr)=n(1−1p1)(1−1p2)⋯(1−1pr). This gives both versions of Euler's product formula. An alternative proof that does not require the multiplicative property instead uses the inclusion-exclusion principle applied to the set {1,2,…,n}, excluding the sets of integers divisible by the prime divisors.

Example φ(20)=φ(225)=20(1−12)(1−15)=20⋅12⋅45=8. In words: the distinct prime factors of 20 are 2 and 5; half of the twenty integers from 1 to 20 are divisible by 2, leaving ten; a fifth of those are divisible by 5, leaving eight numbers coprime to 20; these are: 1, 3, 7, 9, 11, 13, 17, 19. The alternative formula uses only integers:φ(20)=φ(2251)=22−1(2−1)51−1(5−1)=2⋅1⋅1⋅4=8.

Fourier transform The totient is the discrete Fourier transform of the gcd, evaluated at 1. Let ℱ{𝐱}[m]=∑k=1nxk⋅e−2πimkn where xk = gcd(k,n) for k ∈ {1, ..., n}. Then φ(n)=ℱ{𝐱}[1]=∑k=1ngcd⁡(k,n)e−2πikn. The real part of this formula is φ(n)=∑k=1ngcd⁡(k,n)cos⁡2πkn. For example, using cos⁡π5=5+14 and cos⁡2π5=5−14:φ(10)=gcd⁡(1,10)cos⁡2π10+gcd⁡(2,10)cos⁡4π10+gcd⁡(3,10)cos⁡6π10+⋯+gcd⁡(10,10)cos⁡20π10=1⋅(5+14)+2⋅(5−14)+1⋅(−5−14)+2⋅(−5+14)+5⋅(−1)+ 2⋅(−5+14)+1⋅(−5−14)+2⋅(5−14)+1⋅(5+14)+10⋅(1)=4.Unlike the Euler product and the divisor sum formula, this one does not require knowing the factors of n. However, it does involve the calculation of the greatest common divisor of n and every positive integer less than n, which suffices to provide the factorization anyway.

… excerpt ends here. Continue reading the full article.

Illustrations

Euler's totient function: The first thousand values of .mw-parser-output .texhtml{font-family:"Nimbus Roman No9 L","Times New Roman",Times,serif;font-size:118%;line-height:1;font-variant-numeric:lining-nums tabular-nums;font-kerning:none}.mw-parser-output .texhtml .texhtml{font-size:100%}.mw-parser-output .texhtml-big{font-size:165%}.mw-parser-output .mvar{font-style:italic}@media(min-width:420px){.mw-parser-output .texhtml{white-space:nowrap}}φ(n). The points on the top line represent φ(p) when p is a prime number, which is p − 1.[1]
The first thousand values of .mw-parser-output .texhtml{font-family:"Nimbus Roman No9 L","Times New Roman",Times,serif;font-size:118%;line-height:1;font-variant-numeric:lining-nums tabular-nums;font-kerning:none}.mw-parser-output .texhtml .texhtml{font-size:100%}.mw-parser-output .texhtml-big{font-size:165%}.mw-parser-output .mvar{font-style:italic}@media(min-width:420px){.mw-parser-output .texhtml{white-space:nowrap}}φ(n). The points on the top line represent φ(p) when p is a prime number, which is p − 1.[1]
Euler's totient function: Graph of the first 100 values
Graph of the first 100 values

Worked examples

Example 1 — a first encounter with Euler's totient function

Start with the simplest possible case. Write down what Euler's totient 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 Euler's totient 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 Euler's totient 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 Euler's totient function

In research
Euler's totient 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 Euler's totient 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
Euler's totient function is common in secondary-school and first-year university syllabi. It links to neighbouring topics Algebra, Leonhard Euler, Modular arithmetic, so understanding it makes those chapters shorter.
In everyday life
Look for Euler's totient 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 “Euler's totient function” →

How to study Euler's totient function in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Euler's totient 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 Euler's totient function out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Euler's totient function in simple terms?

In number theory, Euler's totient function counts the positive integers up to a given integer n that are relatively prime to n. It is written using the Greek letter phi as φ(n) or ϕ(n), and may also be called Euler's phi function.

Why does Euler's totient 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 Euler's totient 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 Euler's totient function.

Tags

  • Algebra
  • Leonhard Euler
  • Modular arithmetic
  • Multiplicative functions
  • Number theory

Keep exploring