4A1. Abstract Algebra: Rings and fields - JulTob/Mathematics GitHub Wiki

The Secret Code Ring: Introduction to Rings & Fields

Discover how rings and fields work by using a secret code system inspired by algebraic operations.

πŸ•΅οΈ Setup

Imagine you are a spy working for a secret agency. You and your partner communicate using coded messages. The enemy intercepts your transmissions, so you must encrypt messages using a special number system.

One solution is the use of Groups: You can use a Cesar Cypher of N, where you slide all letters N positions. This is, letters form a group with the operation of 'addition' being the Next(letter) (cyclic) operation.

$$\text{Cesar Cypher: N=1 } \begin{Bmatrix} A + N = B \\\ B + N = C \\ ...\\\ Y + N = Z \\\ Z + N = A \end{Bmatrix} = A β†’ B β†’ C β†’ ... β†’ Z β†’ A$$

This is equivalent to a Group operation, with the $(+)$ operation being reversible and cyclic. a ROT1 cipher.

♻️ Algorithm (Ada):
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;

procedure ROT1_Cipher is
    Input_Text, Output_Text : String(1 .. 100);
    Length : Natural;
    begin
        -- Prompt user for input
        Put("Enter a text to encrypt (up to 100 characters): ");
        Get_Line(Input_Text, Length);

        -- Encrypt the input using ROT-1
        for I in 1 .. Length loop
            if Input_Text(I) in 'A' .. 'Y' or Input_Text(I) in 'a' .. 'y' then
                Output_Text(I) := Character'Val(Character'Pos(Input_Text(I)) + 1);
            elsif Input_Text(I) = 'Z' then
                Output_Text(I) := 'A';
            elsif Input_Text(I) = 'z' then
                Output_Text(I) := 'a';
            else
                Output_Text(I) := Input_Text(I);  -- Non-alphabetic characters remain unchanged
              end if;
            end loop;

        -- Display the encrypted text
        Put_Line("Encrypted Text: " & Output_Text(1 .. Length));
    end ROT1_Cipher;

But this is extremely easy to crack for long messages! And common words can give it away, such as 'the'. We should do better!

Let's try using Rings!

Our new encryption works as follows:

  • Every letter is assigned a number (A = 0, B = 1, C = 2, ..., Z = 25).
  • You perform operations modulo 26 (meaning numbers β€œwrap around” after 26).
  • You use two number operations: addition and multiplication.

However, not all numbers behave the same way under multiplication. Some numbers work like "zero" (they erase information), while others allow you to decode messages uniquely.

Can you figure out the best numbers to use for coding? πŸ€”


πŸ“Œ Step 1: Understanding the Number System (The Set)

We are working with numbers modulo 26, meaning we only use:

$$\{0, 1, 2, \dots, 25\}$$

where numbers "wrap around" after 26 (e.g., 27 is the same as 1, 28 is the same as 2, etc.).

βœ… This set forms a ring, denoted $( \mathbb{Z}_{26})$ , because we can add and multiply numbers, and they satisfy certain properties.


πŸ“Œ Step 2: Addition in the Secret Code Ring

Addition in $( \mathbb{Z}_{26} )$ works just like normal addition, but we always reduce mod 26.

For example:

$$5 + 21 = 26 \equiv 0 \pmod{26}$$ $$14 + 13 = 27 \equiv 1 \pmod{26}$$

🧩 Puzzle #1: Can you find a number that "does nothing" when added?

(What number behaves like zero?)

πŸ’‘ Solution $$nΒ·26 \text{ for βˆ€nβˆˆβ„•}$$

πŸ“Œ Step 3: Multiplication in the Secret Code Ring

Multiplication is trickier. It follows normal rules but wraps around 26.

For example:

$$3 \times 9 = 27 \equiv 1 \pmod{26}$$ $$5 \times 6 = 30 \equiv 4 \pmod{26}$$

🧩 Puzzle #2: Can you find a number that always gives 0 when multiplied?

(This number is called a zero divisorβ€”it "erases" information.)

πŸ’‘ Solution $$nΒ·26 \text{ for βˆ€nβˆˆβ„•}$$

πŸ“Œ Step 4: Discovering Field Properties

A field is a ring where every nonzero number has a multiplicative inverse (i.e., for every number $( x )$ , there is some $( y )$ such that $( x \times y = 1 )$ ).

However, in $( \mathbb{Z}_{26})$ , not every number has an inverse!

For example:

  • 3 has an inverse because $( 3 \times 9 = 1 $).
  • 2 has no inverse because there is no number $( x )$ where $( 2 \times x \equiv 1 \mod{26} )$ .

βœ… This means $( \mathbb{Z}_{26} )$ is a ring, but NOT a field.

🧩 Puzzle #3: What numbers DO have an inverse?

(Hint: These numbers must be relatively prime to 26.)

πŸ’‘ Solution

