# Math Help - Fermat, Congruences, the CRT, and an exam question

1. ## Fermat, Congruences, the CRT, and an exam question

Had the following problem on an exam, and couldn't crack it:

Show that if p and q are primes, then p^(q-1) + q^(p-1) == 1 (mod pq)

We know through Fermat each p^(q-1) == 1 (mod q) and q^(p-1) == 1(mod p). However I'm not sure how to combine the two.

I thought the CRT might help if we changed the system to p^(q) == p(mod q) and q^(p) == q (mod p).

If you think the problem easy, feel free to leave a hint rather than a solution so I have to work a bit -- I'd appreciate either

2. ## Re: Fermat, Congruences, the CRT, and an exam question

Originally Posted by jsndacruz
Had the following problem on an exam, and couldn't crack it:

Show that if p and q are primes, then p^(q-1) + q^(p-1) == 1 (mod pq)

We know through Fermat each p^(q-1) == 1 (mod q) and q^(p-1) == 1(mod p). However I'm not sure how to combine the two.

I thought the CRT might help if we changed the system to p^(q) == p(mod q) and q^(p) == q (mod p).

If you think the problem easy, feel free to leave a hint rather than a solution so I have to work a bit -- I'd appreciate either

From Fermat's theorem we get:

$p|q^{p-1}-1$ and $q|p^{q-1}-1$

Hence, $pq|(q^{p-1}-1)(p^{q-1}-1)$.

So...

$0\equiv(q^{p-1}-1)(p^{q-1}-1)=...$

Try to continue.

3. ## Re: Fermat, Congruences, the CRT, and an exam question

Originally Posted by jsndacruz
Had the following problem on an exam, and couldn't crack it:

Show that if p and q are primes, then p^(q-1) + q^(p-1) == 1 (mod pq)

We know through Fermat each p^(q-1) == 1 (mod q) and q^(p-1) == 1(mod p). However I'm not sure how to combine the two.

I thought the CRT might help if we changed the system to p^(q) == p(mod q) and q^(p) == q (mod p).

If you think the problem easy, feel free to leave a hint rather than a solution so I have to work a bit -- I'd appreciate either
For the 'Fermat little theorem', if p and q are primes then...

$q|(p^{q-1}-1)$

$p|(q^{p-1}-1)$ (1)

Now is...

$(p^{q-1}-1)\ (q^{p-1}-1) = p^{q-1}\ q^{p-1} - p^{q-1}- q^{p-1}+1$ (2)

... and from (1) and (2) You easily derive that...

$p\ q| (p^{q-1}+ q^{p-1}-1)$ (3)

Kind regards

$\chi$ $\sigma$

4. ## Re: Fermat, Congruences, the CRT, and an exam question

Thanks so much, also sprach Zarathustra (didn't know that was the song's name until my latest google of your name) and ChiSigma. Sorry for not thanking earlier!

5. ## Re: Fermat, Congruences, the CRT, and an exam question

Originally Posted by jsndacruz
Thanks so much, also sprach Zarathustra (didn't know that was the song's name until my latest google of your name) and ChiSigma. Sorry for not thanking earlier!
Now you just left to read Nietzsche...