method of repeated squaring
Theorem 1.
Given a semigroup S and an n∈Z+ then the function
f:S→S defined by f(a)=an has an SLP representations of
computational length O(log2n). Inparticular, if we can compute an
using only O(log2n) multiplications.
Proof.
Let f0:S→S be the map f(x)=x and f1:S→S be defined by f1(x)=xx. So far we recognize that f0(x) evaluates to x1=x20 and f1(x) evaluates to x2=x21. But we caution that we do not define these functions with exponents because we want to demonstrate that from an algorithm to multiply we can create an efficient algorithm to exponentiate.
For 1<i≤k define (recalling that fi+1 may use the output of any previous fi evaluation)
fi+1(x):= |
Evidently, evaluates to . By induction, evaluates to and thus evaluates to . Therefore we establish that for all nonnegative integers . Furthermore, to evaluate uses multiplications.
Now write in binary: with for . Let be the indices for which , . Then define
Thus, evaluates to:
Because each uses the output of , the cost of evaluating is the cost of evaluating plus the final cost of multiplying . Thus, evaluating uses multiplications. As it follows that evaluating uses no more than multiplications. ∎
Title | method of repeated squaring |
---|---|
Canonical name | MethodOfRepeatedSquaring |
Date of creation | 2013-03-22 16:16:14 |
Last modified on | 2013-03-22 16:16:14 |
Owner | Algeboy (12884) |
Last modified by | Algeboy (12884) |
Numerical id | 9 |
Author | Algeboy (12884) |
Entry type | Theorem |
Classification | msc 20A05 |
Classification | msc 08A99 |
Classification | msc 20-00 |
Synonym | successive squaring |