Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

CS201: Assignment 4

Shrey Bansal
Roll No. 210997

Question 1: Write a pseudocode to find an irreducible polynomial f (x), of degree d,


over the prime field Fp . The input is d, p.

Solution :
We can use an algorithm which picks a random polynomial f (x) of degree d and checks
if it is irreducible or not.

Algorithm 1 Find irreducible polynomial of degree d over prime field, Fp


Require: Prime p and d > 0
Ensure: f (x) is irreducible polynomial of degree d

1. Pick a monic polynomial f of degree d over Fp , uniformly at random.

2. Test if f is irreducible.

3. If not, go to step 1.

Algorithm 2 Check if f (x) is irreducible or not


Require: d, p and monic polynomial f (x) of degree d
Ensure: f (x) is irreducible polynomial of degree d
for t | d and t ̸= d do
h ← xp − x mod f
t

g ← gcd(h, f )
if g ̸= 1 then
return false
STOP
end if
end for
g ← xp − x mod f
d

if g = 0 then
return true
else
return false
end if

What is the size of your input and output? Is your algorithm fast, or practical?

Solution:

1
CS201 Assignment 4

• In this randomized algorithm, the input is prime p and d ∈ N>0 which takes up
O(1) space.

• The function to check whether f (x) is irreducible or not takes f (x), a monic
polynomial of degree d, prime p and d as its input, which takes up O(d) space.

Working :

• In the algorithm, we pick a random monic polynomial f (x) of degree d and


check if it is irreducible or not.

• This algorithm is valid since we know that ∀ prime p and d ∈ N>0 , a degree d
irreducible polynomial will exist and it has a good density of d1 in the field Fpd .

• To check whether f (x) is irreducible or not, we check whether d is the least


power k of p such that f (x) divides xp − x.
k

• Firstly, we know that all irreducibles of degree t such that t | d are a factor of
xp − x, so for f (x) to be irreducible, it must be co-prime to all such xp − x
d t

where t | d. This condition is checked in the for-loop in the algorithm.

• Second, f (x) must divide xp − x as all irreducibles of degree d are a factor of


d

xp − x, this condition is checked separately after the completion of the loop.


d

Time Complexity Analysis :

• To compute xp mod f , we use repeated squaring. This requires d2 (d+ logp)


t

operations. Using fast arithmetic gives complexity O(n log n) for multiplication
and division.

• The loop runs for O( d) opertaions, which is the order of number of divisors
of d.
⇒ The loop runs for about d2.5 (d+ log p) operations.

• Now, we know that the density of irreducbiles is of the order d1 in Fpd .


∴ The average time complexity of the algorithm is d3.5 (d+ log p).

Question 2: Write a pseudocode to find a primitive element in a given finite field.


Assume that, for prime p, the input is Fpd := Fp [x]/f , for an irreducible polynomial f (x)
of degree d.

Solution:

What is the size of your input and output? Is your algorithm fast, or practical?

Solution:

You might also like