L43
L43
Prakash Institute
Activity:
Consider the polynomial p(x) = 7x3 − 8x2 + 6x + 5.
We want to find out p(3). We associate a cost to every operation
we perform while evaluating p(3).
Every addition or subtraction costs Re.1.
But every multiplication we perform costs Rs. 10.
Find the minimum cost of evaluation of p(3).
How do we go about finding the minimum cost?
We must do as less number of multiplications as possible.
We note that x is common to first three terms. How about taking
out x common?
p(x) = 7x3 − 8x2 + 6x + 5
= x[7x2 − 8x + 6] + 5
We can repeat the process for quadratic inside the bracket and so
on. This gives us
p(x) = x[x(7x − 8) + 6] + 5 · · ·. (1)
To evaluate p(3), we will replace x by 3.
Which part of the expression (1) gets evaluated first?
Which part of (1) gets evaluated next?
Let us consider a general fourth degree polynomial.
Consider p(x) = a3 x3 + a2 x2 + a1 x + a0
= x[a3 x2 + a2 x + a1 ] + a0
= x[x[a3 x + a2 ] + a1 ] + a0
What does this expression remind you of?
Let us rewrite this as follows,
a3 a2 a1 a0
2
a3 x a3 x + a2 x a3 x + a2 x 2 + a1 x
3
a3 a3 x + a2 a3 x 2 + a2 x + a1 a3 x 3 + a2 x 2 + a1 x + a0
We note that to evaluate a third degree polynomial we have per-
formed 3 multiplications and 3 additions.
Is it possible to improve?
The answer is NO.
As there are four different terms a0 , a1 x, a2 x2 , a3 x3 ; we have to per-
form at least 3 additions.
Also, to evaluate a3 x3 = (a3 )(x)(x)(x) we must perform atleast
three multiplications.
In general, it is easy to see that to evaluate polynomial of degree
n, the minimum number of multiplications and additions is n each.
Synthetic Division:
Let p(x) = an xn + an−1 xn−1 + · · · + a1 x + a0 . Let deg(p(x)) = n ≥ 1.
We want to divide p(x) by (x − k) and obtain the quotient q(x) and
the remainder r(x).
Division algorithm gives,
p(x) = (x − k)q(x) + r(x), where r(x) = 0 or
deg(r(x)) < deg((x − k)) = 1
Hence r(x) is a real number and we will write r(x) = r.
This gives p(x) − r = (x − k)q(x).
We note that deg(p(x) − r) = n.
Hence we deduce that deg(q(x)) = n − 1.
Thus we can take q(x) as bn−1 xn−1 + bn−2 xn−2 + · · · + b1 x + b0 .
Our task now is to find following n+1 real numbers, viz b0 , b1 , b2 , · · · , bn−1
and r.
We require n + 1 equations to determine (n + 1) unknowns.
Where do we get these equations?
Recall the definition of equality of two polynomials.
Two polynomials are equal if and only if they have same degree and
their corresponding coefficients are equal.
p(x) = (x − k)q(x) + r
Equating coefficients of xn , xn−1 , · · · , x2 , x1 , x0
we will obtain the required (n + 1) equations.
p(x) = (x − k)q(x) + r
gives,
an xn + an−1 xn−1 + · · · + ar+1 xr+1 + ar xr + ar−1 xr−1 + · · · + a1 x + a0
= (x − k)[bn−1 xn−1 + bn−2 xn−2 + · · · + b1 x + b0 ] + r
Co. of LHS RHS Deduction
xn an bn−1 bn−1 = an
xn−1 an−1 bn−2 − kbn−1 bn−2 = kan + an−1
xn−2 an−2 bn−3 − kbn−2 bn−3 = k 2 an + kan−1 + an−2
..
.
xr+1 ar+1 br − kbr+1 br = k n−r−1 an + k n−r−2 an−1 + · · · + ar+1
xr ar br−1 − kbr br−1 = k n−r an + k n−r−1 an−1 + · · · + kar+1 + ar
..
.
x2 a2 b1 − kb2 b1 = k n−2 an + k n−3 an−1 + · · · + ka3 + a2
x1 a1 b0 − kb1 b0 = k n−1 an + k n−2 an−1 + · · · + ka2 + a1
x0 a0 −kb0 + r r = k n an + k n−1 an−1 + · · · + ka1 + a0 = p(k)
Is there an easy way to reconstruct these expressions?
an an−1 an−2 an−3
kan k 2 an + kan−1 k 3 an + k 2 an−1 + kan ···
an kan + an−1 k 2 an + kan−1 + an−2 k 3 an + k 2 an−1 + kan + an−3
a2 a1
··· k n−1 an + k n−2 an−1 + · · · + ka2
··· k n−1 an + k n−2 an−1 + · · · + ka2 + a1
a0
··· k n an + k n−1 an−1 + · · · + ka1
k n an + k n−1 an−1 + · · · + ka1 + a0