# Understanding AKS

new user here. Where does a layman go to get a basic understanding of AKS primality testing. I am not talking about the optimal choice of “r” (which I am told is the hardcore number theoretic part of the algorithm). I mean basic things, like what does “mod(n, x^r-1)” mean (how can something be mod two things?) And what does binomial expansion have to do with anything. I can’t find anything in Wikipedia that is appropriate for my level. Thanks.

#### Solutions Collecting From Web of "Understanding AKS"

Informally $\rm\:(mod\ n,\ x^r – 1)\:$ denotes polynomial arithmetic mod assumptions $\rm\:n = 0,\ x^r -1 = 0\:.\:$ Using these assumptions we can reduce an integer coefficient polynomial to normal form form as follows. Reduce all coefficients mod $\rm\:n\$ and then substitute $\rm\:x^r = 1\:,\$ so $\rm\ x^{r+1} =x,\:\ x^{r+2} = x^2,\ \ldots,\:$ Notice that this is equivalent to replacing all of the exponents of $\rm\:x\:$ by their remainders $\rm\:(mod\ r)\:.\$
This yields a polynomial of degree $\rm < r\:$ with coefficients between $0$ and $\rm\:n-1\:.\:$ Two polynomials are congruent $\rm\:(mod\ n,\ x^r-1)\:$ iff they have the same reduced normal forms (or, equivalently, if their difference reduces to $0\:$). This reduction is the same as using the the Division Algorithm to reduce a polynomial by mapping it to its remainder after division by $\rm\: x^r-1\:,\:$ doing coefficient arithmetic $\rm\:mod\ n\:,\:$ i.e. considering the polynomials as being over the ring $\rm\:\mathbb Z/n =\:$ integers $\rm\:(mod\ n)\:.\:$

I will address the two question that are directly stated. If you ask more, I can change this answer.

To mod by two things, in this case a number and a polynomial, is not as bad as it might seem. Modding by the number n is just as before – treat every coefficient separately. So $16x^2 + 10x + 7 \equiv x^2 + 2 \mod 5$. The polynomial modulus is a little stranger. But in the case where it’s $x^k – 1$, this just means that you reduce all exponents greater than $k$ by $k$, effectively dividing polynomials that are “too large” by a smaller polynomial.

Many more sources exist. Here is a great primer. This is a short FAQ aimed at the AKS. And here is a list of other sources or learning about the AKS algorithm.

I’m not sure it’s suitable for the layman, nor indeed whether there is an account of AKS that is suitable for the layman, but the book Primality Testing in Polynomial Time by Dietzfelbinger is very nice.