0% found this document useful (0 votes)
4 views40 pages

Mathematical Fundamentals

The document outlines the importance of mathematical fundamentals, emphasizing their role in problem-solving, decision-making, and computer science. It covers various mathematical concepts such as sets, divisibility, primes, congruences, functions, and group theory, providing definitions and examples for each. Additionally, it discusses key theorems like Wilson's, Fermat's, and the Chinese Remainder Theorem, illustrating their applications in mathematics.

Uploaded by

rdxsingh01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views40 pages

Mathematical Fundamentals

The document outlines the importance of mathematical fundamentals, emphasizing their role in problem-solving, decision-making, and computer science. It covers various mathematical concepts such as sets, divisibility, primes, congruences, functions, and group theory, providing definitions and examples for each. Additionally, it discusses key theorems like Wilson's, Fermat's, and the Chinese Remainder Theorem, illustrating their applications in mathematics.

Uploaded by

rdxsingh01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Unit 2: Mathematical

fundamentals

Om Pal
[email protected]

07/03/2010
© Centre for Development of Advanced Computing, Mumbai.
Why mathematical fundamentals ?

•To develop mathematical thinking which is helpful in every walk of life.

•Mathematics is the art for solving complex real life problems.

•Mathematics direct towards right decision.

•Mathematics is the language of computer science – to be a


good developer/researcher, you need mathematics.

•Mathematics is the backbone of cryptography.- one should


be mathematically proficient whether he/she wants to
design, implement or crack the algorithms.

© Centre for Development of Advanced Computing, Mumbai.


Mathematical Notations

• Set of natural numbers N = {1,2,3,…}


• Set of integer Z = {…-3,-2,-1,0,1,2,3,….}
• Set of rational numbers Q = {a/b : a, b ε Z and b 0 }
Rational numbers have periodic decimal expansions, they
have patterns that repeat infinitum.
1/2 = 0.50000……, 1/3 = 0.333333……..
but √2 = 1.41421356237…… is not a rational number because
it does not have any pattern.
• R (set of real numbers) = Q U Z
• C (set of complex number) = { a+b√-1 : a, b ε R }
• R+ (set of all positive real numbers)

© Centre for Development of Advanced Computing, Mumbai.


Divisibility

If a, b ε Z, b ≠ 0, then to say that b divides a, denoted by b|a, means that


a = bx for a unique x ε Z, denoted by x = a/b.
If b does not divide a, then we write b a.

© Centre for Development of Advanced Computing, Mumbai.


Primes, Primality Testing, and Induction

• prime number: is a natural number bigger than 1, that is not


divisible by any natural number except itself and 1.
• N is prime if it is not divisible by element of set S={2, 3, 4, ….. N-1}.
• If x εS then x N.
• Primality Testing: n is prime if it is not divisible by any element
which is less than √n.
• Induction: Let we want to prove the correctness of following
formula-

Step 1: Check for n=1.


Step 2: Assume formula is true for n-1

Step 3: Prove for n

© Centre for Development of Advanced Computing, Mumbai.


Congruences

• If n ε N, then we say that a is congruent to b modulo n if n|(a−b),


denoted by a ≡ b (mod n) or b = a mod n.
• if n (a − b), then we write

• The set of all integers that are congruent to a given integer m


modulo n, denoted by is called the congruence class or residue
class of m modulo n.

• Example-
(a) Since 3|(82 − 1), 82 ≡ 1 (mod 3).
(b) Since 11|(16 − (−6)), 16 ≡ −6 (mod 11).
(c) Since 7 (10 − 2), 10 2 (mod 7).
(d) For any a, b ε Z, a ≡ b (mod 1), since 1|(a − b).

© Centre for Development of Advanced Computing, Mumbai.


Congruences

• Proposition 1: Let n ε N and a, b, c, d ε Z.


If a ≡ b (mod n) and c ≡ d (mod n),
then a+c ≡ b+d (mod n), a−c ≡ b−d (mod n), and ac ≡ bd (mod n).

• Proposition 2: Let a, b, c ε Z, m, n ε N, and a ≡ b (mod n). Then


