Open In App
Related Articles

GATE | GATE-CS-2006 | Question 1

Like Article
Save Article
Report issue
Consider the polynomial p(x) = a0 + a1x + a2x2 + a3x3 , where ai ≠ 0 ∀i. The minimum number of multiplications needed to evaluate p on an input x is: (A) 3 (B) 4 (C) 6 (D) 9

Answer: (A)

Explanation: Background Explanation : Horner’s rule for polynomial division is an algorithm used to simplify the process of evaluating a polynomial f(x) at a certain value x = x0 by dividing the polynomial into monomials (polynomials of the 1st degree). Each monomial involves a maximum of one multiplication and one addition processes. The result obtained from one monomial is added to the result obtained from the next monomial and so forth in an accumulative addition fashion. To explain the above, let is re-write the polynomial in its expanded form; f(x0) = a0 + a1x0+ a2x0^2+ … + anx0^n This can, also, be written as: f(x0) = a0 + x0(a1+ x0(a2+ x0(a3+ … + (an-1 + anx0)….) The algorithm proposed by this rule is based on evaluating the monomials formed above starting from the one in the inner-most parenthesis and move out to evaluate the monomials in the outer parenthesis. Solution : Using Horner’s Rule, we can write the polynomial as following a0 + (a1 + (a2 + a3x)x)x In the above form, we need to do only 3 multiplications

p = a3 X x    ------------ (1)

q = (a2 + p) X x  ---------(2)

r = (a1 + q) X x  ---------(3)

result = a0 + r 
Reference : This solution is contributed by Nitika Bansal.

Quiz of this Question

Last Updated : 28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Similar Reads