### 11.2.11 Cyclotomic polynomial

For a positive integer n, cyclotomic polynomial of index n is the monic polynomial whose roots are exactly the primitive nth roots of unity (an nth root of unity is primitive if the set of its powers is the set of all the nth roots of unity). Note that this will divide xn−1, whose roots are all the nth roots of unity.

The cyclotomic command computes cyclotomic polynomials.

- cyclotomic takes n, an integer.
- cyclotomic(n) returns the list of the coefficients of the cyclotomic polynomial of index n.

#### Examples

Let n=4; the fourth roots of unity are: {1,i,−1,−i} and the primitive roots are: {i,−i}. Hence, the cyclotomic polynomial of index 4 is (x−i)(x+i)=x2+1.

Input for verification:

cyclotomic(4)

| ⎡ ⎣ | 1,0,1 | ⎤ ⎦

Obtain cyclotomic poylnomial of index 5:

cyclotomic(5)

| ⎡ ⎣ | 1,1,1,1,1 | ⎤ ⎦

Hence, the cyclotomic polynomial of index 5 is x4+x3+x2+x+1, which divides x5−1 since (x−1)(x4+x3+x2+x+1)=x5−1.

Obtain the cyclotomic polynomial of index 10:

cyclotomic(10)

| ⎡ ⎣ | 1,−1,1,−1,1 | ⎤ ⎦

Hence, the cyclotomic polynomial of index 10 is x4−x3+x2−x+1 and

(x5−1)(x+1)(x4−x3+x2−x+1)=x10−1.

Obtain the cyclotomic polynomial of index 20:

cyclotomic(20)

| ⎡ ⎣ | 1,0,−1,0,1,0,−1,0,1 | ⎤ ⎦

Hence, the cyclotomic polynomial of index 20 is x8−x6+x4−x2+1 and

(x10−1)(x2+1)(x8−x6+x4−x2+1)=x20−1.