each of the following holds.
(a) am ≡ bm (mod mn).
(b) am ≡ bm (mod n).
(c) If m divides n, then a ≡ b (mod m).

• congruence classes: Let x ≡ b (mod n) or b = x mod n


if n = 4 then b = {0, 1, 2, 3} and only four congruence classes for
modulo 4 are possible.

© Centre for Development of Advanced Computing, Mumbai.


Congruences

b = x mod n
If n = 4 and b = 0 then x ε {. . . ,−4, 0, 4, . . .}
If n = 4 and b = 1 then x ε {. . . ,−3, 1, 5, . . .}

Hence four congruence classes for n = 4 are

= {. . . ,−4, 0, 4, . . .},
= {. . . ,−3, 1, 5, . . .},
= {. . . ,−2, 2, 6, . . .},
= {. . . ,−1, 3, 7, . . .},

© Centre for Development of Advanced Computing, Mumbai.


Modular Multiplicative Inverses

• Suppose that a ε Z, and n ε N.


• A multiplicative inverse of the integer a modulo n is an integer x
such that ax ≡ 1 (mod n).
• If x is the least positive such inverse, then we call it the least
multiplicative inverse of the integer a modulo n, denoted by x = a−1.

• Example: 2x ≡ 1 (mod 3), 3y ≡ 1 (mod 5).


• Hence x(Multiplicative inverse of 2) = {2, 5, 8, ….}, y = {2, 7, 12, ….}
• So least multiplicative inverse of 2 is 2, and of 3 is 2 .

© Centre for Development of Advanced Computing, Mumbai.


Euler, Fermat, and Wilson Theorem

• Wilson Theorem-
If p is a prime, then (p−1)! ≡ −1 (mod p).

• Fermat Theorem-
If a ε Z, and p is a prime such that gcd(a, p) = 1, then
ap−1 ≡ 1 (mod p).

• Euler’s φ-Function-
For any n ε N the Euler φ-function, also known as Euler’s Totient,
φ(n) is defined to be the number of m ε N such that m < n and
gcd(m, n) = 1.

• Example- If p is prime, then all j ε N with j < p is relatively prime to p,


so φ(p) = p − 1.

© Centre for Development of Advanced Computing, Mumbai.


Primitive Roots

• Let p be a prime. Then b is a primitive root for p if the powers of b,


1, b, b^2, b^3, ...
include all of the congruence (residue) classes mod p (except 0).

• Examples:
If p=7, then 3 is a primitive root for p because the powers of 3 are 1,
3, 2, 6, 4, 5---that is, every number mod 7 occurs except 0.
There are 6 congruence classes (except 0) and every element of
every class is the power of 3 under mode 7 operation.

But 2 isn't a primitive root of p =7 because the powers of 2 are 1, 2,


4, 1, 2, 4, 1, 2, 4...missing several values.

© Centre for Development of Advanced Computing, Mumbai.


Set Theory

• Set: A set is a well-defined collection of distinct objects.


The objects in the set are called elements.
• Notation a ε S is used to denote the membership of an element a in
a set S, and if a is not in S, then we write a ε S.

• Example- Set of natural numbers


N = {1, 2, 3, 4, . . .} or {x ε N : x >=1}

• Subset: A set T is called a subset of a set S, denoted by T S if


every element of T is in S.
• If T S, but T ≠ S, then we write T S and call T a proper subset
of S.

© Centre for Development of Advanced Computing, Mumbai.


Set Theory

• Complement, Intersection, and Union:


• The union of the two sets consists of all elements that are in S or
in T (possibly both), denoted by S U T,
S U T = {a : a ε S or a ε T}
• The intersection of two sets S and T is the set of all elements
common to both, denoted by S ∩ T,
S ∩ T = {a : a ε S and a ε T}
• If T S, then the complement of T in S, denoted by S - T is the set
of all those elements of S that are not in T,
S - T = {s : s ε S and s ε T}
• Two sets S and T are called disjoint if S ∩ T = ∅.

© Centre for Development of Advanced Computing, Mumbai.


Set Theory

• Set Partition: Let S be a set , and let T = {S1, S2, . . .} be a set of


