ok so we talk about fermats theorem ah eulers
theorem ah before that we talk about fermats
theorem fermats little theorem and then the
phi function and then we move to the eulers
theorem in this lecture so let us just talk
first talk about fermat fermat little theorem
this is a particular case of eulers theorem
but this independently invented by the fermat
in fermat long time back before the eulers
theorem ok so the statement of this theorem
is ah let let p be a prime and a be an integer
such that a is co prime to p that means g
c d of a and p are a and p is one then a to
the power 
p minus one if congruent to one mod p ok so
this is the statement of this ah fermats little
theorem it is telling if you taken n prime
p and if you take a integer a which is ah
co prime to p then a to the power p minus
one is congruent to one mod p ok
so how to prove this so 
ok so proof of this theorem so the p is a
prime so let us consider z p z p is nothing
but zero one to up to p minus one and if you
take the z p star the group cyclic group it
is basically z p minus zero this is also denoted
by r this is called ah a residual system modulo
p class reduce residue system modulo p this
is what this is called the residue set of
the residual system modulo p residual system
mod p and this is called reduce the cyclic
group ah zero is not there reduce residual
system mod p this we denote by r r is basically
z p star but cyclic group ok
so now if you now since p is a prime since
p is the prime then we can show that a r a
r this is basically set of all element a r
such that r is coming from this so a r is
basically this set so ah a two a three a dot
dot dot like this p minus one a so this this
two set are basically same a r and r this
we have to prove our claim is this is our
claim our claim is these two set are basically
same so that means number of elements over
here is same as number of element over there
so this r is basically nothing but one two
up to p minus one ok
so basically if you take any two element from
here if we can show that they are congruent
then ah then these two set are basically same
so how to prove these two set are same so
let us try to prove that 
ok if you take any two element from here say
n a is [vocalized noise] if we assume they
are congruent n a mod p suppose so n a and
m a we are taking from here so our claim is
that no two element from this set are congruent
so these are all distinct element so if these
are all distinct element that should then
that is basically r so to prove that suppose
they are not distinct suppose there are two
element n and m n a and m a where a n and
am are less than p minus one less than or
equal to are same
then what we can say now a is cong[ruent]-
a is co prime to p so a is co prime to p so
that means a inverse exists a inverse not
p exists so we will apply a inverse on both
side this is congruent to sorry a and a inverse
mod p so this incline n is congruent to m
mod p ok so that means all the elements over
here are so a two a three a p minus one a
are basically are congruence to congruence
to the set one two up to p minus one in some
order in some order so that means a r is equal
to r so these two set are same ok
now since these two set are same so we can
multiply the element so so if you multiply
the all the elements in a r so it is basically
a into two a into three a into p minus one
into a so they are basically so these are
the elements in a r so they are basically
same as the element in r so in in a congruent
cells under mod p operation so that means
this set must be congruent to in some order
need not be a is congruent to one so in some
order in some order they are congruent to
this set one two up to p minus one so this
will give us what so this we can take a common
a to the power p minus one into this is basically
one two three up to p minus one so p minus
one factorial is congruent to p minus one
factorial mod p ok so
ok so now ah p is a prime since p is a prime
so p has no factor from this ah one two up
to p so that means p minus one factorial if
we denote by say x so x is independent at
x is co prime to p so from here we can apply
so this is basically a p minus one into x
is congruent to x mod p now since it is co
prime this imply x inverse mod p exists so
we can apply x inverse on both side 
x inverse mod p so this will give us basically
the fermats little theorem congruent to one
more p
ok so this is the proof of the fermat little
theorem so this relationship hold when p is
a prime and a is a co prime to p a is a any
integer which is co prime to p ok so this
is the fermat little theorem so this was invented
long before the eulers theorem we will talk
about eulers theorem which is a generalized
form of this but this was independently invented
by fermats let's say it is called fermat little
theorem ok
so now we define euler phi function 
ok so it is denoted by so euler phi function
let n be an integer we take it is in positive
integer ok then we know this set z n z n is
basically zero one two up to n minus one and
then we know z n star z n star is basically
set of all integer less than n such that positive
integer less than n such that so i such that
they are co prime to n so this is the z where
ah we take this is positive integer so maybe
we can write it properly zero less than r
less than n r is an integer so set of all
integer which are ah relatively prime to n
which are co prime to n so then this set this
set along with this operation can form a group
not for all composite number it will form
a group so for some composite number it will
form a cyclic group now this cardinality of
this set is denoted by phi of n euler phi
function ok so this is called euler phi function
cardinality of this set that means number
of element in this set is denoted by ah euler
phi function it is a number so that means
this is denoted by this is the number of positive
integer integers less than n and which are
which are co prime to n less than n and which
are co prime to n that means those integer
whose g c d is basically g c d of r and n
r one so that number is called euler phi function
ok so euler phi function euler phi function
phi of n is just the number of integer which
is less than n positive integer and which
are co prime to n so that means under z n
under modulo n this n has the inverse ok
now now we want to know the number of element
i mean we want to know phi n in general what
is phi seven what is phi eight what is phi
nine in general so if phi if n is a prime
number ok then we know the phi n so for a
prime number euler phi function is basically
if prime number is p then it is p minus one
so let p be a prime then i p is basically
p minus one ok because if p is a prime then
ah then there is no element we should divides
p so that means z n star is basically so we
will not take zero so that is r is so one
two up to p minus one
because p is prime so z p star p is prime
so that means all the elements are so if this
is r all the elements are relatively prime
with p since p is a prime number otherwise
p cannot be a prime number if if it is as
a factor so since p is a prime this is quite
straight forward then the number of element
in here is p minus one ok say for example
if p is equal to seven if p is equal to seven
then we know seven star is basically one two
three four five six the number of elements
which is basically five seven is basically
six which is basically seven minus one ok
now suppose p is not not a prime suppose n
is not a prime suppose n is equal to say twelve
suppose n is equal to twelve and we want to
ah what is phi twelve we want to know what
is phi twelve so for twelve what is what is
our ah z n z n start z twelve star so z twelve
star is basically set of all integer which
are less than twelve and which are relatively
prime with twelve so this is basically one
five seven eleven so basically phi twelve
while on phi function on al is basically cardinality
of this set which is basically four ok
so we want to have a formula for finding the
cardinality of ah this set that means phi
function in general where n is not to prime
ok so so we want to have a formula for this
phi function when n is not a prime so this
will let ah n is ok so this we will define
so let us take another example suppose n is
equal to twenty one so if n is equal to twenty
one then that z n star z twenty one star which
is basically r reduced residual class reduce
residual class so that means we are taking
all the integer which are ah co prime with
this twenty one so this is basically one two
four five eight ten eleven thirteen sixteen
seventeen nineteen twenty one
ok now if we take ah if we take a number a
which is co prime to n so that means n is
twenty one so if you take a is equal to five
ok then we want to define this a r a r is
basically set of all ah so we multiply a with
r so r is coming from this capital r so this
set if we just for this example it is basically
one into five two into five four into five
five into five eight into five ten into five
eleven into five then thirteen into five sixteen
into five seventeen into five nineteen into
five twenty into five ok now this will basically
give us five ten twenty twenty five forty
fifty fifty five then sorry this is five fifty
five then sixty five then eighty eighty five
ninety five hundred ok now if you perform
the modulo operation mod twenty five a twenty
one n is twenty five twenty one so if you
take mod n on this then it will give us so
if we apply this mod twenty one so it will
give us basically five two four five eight
ten eleven thirteen seventeen nineteen and
twenty so this is basically r set ok
so this theorem we have already proved that
in general if a is co prime to n then a r
is basically r ok this theorem will use we
have used in fermat little theorem and this
we are going to use for the proving the next
result on ah euler phi function ok so this
is my example this is basically we are getting
r back so this is my example that we have
already proved this theorem ok so now let
us talk about the general form of euler phi
function where n is where the number is not
a prime so so this is the theorem so this
theorem is telling let n and m n and m be
two integer two integer such that they are
relatively prime that this g c d of n and
m are one then then phi n into m is basically
phi n into phi m phi n into m is basically
phi n into phi m ok so this is the theorem
we have to prove this theorem
so before proving this theorem let us take
an example suppose say n is equal to say three
and n is equal to say n is equal to say five
sorry five ok so that means or or if you take
n is equal to three and m is equal to four
ok then we want to find phi of phi of three
coma three into four so this is my basically
phi twelve so phi twelve we have seen it is
basically four now what is phi three three
is a prime so phi three is basically three
minus one it is two now what is phi four phi
four is basically cardinality of z four star
so it is basically two so this is basically
two into two this is this is basically phi
three into phi four
ok so again for say phi twenty one how to
find phi twenty one phi twenty one is basically
phi three into phi seven sorry this is we
have to here so this is the basically phi
three into phi seven so if we this seven and
three are relatively phi so if you use this
result then we can say this is basically phi
three into phi seven so this is basically
if this is prime this is two into six twelve
so phi twenty one is basically twelve and
we have seen the phi twenty one the the elements
of phi twenty one ok
so now we need to prove this theorem ah in
general so let us try to prove it ok so 
ok so how to prove this theorem ok so now
ah so first just erase this gets more space
ok so we are looking for finding phi m into
n where m n r ah relatively prime so that
means we are looking for all number of ah
integers which are less than m into n m n
and which are relatively prime with n m into
n so so that means if a is relatively prime
with n into m this implies this is true if
and only if a is relatively prime to both
m and n so both has to be ah so ah ah a is
relatively prime to m into n if and only if
a is relatively prime with m and a it is relatively
prime with n and if this is true this is vice
versa ok
so now we will write these elements one two
we are looking for number of integer over
here which are relatively prime with m into
n that means which are relatively prime with
both n and m so we will write this in a matrix
form this set like this one two three four
dot dot dot in and then n plus one n plus
two n plus three n plus four dot dot dot two
n two n plus one two n plus two n plus three
two n plus four dot dot dot three n like this
so dot dot dot m minus one into n plus one
then m minus one into n plus two m minus one
into m plus three then m minus one into n
plus four dot dot dot m into n so basically
we are writing this set in a matrix form and
the ok so now now we take a j over here so
this is basically this column is basically
if you take the j over here this column is
basically n plus j two n plus j like this
ok
ok so now ah so this is basically telling
us ah now the first row is basically number
of number of integer co prime with n is basically
phi n in the first row and this is same as
in the second row because ah n plus j is congruent
to ah in any row ah because this is r plus
j is congruent to j mod n ok so that means
any row this is basically phi n is the number
of number of integer which are co prime to
n suppose j is the integer suppose j is co
prime to n now these all are will be co prime
to n because if j is co prime to n then that
means g c d of j and m is one so that means
n plus j must be co prime to n two n plus
j must be of co prime to m because there g
c d also one so that so that means all the
elements over here are co prime to n
so whenever there is a number which is co
prime to n then in that column all the elements
in that column so this is a column j column
then all the column all the elements in this
column will be co prime to n and there are
phi n numbers now now we have to see that
ah now we have to see among these how many
are basically co prime to m so that we have
to see so for that 
so let us take this set so this r we take
j this is one column n plus j two n plus j
this is the j th column where all the elements
are co prime to n now we want to see among
these how many are basically co prime to m
so they are exactly n element they are exactly
n element in this set so that means this is
m
ok now if you take any two element from here
they are in this form r n plus j and if suppose
they are congruent under mod n we want to
see under we want to see whether this set
is eventually z m star or not this we want
to see yes this is z m star so that means
there are phi n number of element which are
co prime to n so that we want to see under
mode operation mod m operation so if they
are equal under mod m so that means r n must
be s m under mod m 
now now n and m we have taken relatively prime
so that means n inverse exists under mod m
this exists under mod m so if this exists
we can apply an inverse on this so this will
give us r is congruent to s mod m
so that means they are congruent to s mod
m so that means this a s this is basically
these r is basically a z m star so that means
number of element which are co prime to m
over here is basically phi of m so among these
so there are phi m number of elements which
are co prime to n and among this phi n there
are phi m number of elements which are co
prime to n so total so hence the number of
element which are co prime to both m and n
are basically phi n into phi m and this is
basically phi n m and this is the proof this
is basically phi n m and this is the proof
ok
so just a quick result so this we will use
to calculate the phi function when m is not
a prime and we need another result is this
is also a easy to proof we are not going to
prove this if n is p to the power k where
p is a prime and n is an integer ok then phi
n is basically p to the power k minus p to
the power n minus k so this result can be
easily proved but ah we are not going to prove
it now so this is also used because if we
want to calculate for ah say nine so nine
is basically three square so ah p p is prime
so we will use this result to prove that
thank you