πŸ“Œ What Does It Mean for a Number to Have an Inverse? That $xβ‹…y ≑ 1 (mod26)$

  • A number has an inverse in $β„€_{26}$​ if and only if it is coprime (relatively prime) to 26.

    • This means that the greatest common divisor (gcd) of the number and 26 must be 1
    • Numbers that share a factor with 26 (like 2, 13, etc.) will not have an inverse.
  • The prime factorization of 26 is: $26=2Γ—13$

  • So any number in { $1,2,...,25$ } that does not share a factor of $2$ or $13$ with $26$ will have an inverse.

    • These are { $1,3,5,7,9,11,15,17,19,21,23,25$ }. Each of these numbers has a multiplicative inverse in $β„€_{26}$

πŸ›  Step 5: Applying This to Secret Codes

In cryptography, we need fields, because we want every number to have an inverse so that we can decrypt messages.

Since $(β„€_{26} )$ is not a field, it’s a bad choice for encryption. Instead, we use a prime number, like $( β„€_{5} )$ or $( β„€_{7} )$ , which ARE fields**.

🧩 Final Puzzle:

  • Find a prime number $( p>26 )$ so that $( \mathbb{Z}_p )$ forms a field.

  • What makes a number system a good choice for secret codes?

πŸ’‘ Solution
  • $29$

  • That all numbers have an inverse, this is a number such as $aΒ·b = 1$ with $a,b∈


Great! Now that you've got a feel for rings, the next step in abstract algebra is ideals and quotient rings. These ideas help us understand how to simplify complex algebraic structures while keeping their fundamental properties.

We'll introduce them through a fun puzzle involving divisibility and breaking a number system into smaller pieces! πŸ”’πŸŽ²


🧩 The Factory and the Broken Machines (Ideals & Quotient Rings)

🎯 Goal

Learn about ideals and quotient rings by understanding how a factory deals with faulty machine parts.


πŸ”§ Story Setup

You manage a machine factory that produces metal gears labeled with numbers. Each gear has a serial number from the set:

$$\mathbb{Z} = \{\dots, -3, -2, -1, 0, 1, 2, 3, \dots\}$$

Some gears fail quality control because they are multiples of a faulty number. You need to remove all defective gears and organize the remaining ones.

The challenge:

  • How can we describe the set of all defective gears?
  • What happens when we "ignore" these bad gears and only work with the good ones?
  • Can we still perform arithmetic operations in this new system?

πŸ“Œ Step 1: Identifying the Defective Gears (An Ideal)

One of your machines is faulty and produces all gears labeled with numbers that are multiples of 4:

$$I = \{ \dots, -8, -4, 0, 4, 8, 12, 16, \dots\}$$

This set is special because:

  1. If a gear is defective, adding another defective gear still results in a defective gear: $$4 + 8 = 12 \quad \text{(still in the set)}$$
  2. If we multiply a defective gear by any number, the result is still defective: $$4 \times 3 = 12, \quad 4 \times (-2) = -8$$

These properties define an ideal $( I )$ inside the ring $( \mathbb{Z} )$ .


πŸ“Œ Step 2: Creating a New Number System (Quotient Ring)

Since every multiple of 4 is defective, we want to group numbers together based on how far they are from the defective ones.

To do this, we define new classes of numbers:

  • 0-class: {…, $-8, -4, 0, 4, 8, 12,$ …} (all multiples of 4)
  • 1-class: {…, $-7, -3, 1, 5, 9, 13,$ …}
  • 2-class: {…, $-6, -2, 2, 6, 10, 14,$ …}
  • 3-class: {…, $-5, -1, 3, 7, 11, 15,$ …}

Each number is placed into a group based on its remainder when divided by 4. This new system is written as:

$$\mathbb{Z}/4\mathbb{Z} = \{ [0], [1], [2], [3] \}$$

where:

$$[x] = \{ x + 4k \mid k \in \mathbb{Z} \}$$

βœ… This is called a quotient ring because we are "dividing out" the defective numbers (the ideal $( I = 4\mathbb{Z} )$ ).


πŸ“Œ Step 3: Understanding Arithmetic in the Quotient Ring

Now, let's do math in this new system!

Addition

We add representatives from each class:

$$[2] + [3] = [5] = [1] \quad \text{(since 5 ≑ 1 mod 4)}$$

Multiplication

$$[2] \times [3] = [6] = [2] \quad \text{(since 6 ≑ 2 mod 4)}$$

βœ… Everything still works like a ring, but simpler! πŸŽ‰


πŸ“Œ Step 4: Why This Matters

  1. We created a new number system by ignoring defective elements (an ideal).
  2. We defined a quotient ring $( \mathbb{Z}/4\mathbb{Z} )$ , which keeps a structured arithmetic system.
  3. This method is used in modular arithmetic, cryptography, and abstract algebra.

🎯 Challenge for You!

  1. Find another ideal in ( \mathbb{Z} ), such as all numbers divisible by 5. What would the quotient ring look like?
  2. Can you describe addition and multiplication in ( \mathbb{Z}/5\mathbb{Z} )?
  3. What happens if we take ( \mathbb{Z}/p\mathbb{Z} ) where ( p ) is a prime? (Hint: It becomes a field!)

πŸš€ What’s Next?

Would you like to:

  • Explore fields by extending these ideas to prime numbers?
  • See how quotient rings apply to cryptography and coding theory?
  • Move on to another abstract algebra puzzle, like polynomials over finite fields?

Let me know, and we’ll keep the fun going! 🎲✨

⚠️ **GitHub.com Fallback** ⚠️