Module 1 B Modular Arithmetic
Module 1 B Modular Arithmetic
Module 1 B Modular Arithmetic
Nov 2, 2024
Set of Integers (z)
Nov 2, 2024
Modulo Operator
Find the result of the following
operations:
a) 27 mod 5
b) 36 mod 12
c) −18 mod 14
d) −7 mod 10
Nov 2, 2024
Modulo Operator
a) 27 mod 5 27/5 gives remainder
=2
=0
Nov 2, 2024
Congruence (≡ operator)
To show that two integers are congruent,
we use the congruence operator ( ≡ ).
It indicates equality in modulus.
2 mod 10= 2
12 mod 10=2
3 mod 5=3
8 mod 5=3
Nov 2, 2024
Residue Classes
A residue class [a] or [a]n is the set
of integers congruent modulo n.
For example n=5
Z5={0, 1, 2, 3, 4}
Then we have 5 residue classes.
Nov 2, 2024
Comparison of Z and Zn using
graphs
Nov 2, 2024
Operation in Zn
Nov 2, 2024
Operation in Zn
Perform the following operations (the
inputs come from Zn):
1. Add 7 to 14 in Z15.
2. Subtract 11 from 7 in Z13.
3. Multiply 11 by 7 in Z20.
Nov 2, 2024
Zn Operation properties
Nov 2, 2024
Zn Operation properties
Nov 2, 2024
Additive Inverse
In Zn, two numbers a and b are
additive inverses of each other if
Nov 2, 2024
Additive Inverse
Find all additive inverse pairs in
Z10.
Nov 2, 2024
Multiplicative Inverse
In Zn, two numbers a and b are the multiplicative
inverse of each other if
Nov 2, 2024
Euclidean Algorithm to
find GCD
Fact 1: gcd (a, 0) = a
Fact 2: gcd (a, b) = gcd (b, r), where r is
the remainder of dividing a by b
gcd(36,10)=gcd(10,6)=gcd(6,4)=gcd(4,2)=gcd(2,0)
=2
Nov 2, 2024
find GCD
Nov 2, 2024
Extended Euclidean Algorithm
Given two integers a and b, we often need to
find other two integers, s and t, such that
Nov 2, 2024
Extended Euclidean Algorithm
Nov 2, 2024
Extended Euclidean Algorithm
Nov 2, 2024
Extended Euclidean Algorithm
Example 1:
Given a = 161 and b = 28, find gcd (a,
b) and the values of s and t.
Nov 2, 2024
Extended Euclidean Algorithm
Example 2:
Given a = 17 and b = 0, find gcd (a, b) and
the values of s and t.
Nov 2, 2024
Extended Euclidean Algorithm
Example 2:
Given a = 17 and b = 0, find gcd (a, b) and
the values of s and t.
Nov 2, 2024
Multiplicative Inverse using Extended
Euclidean Algorithm
Nov 2, 2024
Multiplicative Inverse using Extended Euclidean Algorithm
Nov 2, 2024
Multiplicative Inverse using Extended Euclidean Algorithm
Find the multiplicative inverse of 11 in Z26.
n=r1=26
B=r2=11
Nov 2, 2024
Multiplicative
Inverse using Extended Euclidean Algorithm
Find the multiplicative inverse of 23 in Z100.
n=r1=100
b=r2=23
Nov 2, 2024
Multiplicative
Find Inverse using
the inverse of Extended
12 in ZEuclidean
26.
Algorithm
Nov 2, 2024
Addition and Multiplication Tables
Addition table for Z10
Nov 2, 2024
Different Sets : Zn and Zn* sets
Nov 2, 2024
Different Sets : Zn and Zn* sets
Find Z6 and Z6* sets
Nov 2, 2024
Different Sets : Zn and Zn* sets
Find Z6 and Z6* sets
0 1 2 3 4 5 0 1 2 3 4 5
0 0 1 2 3 4 5 0 0 0 0 0 0 0
1 1 2 3 4 5 0 1 0 1 2 3 4 5
2 2 3 4 5 0 1 2 0 2 4 0 2 4
3 3 4 5 0 1 2 3 0 3 0 3 0 3
4 4 5 0 1 2 3 4 0 4 2 0 4 2
5 5 0 1 2 3 4 5 0 5 4 3 2 1
Z6 ={0, 1, 2, 3, 4, 5}
Z 6* ={1, 5}
Compiled By Rohini Temkar Nov 2, 2024
Two More Sets
Nov 2, 2024
MATRICES
A matrix of size l m
Nov 2, 2024
Examples of matrices
Nov 2, 2024
Matrix Addition and Subtraction
Nov 2, 2024
Matrix Multiplication
Product of a 2 × 3 matrix by a 3 × 4
matrix.
Nov 2, 2024
Scalar multiplication of Matrix
Nov 2, 2024
Determinant of Matrix
Nov 2, 2024
Determinant of Matrix
Nov 2, 2024
Inverse of Matrix
Matrices have both additive and
multiplicative inverses.
Additive inverse
Additive inverse of matrix A is defined -A .
Additive inverse of matrix A is matrix B,
such that A+B=0
Multiplicative Inverse
Multiplicative inverses are only defined for
square matrices.
Multiplicative of matrix A is matrix B, such
Nov 2, 2024
Residue Matrices
Cryptography uses residue matrices: matrices
where all elements are in Zn.
Operations on matrix are done in modular
arithmetic.
A residue matrix has a multiplicative inverse if
gcd (det(A), n) = 1
Nov 2, 2024
Single-Variable Linear Equations
Nov 2, 2024
Single-Variable Linear Equations
Steps to find Solution:
Reduce equation by dividing both
sides of equation(including modulus)
by ‘d’.
Multiply both sides of equation by
multiplicative inverse of ‘a’ to find
particular solution ‘x0’.
The general solutions are
x = x0 +k (n/d) for k=0, 1, ……, (d-1)
Nov 2, 2024
Single-Variable Linear Equations
Example 1
Solve the equation 10 x ≡ 2(mod 15).
Solution
Nov 2, 2024
Single-Variable Linear Equations
Example 2
Solve the equation 14 x ≡ 12 (mod 18).
Solution: d= gcd(a,n) = gcd(14, 18) = 2
With
Fermat’s
theorem
Nov 2, 2024
Compiled By Rohini Temkar Nov 2, 2024
Nov 2, 2024
Compiled By Rohini Temkar Nov 2, 2024
Compiled By Rohini Temkar Nov 2, 2024
Compiled By Rohini Temkar Nov 2, 2024
Compiled By Rohini Temkar Nov 2, 2024
Compiled By Rohini Temkar Nov 2, 2024
Compiled By Rohini Temkar Nov 2, 2024