CS 235: Algebraic Algorithms
Assignment 1
Solutions
1
Modular Multiplication
1.1
Proof by induction (10 points)
Let
n
and
a
be given. Base case: b=0. Then
a
·
0 = 0, so the claim reduces to 0 =
(
a
mod
n
)
·
(0 mod
n
) (mod
n
), which is trivial.
Induction step: Assume for our induction hypothesis that the claim is true for
b

1. We
must show it for
b
as well. All equalities are modulo
n
.
ab
=
a
(
b

1) +
a
= [
a
(
b

1) mod
n
] + (
a
mod
n
)
(By the rule for addition)
= (
a
mod
n
)(
b

1 mod
n
) + (
a
mod
n
)
(By the IH)
= (
a
mod
n
)[(
b

1 mod
n
) + 1]
Now if (
b

1) mod
n
is less than
n

1, then [(
b

1 mod
n
)+1] = (
b
mod
n
) and we are
done. Otherwise,
b
mod
n
= 0, so the right side of the equation is zero, and the left side is
a multiple of
n
, which is also 0 mod
n
.
This completes the proof for
b
≥
0. For
b <
0, note that we can repeat the preceding
exactly, with an induction hypothesis of
b
+ 1, decreasing
b
with each step and ﬂipping signs
throughout the argument.
1.2
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '09
 BERA
 Algorithms

Click to edit the document details