nonempty subsets of S. Then T is called a partition of S provided
both of the following are satisfied.
(a) Sj ∩ Sk = ∅ for all j ≠ k.
(b) S = S1 U S2 U ··· U Sj · · ·, namely s ε S if and only if s ε Sj for
some j.

• Cartesian product: Let s be element of a set S and t is the element


of set T then
Cartesian product of S with T, denoted by S × T, is given by the set
of ordered pairs: S × T = {(s, t) : s ε S, t ε T}

• Relation: A relation R on S × T is a subset of S × T where (s, t) ε R


is denoted by sRt
© Centre for Development of Advanced Computing, Mumbai.
Functions

• A function f (also called a mapping or map) from a set S to a set T is


a relation on S×T,
denoted by f : S → T, which assigns each s ε S a unique (in relation
uniqueness is not necessary) t ε T, called the image of s under f,
denoted by f(s) = t.

• The set S is called the domain of f


and T is called the range of f.

• Inverse image of T under f, denoted S T


by f−1(T), is the set {s ε S : f(s) ε T}

© Centre for Development of Advanced Computing, Mumbai.


Functions

• Examples : Find out which are the functions.


(a) (b) (c) (d) (e)

• Injective Function (One to One): A function f : S → T is called


injective iff for each s1, s2 ε S, f(s1) = f(s2) implies that s1 = s2.
• Surjective Function (onto): A function f is surjective if f(S) = T,
namely if for each t ε T, t = f(s) for some s ε S.
• Bijective Fuction (One to One Correspondence): A function f is
called bijective (or a bijection) if it is both injective and surjective.

© Centre for Development of Advanced Computing, Mumbai.


Chinese Remainder Theorem

• Let ni ε N for natural numbers i ≤ k ε N be pair wise relatively prime,


set

• and let ri ε Z for i ≤ k. Then the system of k simultaneous linear


congruences given by
x ≡ r1 (mod n1),
x ≡ r2 (mod n2),
.
.
.
x ≡ rk (mod nk),
has a unique solution modulo n.

© Centre for Development of Advanced Computing, Mumbai.


Chinese Remainder Theorem

Example: Let n = n1n2n3 = 105 with n1 = 3, n2 = 5, and n3 = 7.


Also, let r1 = 2, r2 = 2, and r3 = 3.
Then the least multiplicative inverse of N1 = n/n1 = 35 modulo n1 = 3
is M1 = 2.
The least multiplicative inverse of N2 = n/n2 = 21 modulo n2 = 5 is
M2 = 1, and
The least multiplicative inverse of N3 = n/n3 = 15 modulo n3 = 7
is M3 = 1. Hence,

• By reducing x = 227 modulo n = 105, we get x0 = 17, the unique


solution modulo n.
• Hence we can verify that
x0 ≡ r1 (mod n1), x0 ≡ r2 (mod n2) and x0 ≡ r3 (mod n3)

© Centre for Development of Advanced Computing, Mumbai.


Group

• A group G is a set of elements together with a binary operation that


together satisfy the four properties of-
a) Closure
b) Associativity
c) Identity
d) Inverse property

• Example- Set of elements with identity element 0


G = {- - - -3,-2,-1,0,1,2,3,- - - -} Here binary Operation is ‘addition’
1. Identity is 0
2. If a,b ε G then (a+b) ε G
3. a+(b+c)=(a+b)+c
4. a+0=0+a=a
5. For each a there exists an element b in G such that a+b=0=b+a

© Centre for Development of Advanced Computing, Mumbai.


Group

• 1. ( Zn, +n) is a group under addition and 0 identity element


(Zn, +n) = (A+B) mod n, Zn = {0,1,2,3…. N-1}
(Z4,+4)={0,1,2,3}
(0+2) mod 4=2
(1+3) mod 4=0 So inverse of 1 is 3
(2+2) mod 4=0 So inverse of 2 is 2

• 2. Let (Zn, *n) is a group under multiplicative operator and 1 identity element
(Zn, *n) = (A*B) mod n, Zn={1,2,3,…. N-1}
Here (Zn, *n) = {1,2,…. N-1} if n is prime
(Z7,*7) = {1,2,…..6}

