# A gentle introduction to concepts of Abstract Algebra

Abstract Algebra?

## Hi! I'm Hanneli (@hannelita)

• Computer Engineer
• Programming
• Electronics
• Math <3 <3
• Physics
• Lego
• Meetups
• Animals
• Coffee
• Pokémon
• GIFs

## Disclaimer

• Tons of theory
• We'll see how to apply abstract algebra these concepts to programming
• We won't cover 100% of the subject
• We will try to keep it simple, without much formalism from Mathematics [sorry!]
• GIFs will help us

# Groups

1. A set with an operation (any operation). Let's assume +.

2. This operation (+) is associative

3. For every element of this set (let's say a), there's a special element such that

a + specialElement = a
$a + specialElement = a$

(this special element is called identity element)

4. For element a in the set, there will be an inverse of a, denoted by

a^{-1}
$a^{-1}$

# Groups

Formal notation: <G, +>

"Groups are abundant in nature" (PINTER, Charles).

Ex: the set of integers with respect to addition

Formal notation: <ℤ, +>

Ex: the set of integers with respect to multiplication

Formal notation: <ℤ, *>

## Groups

The set of integers with respect to multiplication

Commutative property for the multiplication

a*b = b*a
$a*b = b*a$

It does not always happen!

If it does, we call the group a commutative group or abelian group

## Groups

If it does, we call the group a commutative group or abelian group

## Groups

If it does, we call the group a commutative group or abelian group

## [Sub]Groups

If there is a subset S of a group G such that:

- The product of every element of S is in S (closed with respect to multiplication)

- S is closed with respect to inverses

Or

- S is closed with respect to addition

- S is closed with respect to negatives

S is a subgroup of G

S is itself a Group!

# What can we classify as groups?

## Interesting Groups

Imagine a group of... Functions

Group of all functions ℝ -> ℝ

Group of all continuous functions ℝ -> ℝ

A

B

a

b

c

x

y

z

## Functions

A

B

a

b

c

x

y

z

f =

a  b  c

x  y  z

(

)

Bijective Function

f: A -> B

Domain

Image

## Functions

Bijective Function

No remaining elements in the image

Only one arrow from one element in A to one in element in B

One-to-One function

Bijective functions have inverses

Important if we want to represent them as groups!

## Functions

Bijective Function

No remaining elements in the image

Only one arrow from one element in A to one in element in B

One-to-One function

Bijective functions have inverses

Important if we want to represent them as groups!

## Interesting Groups

Imagine a group of... a bijective function f: A->A

It rearranges the elements of A

Permutations of A

Examples: Set of the symmetries of a Square is a permutation group

## Interesting Groups

Imagine a group of... a bijective function f: A->A

It rearranges the elements of A

Permutations of A

Examples: Set of the symmetries of a Square is a permutation group

a

b

d

c

a  b  c  d

## Interesting Groups

Imagine a group of... a bijective function f: A->A

It rearranges the elements of A

Permutations of A

Examples: Set of the symmetries of a Square is a permutation group

a

b

d

c

a  b  c  d

## Interesting Groups

Imagine a group of... a bijective function f: A->A

It rearranges the elements of A

Permutations of A

Examples: Set of the symmetries of a Square is a permutation group

d

a

c

b

a  b  c  d

d  a  b  c

## Interesting Groups

Imagine a group of... a bijective function f: A->A

It rearranges the elements of A

Permutations of A

Examples: Set of the symmetries of a Square is a permutation group

a

b

d

c

a  b  c  d

a  d  c  b

## Interesting Groups

Permutations are interesting

## Interesting Groups

Permutations are interesting

f =

1  2  3  4  5  6  7  8  9

3  1  6  9  8  2  4  5  7

(

)

## Interesting Groups

Permutations are interesting

f =

1  2  3  4  5  6  7  8  9

3  1  6  9  8  2  4  5  7

(

)

f =

1

3

6

2

## Interesting Groups

Permutations are interesting

f =

1  2  3  4  5  6  7  8  9

3  1  6  9  8  2  4  5  7

(

)

f =

1

3

6

2

9

7

4

## Interesting Groups

Permutations are interesting

f =

1  2  3  4  5  6  7  8  9

3  1  6  9  8  2  4  5  7

(

)

f =

1

3

6

2

9

7

4

8

5

## Interesting Groups

Permutations are interesting

f =

1  2  3  4  5  6  7  8  9

3  1  6  9  8  2  4  5  7

(

)

f =

1

3

6

2

9

7

4

8

5

Cycles

## GIF TIME

### One important skill in programming is the ability to recognise the same structure in different scenarios

Two groups can be isomorphic!

There is a one-to-one correspondence which transforms one into another.

### Another important skill is classifying

A1

A2

A3

A1, A2 and A3 are classes of a Partition of A

Two classes must be disjoint

The Union of these classes is the set A

If two classes are not disjoint, they are equal

### Another important skill is classifying

A1

A2

A3

A1 ~ Ax

Ax

Ay

Az

A2 ~ Ay

A3 ~ Az

Equivalence Relation

We can have different partitions of the same set

# Let's go back to groups

### Even numbers are a subgroup of ℤ

- S is closed with respect to addition

- S is closed with respect to negatives

### What about the odd numbers?

Zero is not part of the odd numbers 😱

The odd numbers are the even numbers shifted by one

odd = 2ℤ + 1

This is what we call...

## Cosets

We have a group G and a subgroup H. For any element a in G,

aH denotes the set of all the products a*h; a remains fixed and h ranged all over H

For the previous example, we have H = <2ℤ,+>

Question: is aH == Ha ?

(Can we measure 'how commutative' a group is?)

hint:

x*a*x^{-1}
$x*a*x^{-1}$

(conjugate of a)

### What happens if there's a function f that transforms one group (H) into another (G), but f is not a one-to-one correspondence?

f is a Homomorphism from H to G

Example:

### What happens if there's a function f that transforms one group (H) into another (G), but f is not a one-to-one correspondence?

f is a Homomorphism from H to G

Example:

+ e o
e e o
o o e

Parity group P

P is a homomorphic image of ℤ

P keeps one aspect of ℤ (odd of even)

### Is there a way to construct all the homomorphic images of a group G?

Yes!

There's a particular type of subgroup, that

is closed with respect to products, inverses and conjugates

We call it normal subgroup of G (let's call it H)

The set that consists of all the cosets of H (let's call it G/H) is a homomorphic image of G.

# GIF time!

We've been talking about groups for a while. It's time for a new character:

## Rings

Similar to a group, but with two operations

## Rings

Usually, the two operations are addition and multiplication

Every ring is a group

Properties of rings:

- a ring A with addition alone is an abelian group

- multiplication is associative

- multiplication is distributive over addition

## Rings

Definition: Given the rings A and B, B absorbs products in A if we multiply an element i B by an element in A and the result is in B.

When a ring B is part of a larger ring A, B is a subring of A if B is closed with respect to addition, multiplication and negatives.

## Rings

When multiplication is also commutative, we call it

A commutative ring

A ring does not necessarily have an identity element for multiplication

If there's one, we call it unity of A

And this is what we need to know to meet the next character:

## Fields

(I'm sure we will survive to the formal definition)

A commutative ring,

with unity,

in which every nonzero element is invertible

Q, ℝ, C are examples of fields

## Fields

Definition: A nonzero element is called divisor of zero if there's an element b in the ring such that the product a*b or b*a is equal to zero

Is ℤ a field?

a*a^{-1}=1
$a*a^{-1}=1$

Not really.

Property: A nonzero element a has an inverse such that

## Fields

Definition: When there are no divisors of zero,

This is what we call cancellation property

a*b = a*c
$a*b = a*c$

So please give a warm welcome to...

b=c
$b=c$

=>

## Fields

Integral domain

Commutative ring,

with unity,

having the cancellation property

And now, finally, the missing character:

## Ideals

A nonempty subset B of a ring A

and B absorbs products in A

B is closed with respect to addition and negatives

Ideals are like normal subgroups for rings

## Ideals

Normal subgroup: is closed with respect to products, inverses and conjugates

## Ideals

Do you remember why we defined the normal subgroups?

## Ideals

Because of the quotients. And guess what, if we had group quotients, then we have:

Quotient rings!

## Ideals

Ideals play an important role in abstract algebra; we can understand many properties of groups and fields just by analysing the ideals.

## Mind-blowing questions

Abstraction is an important skill for programming

We saw many concepts in this talk

Who came up with these concepts?

1880 - 1930: E. Steinitz, David Hilbert, R. Dedekind, E. Artin, L. Kronecker, E. Kummer,

Emmy Noether

## Emmy Noether (1882 - 1935)

Erlangen, Germany - 1907 she completes her studies in Mathematics

In 1915, D. Hilbert and F. Klein invite Noether to Göttingen

She did many works using Hilbert's name - women were not allowed to teach in some areas

She obtained a permission to teach in 1919 and stayed in Göttingen until 1933

"Ideal Theory in Rings" came in 1921

# Why is it relevant?

## Abstract algebra and Generic Programming

We can identify pieces of our code as elements of abstract algebra

Very simple example:

class BankAccount

withdraw and deposit

Are withdraw and deposit commutative?

balance = 500.00; withdraws 600.00; deposits 1000.00;

## Abstract algebra and Generic Programming

We can identify pieces of our code as elements of abstract algebra

Very simple example:

class BankAccount

withdraw and deposit

Are withdraw and deposit commutative?

balance = 500.00; withdraws 600.00; deposits 1000.00;

The balance will be negative for a moment

## Abstract algebra and Generic Programming

We can identify pieces of our code as elements of abstract algebra

Very simple example:

class BankAccount

withdraw and deposit

Are withdraw and deposit commutative?

balance = 500.00; deposits 1000.00; withdraws 600.00;

## Abstract algebra and Generic Programming

We can also do a better refactor if we apply the concepts of abstract algebra

Imagine that you have similar functions, accepting different parameters but performing similar operations

Maybe we can generalize the function

(we can interpret this as a group or ring)

The properties of ideals are a good example of elements of abstract algebra that help us with abstractions in programming

## Abstract algebra and Generic Programming

"From Mathematics to Generic Programming"; A. STEPANOV and D. ROSE

Free slides of the classes

### Other applications of Abstract Algebra

Computational Complexity, Cryptography,  Graph Theory, Computational Group Theory

# Final considerations

I hope this presentation helped you to understand some concepts of Abstract Algebra

I hope you have enjoyed the GIFs!

There's a connection between this area and programming - and we have much work to do

# References

Charles Pinter; "A book of Abstract Algebra"

A. Stepanov and D. Rose; "From Mathematics to Generic Programming"

Lectures from KTH institute