K. Then
f
1
+
1
f
2
+
1
f
1
+
1
f
).
CS 487: Intro. to Symbolic Computation Winter 2014: George Labahn Assignment 1 Page 2
Dene polynomials c
K[x
1
, . . . , x
] for N, inductively by
c
1 if = 0,
x
1
if = 1,
x
1
c
1
(x
2
, . . . , x
) +c
2
(x
3
, . . . , x
) if 2.
(b) Prove by induction that for 1
C( f
1
, . . . , f
) =
c
( f
1
, . . . , f
)
c
1
( f
2
, . . . , f
)
.
(c) Write a Maple program that computes the EES and all continuants c
i
(q
i+1
, . . . , q
).
Test your algorithm thoroughly and run it on a
0
= x
40
and a
1
= x
38
+2x
36
+x
2
in Q[x].
(d) What is the relation between the continuants and the entries of the EES?
3. Let R be a ring (commutative, with 1) and f , g R[x, y] (i.e., polynomials in the two variables
x and y). Assume that f and g have degrees less than m in y and n in x. Let h = f g (the
product of f and g).
(i) Using classical univariate polynomial multiplication, and viewing R[x, y] as R[y][x] (i.e.,
polynomials in x with coefcients in R[y]), bound the number of operations in R to
compute h.
(ii) Using Karatsubas algorithm, bound the number of operations in R to compute h.
(iii) Generalize parts (i) and (ii) to polynomials in an arbitrary number of variables.
4. In linear algebra it is often useful to evaluate a polynomial at a matrix. Let F be a eld and
f =
0in
a
i
x
i
F[x] have degree n. Let A F
mm
be an mm matrix over F. We dene
f (A) =
0in
a
i
A
i
F
mm
(i) Given two matrices A, B F
mm
, how many operations in F does it take to compute the
matrix product C = AB F
mm
, using the standard school method.
(ii) Given a polynomial f F[x] of degree n, and A F
mm
, describe the obvious algorithm
for evaluating f (A). Analyse the cost of this algorithm in terms of operations in F,
depending on m and n.
(iii) Design an asymptotically faster algorithm for evaluating f (A). Try binary powering,
Karatsubas method or a combination of the two.
(iv) Write two Maple procedures, one using the nave algorithm and one using for your new
algorithm, to evaluate a polynomial at a matrix, where all coefcients of the polynomial
and entries of the matrix are in Z
p
. The arguments to your procedures should be the
polynomial f Z
p
[x], the matrix A Z
mm
p
, and the prime p. Compare the timings
of the algorithms on a few examples to show the practical benet of the asymptotic
speedup you obtained.