• 3. (Z*n, *n) = {i | 1<=i<n-1 and gcd(I,n)=1 }


So Z*6 , ={1,5}
Z*7= {1,2,3,…. 6}

© Centre for Development of Advanced Computing, Mumbai.


Group

• Cyclic group- A group is a cyclic group if there exists generator for the group.

• Z*13 = { 1,2,…12} is a cyclic group with generator g=2

21=2, 2*2 mod 13 =4 or 22=4, 23=8, 24=3, 25=6, 26=12, 27=11, 28=9,
29=5, 210=10, 211= 7, 212=1, 213= 21

Sub Group: Let Z*13 = { 1,2,…12} and g=3 then


31=3, 3*3 mod 13 =9 or 32=9, 33=1, 34=3, 35=9, 36=1
Hence g =3 is not the generator of Z*13 but it is the generator of sub-group {1,3,9}

• Non cyclic group- Z*8 = {1,3,5,8} is a non-cyclic group because none element of
this group is the generator.

• Theorem 1: The number of generators of < Z*n, *n > is φ(n-1). Euler totient function.
For example- Let n=13 then φ(12)=4.

© Centre for Development of Advanced Computing, Mumbai.


Group

• Theorem 2: g is a generator of < Z*n, *n > iff g(n-1)/k ≠ 1 mod n for all
distinct prime factors of n-1.
• Example- Let n=13 then distinct prime factors of n-1 are K={2,3}
• For g=2 :
k=2 we have 2(13-1)/2 ≠ 1 mod 13 because 2(13-1)/2 =26=12 ≠ 1
k=3 we have 2(13-1)/3 ≠ 1 mod 13 because 2(13-1)/3 =24=3 ≠ 1
Hence g=2 is a generator.
• For g=3:
k=3 we have 3(13-1)/3 ≡ 1 mod 13, so theorem fails for g=3 hence 3 is
not a generator.

• (Assignment 1) : Find out a generator (other than 2) and by using


this generator find out all elements of the group (Z*13).

© Centre for Development of Advanced Computing, Mumbai.


Group isomorphism

• Let there are two groups (G, *) and (H, • ).


• A group isomorphism is a bijective function f: G  H such that for
all u and v in G it holds that
• F(u*v) = f(u)•f(v)

• The two groups (G, *) and (H, • ) are isomorphic if an isomorphism


exists. This is written: G ~ H

© Centre for Development of Advanced Computing, Mumbai.


Ring

Some Basics
• Monoid: A monoid is a set, S, together with a binary operation “•”
that satisfies the following axioms:
Closure: If a, b in S, then a · b is also in S.
Associativity: For all a, b and c in S,
the equation (a • b) • c = a • (b • c) holds.
Identity element: There exists an element e in S, such that for all
elements a in S, the equation e • a = a • e = a holds.

• Example- Every group is a monoid.

• Abelian group: A group which satisfy the commutative property is


called abelian group.
• For all a, b in G, a • b = b • a (Here “•” is a binary operator)
• Example- Matrix multiplication.

© Centre for Development of Advanced Computing, Mumbai.


Ring

• A ring (R, +, *) is a set of elements together with two binary


operations (usually called addition and multiplication).

• To qualify as a ring, the set together with its two operations must
satisfy certain conditions (below two conditions).

1. The set must be an abelian group under addition


(a) Closure, if a, b in R, then a + b is also in R
(b) Associativity, if a, b in R then (a + b) + c = a + (b + c) holds
(c) Identity, exists an element 0 in R and if a in R then
0 + a = a + 0 = a holds.
(d) Inverse property, For each a in R, there exists
an element b in R such that a + b = b + a = 0
(e) commutative, For all a, b in R, the equation a + b = b + a holds

© Centre for Development of Advanced Computing, Mumbai.


Ring

2. The set must be monoid under multiplication such that


multiplication distributes over addition –

(a) Closure under multiplication, if a, b ε R then a*b ε R


