Ask Your Question
0

Solving a system of equations over finite fields with integer coefficients

asked 2023-10-25 14:40:52 +0100

Borjiyan gravatar image

I want to solve a system of equations in $GF(2^4)$, with irreducible polynomial being $x^4 + x + 1$. The field is defined as follows:

K.<x>= GF(2^4, modulus=x^4+x+1)

Now suppose our equations are in the form $2u + 5v = 3$. Can I use this equation directly or should I substitute the polynomial equivalent of the numbers? That is, replace $2$ with $x$ and $5$ with $x^2 + 1$ and $3$ with $x + 1$ which gives us:

u*x + v*x^2 + v = x + 1

If so, this is a huge overhead for me. Is there an alternative way?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2023-10-25 18:14:10 +0100

Max Alekseyev gravatar image

updated 2023-10-26 14:14:17 +0100

It looks like under "polynomial equivalent" of a number $n$ you understand the element of K with coefficients being the binary digits of $n$. If so, here is a simple conversion functions forth and back :

K.<x>= GF(2^4, modulus=x^4+x+1)
to_K = lambda n: K(ZZ(n).digits(2))
to_Z = lambda f: f.polynomial().change_ring(ZZ)(2)

Here to_K(5) gives x^2+1, to_K(3) gives x+1, and so on.

For a matrix / vector with numerical coefficients, you can easily convert them all to K at once as in the following example:

M = Matrix( [[2,5],[3,6]] )
b = vector( [3,4] )

M_ = M.apply_map(to_K)     # matrix with elements from K
b_ = b.apply_map(to_K)     # vector with elements from K

Then you can solve the system over K and convert elements of the solution back to integers as in

(M_ \ b_).apply_map(to_Z)
edit flag offensive delete link more

Comments

Yes, I meant the decimal equivalent of the binary representation of field elements. It was my mistake, I should have made it clear. Thank you for your attention to this matter. I’m really grateful for making the problem easier for me.

Borjiyan gravatar imageBorjiyan ( 2023-10-27 11:35:55 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2023-10-25 14:40:52 +0100

Seen: 194 times

Last updated: Oct 26 '23