Download ICS 251 – Foundation of Computer Science – Fall 2002

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Brouwer–Hilbert controversy wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Theorem wikipedia , lookup

Mathematical proof wikipedia , lookup

Fermat's Last Theorem wikipedia , lookup

Wiles's proof of Fermat's Last Theorem wikipedia , lookup

Collatz conjecture wikipedia , lookup

List of prime numbers wikipedia , lookup

Quadratic reciprocity wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
ICS 251 – Foundation of Computer Science – Fall 2002
Practice Problems
1. Compute the following by utilizing Fermat's Little Theorem.
a. 320 mod 19.
Fermat’s Theorem: a p-1 mod p = 1 for any prime p where gcd(a,p)=1.
In this case: 318 mod 19 = 1.
Thus 320 mod 19 = 32 318 mod 19 = (32 mod 19) (318 mod 19) = (32 mod 19) = 9.
b. 317 mod 19.
317 mod 19 = 3-1 318 mod 19 = 3-1 mod 19.
By defintion, 3-1 = x where 3 x mod 19 = 1
The numbers that leaves a remainder of 1 when divided by 19 are:
20, (20+19), (20+2.19), … etc.
or 20, 39, 58, …
Of these, 39 = 3. 13; thus x = 13.
2. Use the Chinese Remainder Theorem to find the smallest integer x that satisfies the
equations: x mod 11 = 3 and x mod 19 = 1.
By the Chinese Remainder Theorem, the solution is (a1 M1 Y1 + a2 M2 Y2) mod M.
Here a1 = 3, a2 = 1, M = m1 m2 = 11.19 = 209, M1 = M/m2 = 19, M2 = M/m1 =11.
Y1 = Inverse of M1 mod m1 = Inverse of 19 mod 11 = Inverse of 8 mod 11;
multiples of 11+1{ 12, 23, 34, 45, 56 } 7
Y2 = Inverse of M2 mod m2 = Inverse of 11 mod 19; multiples of 19+1{20, 39, 58, 77}  7
Thus solution = (3.19.7 + 1.11.7) mod 209 = (399 mod 209 + 77) mod 209
= (190+77) mod 209 = 267 mod 209 = 58.
Verify! 58 = 11*5 + 3
and 58 =19*3 + 1.
3. Show by example that if ab mod n = ac mod n then it does not necessarily follow
that b mod n = c mod n . Hint: Pick a that is not relatively prime with n.
3*8 mod 15 = 3*3 mod 15; Yet 8 ≠ 3 mod 15.
Problems from Chapter 3.1.
20. Prove that the sum of two rational numbers is rational.
Proof:
Using a direct proof. Given two rational numbers x=a/b and y =c/d where a,b,c,d are
integers, then x+y = a/b + c/d= (ad+cb)/bd (i.e. integer/integer). Thus x+y is rational.
__________________________________________________________________
24. Prove or disprove that the product of a nonzero rational and an irrational number
is irrational.
The statement is true. We prove it using an indirect proof. Assume that x*y= z, where x
is rational and y is irrational. Now if z is rational (negation of conclusion), we can write
y= z/x = (a/b)/(c/d), where a,b,c,d are integers. Thus y=(ad)/(bc) = rational, which
contradicts the fact that y is irrational.
__________________________________________________________________
26. Prove or disprove that 2n +1 is prime for all nonnegative integers n.
The statement is false. Consider n=6, then 26 +1=65 is not prime since it is divisible by
5.
__________________________________________________________________
34. Prove that if n is a positive integer, then n is even if and only if 7n+4 is even.
Proof:
The statement given if of the form p  q, where p: n is even, q: 7n+4 is even.
Thus we have to show p  q and q  p.
p  q (by direct proof):
n is even  n=2i for some integer i.
Thus 7n+4 = 7(2i)+4= 2(7i+2) = even integer.
q  p (by indirect proof, show not p  not q):
not p  n is odd  n=2i+1 for some integer i.
Thus 7n+4 = 7(2i+1)+4= 14i+11= 14i+10+1= 2(7i+5) + 1= odd = not q.
__________________________________________________________________
58. Find a counter example to the proposition: "For every prime number n, n+2 is
prime."
Consider n= 23. Here 23 is prime yet 23+2=25 is not prime.
__________________________________________________________________
60. Prove or disprove that if p1, p2, ..., pn are the n smallest primes, then
k=p1p2 ... pn+1 is prime.
The statement is false. The number k is clearly not divisible by any of p1, p2, ..., pn;
however, it may be a prime or divisible by a prime number > pn . For example
2*3*5*7*11*13+1=30031 =59*509.
Problems from Chapter 3.2.
20. Use mathematical induction to show that 3 divides n3 + 2n whenever n is a
nonnegative integer.
Proof :
Basis Step:
For n=0, 3 divides 03 + 2*0=0 ( 3 divides 0 is true).
Also (extra check) for n=1, 3 divides 13 + 2*1=3 (3 divides 3 is true).
Induction Step:
Assume P(n) and show P(n+1).
Thus we assume that 3 divides n3 + 2n and show that 3 divides (n+1)3 + 2(n+1).
We have to show (n+1)3 + 2(n+1) is divisible by 3.
(n+1)3 + 2(n+1) = (n+1)(n2+2n+1) + 2(n+1)
= n3 + 2n2 + n + n2+ 2n+1 + 2(n+1) = n3+3n2 + 3n + 2n +3
= (n3 + 2n) + 3(n2 + n + 1)
This consists of a sum of two parts; the first part is divisible by 3 from the induction
hypothesis; the second part is clearly divisible by 3 (it is a multiple of 3).
__________________________________________________________________
34. Prove by induction that 1* 21 + 2 * 22 + ... + n*2n = (n-1) 2n+1 + 2.
Proof:
Basis Step:
For n=1, LHS = 1* 21 = 2. RHS = (1-1) 21+1 + 2 = 2 = LHS.
Induction Step:
Assume P(n) and show P(n+1).
Thus we assume that 1* 21 + 2 * 22 + ... + n*2n = (n-1) 2n+1 + 2,
and show that 1* 21 + 2 * 22 + ... + n*2n + (n+1)*2n+1 = n 2n+2 + 2.
LHS (of what is to be shown) = 1* 21 + 2 * 22 + ... + n*2n + (n+1)*2n+1
= (n-1) 2n+1 + 2 + (n+1)*2n+1 by the induction hypothesis
= [n-1+n+1] 2n+1 + 2
= (2n) 2n+1+ 2
= n 2n+2+ 2
= RHS.