(b) Associative, (a*b)*c = a*(b*c) holds
(c) Identity, There exists an element 1 in R, such that for
all elements a in R, the equation 1 · a = a · 1 = a holds
(c) Distributive, a*(b+c) = a*b + b*c and (a+b)*c = a*c + b*c

© Centre for Development of Advanced Computing, Mumbai.


Ring

• Example 1: The set of all integers forms a ring.


Z= {….-3,-2,-1,0,1,2,3,……} is a ring.
- There is no multiplicative inverse for above ring because it is not
necessary condition for the ring.
-Multiplicative inverse is optional.

• Example 2: ( Z4, +, * ) is a ring.


Z4 = {0,1,2,3} under mod 4 operation it satisfies all properties of
ring.

© Centre for Development of Advanced Computing, Mumbai.


Field

• Field: A field (F, +, *) is a Ring which satisfies the multiplicative


inverse property.
• Every field is a ring, but not every ring is a field.
• The most important difference is that fields allow for division
(though not division by zero), while a ring need not possess
multiplicative inverse .
• Also, the multiplication operation in a field is required to be
commutative.
• A ring in which division is possible but commutativity is not
assumed is called a division ring or skew field.

• Example: Set of rational numbers (a/b).

© Centre for Development of Advanced Computing, Mumbai.


Field

• Finite Field: (also called Galois fields) are fields with finitely many
elements.
• Number of elements (order) in a field are always prime or power of
prime.
• Minimum possible number of elements in a filed are two.
• GF( p) is called the prime field of order p , and is the field of residue
classes modulo p , where the p elements are denoted 0, 1, ...,p-1.

• Example: (F4, +, *) or F4 is a field with finite elements.


F4 = {0,1,2,3), under mod 4 operation it satisfies properties of field.

© Centre for Development of Advanced Computing, Mumbai.


Introduction to Elliptic Curve

• Let p is a prime number and a, b are integers such that


P > a, b & 4a3+27b2(mod p) ≠ 0 then O
elliptic curve Ep(a,b) is represented as Q (x2, y2)

y2 = x3+ax+b (mod p)
T (x1, y1)
R’
or
y2(mod p) = (x3+ax+b) mod p R is a mirror of R’

All points non negative integer R (x3, y3)


points (x, y) on above EC forms a group.
Identity element is O (at infinity).
If T is a point on EC then T + O = T = O + T
• Addition of Two Points: Let T (x1, y1) and Q (x2, y2) are two points
on EC then R = (x3, y3).

© Centre for Development of Advanced Computing, Mumbai.


Introduction to Elliptic Curve

R=T+Q
If T ≠ Q then slop (λ) = (y2 – y1)/(x2 – x1)
R’
If T = Q then slop (λ) = (3x12 + a)/(2y1)
• Now Point R (x3, y3) R is a mirror of R’

x3 = λ2 - x1 - x2 (mod p) R (x3, y3)

y3 = λ(x1 – x3) – y1 (mod p)


T (x1, y1)

• Calculation of xQ: Let x is a number and Q is a point on EC then


2Q = Q + Q
3Q = Q + 2Q
xQ = Q + Q + Q + ……. X times.

© Centre for Development of Advanced Computing, Mumbai.


Introduction to Elliptic Curve

• Example 1: Find out all points on EC y2 = x3+2x+4 over F13

• Select value of x from 0 to 12 and match with each value of y .


• Pick the value of (x, y) which satisfies the above curve.
X Y point belongs to curve (yes)
0 2 yes
1 - -
- - -

(Fill the above table)

• Example 2: (a) For above curve, if T = (0,2) and Q = (2, 4) then


find out T+Q.
• (Assignment 2) (b) If Q = (9, 6) then find out 3Q.

© Centre for Development of Advanced Computing, Mumbai.


Complexity

• Complexity: The complexity of an algorithm is a function describing


the efficiency of the algorithm in terms of the amount of data the
algorithm must process.

• Time complexity: is a function describing the amount of time an


algorithm takes in terms of the amount of input to the algorithm.
"Time" can mean the number of memory accesses performed, the
number of comparisons between integers.
• Space Complexity : Space Complexity Amount of Computer
memory required during the program execution, as a function of
input size.

