On the Universal primality test.

Theorem 1.

Let \: A=\begin{pmatrix}
1 &1 \\ 
1 & u
\end{pmatrix}, \: if\: p \:is\: prime\\
A^p \equiv \left\{\begin{matrix}
\begin{pmatrix}
1 &1 \\ 
1 & u
\end{pmatrix} 
\\ \begin{pmatrix}
u &-1 \\ 
-1 & 1
\end{pmatrix} 
\\
\begin{pmatrix}
m &0 \\ 
0 & m
\end{pmatrix} 
\end{matrix}\right.\: (mod \:p), \:u \in\left ( 2, p-1\right )

Proof

For \:matrix \:A=\begin{pmatrix}
1 &1 \\ 
1 & u
\end{pmatrix},\: \left | A\right |=u-1 , \:
\left | A^p\right |=(u-1)^p \\ 
and \: from\: the \:matrix \:multiplication\: rules,\: A^p =\begin{pmatrix}
a & b \\ 
b & c
\end{pmatrix}, \\  b=\frac {c-a}{u-1}, \:so  \:a\cdot c-b^2=(u-1)^p \\ if\: p\:is\: prime,\:from\:the\:Little\:Fermat\:Theorem\\ \: a\cdot c- \left ( \frac {c-a}{u-1} \right )^2  \equiv u-1 \: (mod \: p)\\
easy\:to \:see\: that\: a\equiv 1, c\equiv u \:(mod\: p)\: and\: a\equiv u,c\equiv 1 \: (mod\:p) \\
that \: lead \: us\: to \: first\: two \: condition \: of \:Theorem \:1. 
\\Let \: c\equiv a \: (mod\: p), so\: b\equiv 0 \: (mod\:p) \\ and \: m \: is\: solution \: c^2\equiv u-1 , (a^2 \equiv u-1) \: (mod \:p)

The test. We can easy build the test. For any p, we can random take the value u and check the conditions of the theorem. How many values of u must be check out? Say test for u, u+1, u+2, u+3? There is an exception too, lot of them) So, this is our first step. Before go to complex numbers, we must look to Theorem 2 first)

Theorem 2.

Let \: A=\begin{pmatrix}
1 &1 \\ 
1 & u
\end{pmatrix}^1 \: A^2=\begin{pmatrix}
2 &u+1 \\ 
u+1 & u^2+1
\end{pmatrix}^2\\
 A^3=\begin{pmatrix}
u+2 &u^2+u+2 \\ 
u^2+u+2 & u^3+2u+1
\end{pmatrix}^2\\

A^p =\begin{pmatrix}
 a(u)&b(u) \\ 
b(u) & c(u)
\end{pmatrix};\\
if\: p \:is\: prime\: than \\ \:  b(u) - Irreducible \: polynomial \: and \\
b(u)-b( p-u+2) =p\cdot g(u) \: 

Yep. Symmetry!!! For every prime number, b(u)-(b(p-u+2)==0 mod p. Only prime numbers have this property (factor ahead), and «exception» arise from the flaw in modulo notation (it obviously, g(u)==0 mod p can exist for some composite p without of have multiplier p ahead of g(u)).

Origin of symmetry do not connected with the u value, u and matrix^p (mod p) only reveal this to us. Well, and so? Polynomial b(u) is long, huge, and unpractical for use in the test.

*Do not read bullshit below*

Let \: A=\begin{pmatrix}
1 +i&1 \\ 
1 & 0
\end{pmatrix},
\: if\: p \:is\: prime, \\
A^p=X, 
\\and \: X_{1,1}+X_{2,2} \equiv \pm 1 \: (mod \: p) for \: imaginary\:part\: of\: X, \\
\\and \: X_{1,1}+X_{2,2} \equiv 1) \; (mod \: p) for \: real\:part\: of\: X \\