Ask your own question, for FREE!
Mathematics 16 Online
OpenStudy (dls):

I am given 3 values lets say A, B and P,and I have to find the number of roots of the equation x^3 = 1 mod P in the interval [A,B], endpoints inclusive.

OpenStudy (dls):

Like for 1 100 2 answer would be 50..... 1 100 31 answer would be 11...etc.. can anyone explain how to do this mathematically?

OpenStudy (dls):

@ganeshie8 @hartnn

OpenStudy (primeralph):

1 mod P will always return 1*sign(P), so I don't see how that's any helpful.

OpenStudy (dls):

so how do we get 50 in first case?

Miracrown (miracrown):

Is P guaranteed to be prime? using the letter P is suggestive

OpenStudy (dls):

nope its not

Miracrown (miracrown):

http://prntscr.com/4v2451

Miracrown (miracrown):

(p) means mod p

Miracrown (miracrown):

Let's worry about the quadratic equation later focus on x - 1 = 0 (p) first

Miracrown (miracrown):

http://prntscr.com/4v24ft

Miracrown (miracrown):

Just quadratics are harder to handle with modular arithmetic. I'm trying to avoid setting this equal to n * p and trying to solve for x Thinking... hmm

Miracrown (miracrown):

Also trying to avoid the chinese remainder theorem. Just thinking... this is a bit tough :o

Miracrown (miracrown):

http://prntscr.com/4v270e

Miracrown (miracrown):

http://prntscr.com/4v2741 now, checking when the modulos are equal

Miracrown (miracrown):

http://prntscr.com/4v277y

OpenStudy (dls):

where is the poor 50?

Miracrown (miracrown):

just thinking if there's an easy way to handle this then similar algebra as before

Miracrown (miracrown):

nah don't see it so...

Miracrown (miracrown):

oh lol... we'll get there

OpenStudy (dls):

lets do something simple.....xD

Miracrown (miracrown):

http://prntscr.com/4v27lw

Miracrown (miracrown):

just putting it all together

Miracrown (miracrown):

http://prntscr.com/4v28wx

Miracrown (miracrown):

Ug, now I'm getting confused on what floor and ceiling are moment greatest integer less than or equal to 99/2 is 49 yes, least integer greater than or equal to 10101/2 is 5051 okee...

OpenStudy (dls):

yep....

Miracrown (miracrown):

http://prntscr.com/4v294s

Miracrown (miracrown):

why did we get an over estimate Let me see...

Miracrown (miracrown):

http://prntscr.com/4v2d1e

Miracrown (miracrown):

So what have found here above here, actually. ^ I've solved for when x^2+x+1 is congruent to zero mod p. So this means x^2+x+1 is a multiple of p. Using the quadratic formula, we are able to pin point x values that work. But this clearly will give non-integer solutions. But we only consider intege r x values. So when we get this number range for n 1 <= n <= 5050. n can only take on certain values here in this range, so we're way over counting because only for certain n will x be integer In the linear case when we are solving x - 1 congruent to zero mod p, we don't have this problem because for any integer n, x is automatically an integer too so we can count simply there So the question shifts to how do we count the number of integer solutions in the quadratic case or will the quadratic residue actually yield any unique solutions not already accounted for by the linear residue x-1 congruent to 0 mod p I believe the answer is no, but to see why hmm

OpenStudy (dls):

ohhh i see

OpenStudy (dls):

tag someone who knows this topic :(

Miracrown (miracrown):

Hmm... just trying to see if (x-1) is a factor of x^2+x+1 mod 2

Miracrown (miracrown):

use euclidean algorithm

Miracrown (miracrown):

its not :( http://prntscr.com/4v2ezx

Miracrown (miracrown):

Sorry rusty with euclidean algorithm. So we can't escape the situation by claiming that all the roots of x-1 are also roots of x^2+x+1 this way

Miracrown (miracrown):

Okay so then what happens when we solution x -1 congruent to x^2+x+1 Thinking.. need to discount non-integer solutions or do we just need to modulo by 100

Miracrown (miracrown):

---> http://prntscr.com/4v2lps In all the test cases I tried so far this formula actually works But I can't come up with the reason at the moment to ignore the quadratic residue part yet, I'll think about it :)

OpenStudy (dls):

alright!

ganeshie8 (ganeshie8):

still looking for a solution ?

Miracrown (miracrown):

Yes man. :)

ganeshie8 (ganeshie8):

\(\large x^3 \equiv 1\pmod P\) \(\large (x-1)(x^2+x+1) \equiv 0 \pmod P\) \(\large (x-1)(y^2+3) \equiv 0 \pmod P\) we define : \(\large y = 2x+1\) Clearly \(\large x\equiv 1 \pmod P\) is a solution lets see how many solutions the other factor \(\large y^2+3\equiv 0\pmod P\) gives

ganeshie8 (ganeshie8):

say \(\large P = p_1^{e_1}p_2^{e_2}\ldots p_r^{e_r}\) we can show that the congruence \(\large x^2\equiv a\pmod{ p_i^{e_i}}\) has a solution if and only if the congruence \(\large x^2 \equiv a \pmod {p_i} \) has a solution. So the problem reduces to finding number of solutions in `distinct primes` : \(p_1, p_2, \ldots , p_r\) \[\large y^2+3\equiv 0 \pmod{p_i} \]

ganeshie8 (ganeshie8):

we are almost done - assuming \(p_i\)'s are odd and appealing to Euler's criteriosn, above congruence will have exactly TWO solutions only when \(\large (-3)^{(p_i-1)/2}\equiv 1 \pmod{p_i}\)

ganeshie8 (ganeshie8):

http://en.wikipedia.org/wiki/Euler's_criterion

ganeshie8 (ganeshie8):

Example : \(\large x^3 = 1\pmod{31}\) \(\large\color{red}{ x\equiv 1 \pmod {31}}\) is one solution, For other solutions, we need to solve : \(\large y^2 +3\equiv 0\pmod{31}\) since \(\large (-3)^{(31-1)/2}\equiv (-3)^{15} \equiv 1 \pmod{31} \), this will have exactly two solutions : \(\large 11, 20\) solving \(\large 2x+1\equiv 11 \pmod {31}\) and \(\large 2x+1 = 20 \pmod {31}\) you get : \(\large \color{red}{x\equiv 5 \pmod{31}} \) and \(\large \color{red}{x\equiv 25 \pmod{31}} \) as other solutions

ganeshie8 (ganeshie8):

you can count the number of solutions : 1 <= 31k+1 <= 100 1 <= 31k+5 <= 100 1 <= 31k+25 <= 100 you will get 4+4+3 = 11 solutions in interval [1, 100]

ganeshie8 (ganeshie8):

lets do one more example ?

OpenStudy (dls):

how about no :P

OpenStudy (dls):

i didnt know this was so hard ;\

ganeshie8 (ganeshie8):

its not hard if you just want to know the `number of solutions` in mod P

ganeshie8 (ganeshie8):

it is hard if you want to know number of solutions in a given range because you need to know the actual solutions to find that count

ganeshie8 (ganeshie8):

btw, all these are standard methods.. nothing new.. google solving quadratic congruences or quadratic reciprocity law..

OpenStudy (dls):

alright ill read a bit about this :o

OpenStudy (ikram002p):

..

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!