• Big O (Asymptotic Notation ) :The most common notation used is


"big O" notation.
• Example: we would say n2 + 3n - 4 = O(n2) . This means, intuitively,
that the important part of n2 + 3n - 4 is the n2 part.

© Centre for Development of Advanced Computing, Mumbai.


Complexity

• Definition: Let f(n) and g(n) be functions, where n is a positive


integer. We write f(n) = O(g(n)) if and only if there exists a real
number c and positive integer n0 satisfying 0 <= f(n) <= cg(n) for all
n >= n0.

• Example: Show that 3n2 + 4n - 2 = O(n2).


We need to find c and n0 such that: 3n2 + 4n - 2 <= cn2 for all
n >= n0 where f(n) = 3n2 + 4n - 2 and g(n) = cn2

- Divide both sides by n2,


-getting: 3 + 4/n - 2/n2 <= c for all n >= n0 .
-If we choose n0 equal to 1, then c >=5 Hence c = 6.
- Now we have: 3n2 + 4n - 2 <= 6n2 for all n >= 1 .
Hence 3n2 + 4n - 2 = O(n2)

© Centre for Development of Advanced Computing, Mumbai.


Complexity

Properties of the Big O Notation:


• Any kth degree polynomial is O(nk).
• ank = O(nk) for any a > 0.
• Big O is transitive. That is, if f(n) = O(g(n)) and g(n) is O(h(n)), then
f(n) = O(h(n)).
• logan = O(logb n) for any a, b > 1.
• if f(n) = O(h(n)) and g(n) is O(h(n)), then f(n) + g(n) = O(h(n)).

© Centre for Development of Advanced Computing, Mumbai.


Complexity
Some Big-O complexity classes in order of magnitude from smallest to highest:
O(1) Constant
O(log(n)) Logarithmic
O(n) Linear
O(n log(n)) n log n
O(nx) {e.g., O(n2), O(n3), etc} Polynomial

O(an) {e.g., O(1.6n), O(2n), etc} Exponential


O(n!) Factorial
O(nn)

© Centre for Development of Advanced Computing, Mumbai.


Complexity

Big-O Notation Examples of Algorithms

O(1) Push, Pop, Enqueue (if there is a tail reference),


Dequeue, Accessing an array element
O(log(n)) Binary search
O(n) Linear search
O(n log(n)) Heap sort, Quick sort (average), Merge sort
O(n2) Selection sort, Insertion sort, Bubble sort

O(n3) Matrix multiplication


O(2n) Towers of Hanoi

© Centre for Development of Advanced Computing, Mumbai.


Complexity

• Example 1: A machine needs a minimum of 100 sec to sort 1000


names by quick sort. What will be minimum time to sort 100 names.
( Average complexity of quick sort is O(nlog(n))
• Example 2 (Assignment 3): A machine took 200 sec to sort 200
names, using bubble sort. How many names could be sorted in 800
sec (approximately).
• Example 3: Find out the complexity order of following recurrence
relation- T(n) = T(n/2) + K, where K is constant.
• Example 4 (Assignment 4): What is the complexity order of
following recurrence relation-
T(n) = c + T(n-1), if n>1
d, if n<=1 where c and d are constants.
• Example 5 (Assignment 5) : Find out complexity order of T(n),
where n is input size and p, q are constants.
T(n) = 8T(n/2) + qn, if n>1
p, if n=1
© Centre for Development of Advanced Computing, Mumbai.
References

1. RICHARD A. MOLLIN “An INTRODUCTION to RYPTOGRAPHY (Book)


Second Edition”

2. http://en.wikipedia.org/wiki/Group_theory

3. http://en.wikipedia.org/wiki/Ring_(mathematics)

4. http://en.wikipedia.org/wiki/Group_(mathematics)

5. http://mathworld.wolfram.com/FiniteGroup.html

6. http://www.tataelxsi.com/whitepapers/ECC_Tut_v1_0.pdf?pdf_id=public_
key_TEL.pdf

7. http://www.pascgalois.org/

© Centre for Development of Advanced Computing, Mumbai.


Thank You

Contact: [email protected]

You might also like