Finite Fields And Modular Arithmetic
So far, we described elliptic curves over real numbers. That was useful because real-number curves can be drawn as smooth curves on a normal x-y plane. This makes the geometric ideas easier to understand:
- points on the curve
- lines through points
- tangent lines
- reflection across the x-axis
- point addition
- point doubling
However, real-number curves are not what cryptographic systems directly use. There are several reasons.
First, real numbers are continuous. Between any two real numbers, there are infinitely many other real numbers. For example, between:
we have:
and infinitely many more. Cryptography needs exact arithmetic over a finite set of values.
Second, computers do not represent arbitrary real numbers exactly. Decimal and fractional values often require approximations. But cryptography cannot rely on approximate arithmetic. A tiny rounding difference could make two systems compute different results. That is unacceptable for cryptographic protocols, especially in distributed systems where many machines must independently compute the same result.
So instead of using real numbers, cryptographic elliptic curves are usually defined over finite fields.
A finite field gives us:
- a limited set of values
- exact arithmetic
- deterministic results
- efficient computation
- a discrete structure suitable for cryptography
Important
Real-number curves are useful for intuition.
Finite-field curves are used in real cryptography.
1. Modular Arithmetic
The most common finite fields used in ECC are based on arithmetic modulo a prime number p. Instead of allowing all possible numbers, we restrict ourselves to the finite set:
For example, if:
then the allowed values are:
After reaching 10, arithmetic wraps around.
For example:
because:
Similarly:
because:
This is called modular arithmetic.
The three-line symbol ≡ is the congruence sign, read “is congruent to.”
So 20 ≡ 9 (mod 11) says that 20 and 9 have the same remainder when divided by 11.
A useful mental model is a clock.
On a 12-hour clock:
because after 12, the values wrap around again. We actually use this everyday. Instead of saying its 15h in the 24h format, we say its 3pm. We are basically performing modular arithmetic every day without even realising!
With modulo p, values always stay inside:
So if a calculation produces a value outside that range, we reduce it modulo p.
For example:
because:
The remainder is 2.
So, modulo arithmetic keeps all values inside a fixed finite set.
2. Addition, Subtraction, Multiplication Modulo
In a finite field modulo p, normal arithmetic is replaced by modular arithmetic.
That means we perform the operation normally, and then reduce the result modulo p.
For example, with:
addition works like this:
but:
So:
Subtraction works the same way.
For example:
But we want a result between 0 and 10.
Since:
we get:
Multiplication also wraps around.
For example:
and:
So:
Important
After every operation, reduce the result modulo p.
This keeps all values inside the finite field.
So when ECC works over a finite field, the curve equation is no longer interpreted as:
over real numbers.
Instead, it becomes:
That means the left side and right side only need to be equal after reducing modulo p.
3. Division as a Modular Inverse
Division modulo p is the part that usually feels least intuitive.
In normal arithmetic, division asks:
But in modular arithmetic, we do not divide directly.
Instead, division is done using a modular inverse.
The modular inverse of b modulo p is a value such that:
Then division by b is defined as multiplication by :
For example, let:
What is the inverse of 3 modulo 11?
We need a number x such that:
Try:
because:
and:
So:
That means:
So:
and:
So:
Modular inverses let ECC perform its point arithmetic exactly inside a finite field.
Now we can reinterpret the elliptic curve equation inside this finite field:
This creates an elliptic curve over a finite field. Unlike the real-number version, this curve does not look like a smooth continuous line.
Instead, it looks like a set of scattered points. In the next article, we use this same field, , to construct every point of the curve .
4. Why the Modulus Is Prime
ECC commonly uses a prime field, written , where is prime. Primality is what makes every non-zero field element invertible.
For example, modulo , every value from through has a multiplicative inverse. In particular:
so is the inverse of .
This is not true for a composite modulus. Modulo , for example, no value multiplied by gives , because every product with is divisible by . So has no inverse modulo .
Without inverses, the divisions required by elliptic-curve point addition would not always be defined. That is why the integers modulo a prime form the field , while integers modulo a composite number generally do not.