What is a polynomial?

A polynomial is a mathematical expression that contains more than two algebraic terms. It is a sum of several terms that contain different powers of the same variable. px is the representation of a polynomial. A polynomial expression representation consists of at least one variable, and typically includes constants and positive constants as well. It is represented as a1xn+ a2xn-1+a3xn-2+.............+anx0, where x is the variable, a1, a2,a3,....................,an are the coefficients and n is the degree of the polynomial.  The coefficients must be a real number. 

It is necessary for the polynomial expression that each expression consists of two parts:

  1. Coefficient part
  2. Exponent part

Example:

px = 21x3 + 3x2 + 14x1 + 21x0. Here, 21, 3, 14, and 21 are the coefficients, and 3,2,1 and 0 are the exponential valuesx.

Types of polynomials

Monomial

It has only one term, like 2x, 23xy.

Binomial

It has two terms, or we can say that it is the sum of two monomials; for example, 2x+3.

Trinomial

It consists of three terms of monomials; for example, 2x+3y+7z.

Matrix representation of a polynomial

Consider a polynomial equation px+y = ax + by2. It can be written as:

px,y = abxy2.

It can be written as vT Mv. Here, v = xyT, and M = a2ababb2.

But how do we find the value of M. Furthermore, Here px,y has degree 2. It is represented as the multiplication of matrix and vector,

Important Point- If  M = (mij), then

                            vTMv = ijmijvivj

Then compare the coefficients of vivji,j both sides of the equation to get mij.

 abxy = xyab,

then M = abab.

Let us assume that v = xy and A = ab.

From the first line, we note that:

 Av = vTAT , and hence that 

Av2 =AvT Av          =vTATAV          =vTATAvSo M=ATA

It is a matrix representation of the polynomial. 

Vector space of polynomials

The n degree polynomial is a function that is represented as:

px = a0+a1x+a2x2+.......+anxn, where a0,a1,a2,.......,an,  is the coefficient of a real number, and n is degree.

Polynomials are represented by the vector of their coefficients in a vector space:

u = a0a1a3.a4

Representation of polynomial

There are various ways to represent the polynomials, two of which are given below.

  • Using array
  • Using a linked list

Representation of polynomial equation using array

The operations such as addition, subtraction, multiplication, differentiation and so forth can be performed on the polynomials represented as arrays.

Example:

Consider a polynomial with two variables: 2x2+5xy+y2.

The array representation of the polynomial is give below:

220511102

Index 0 stores the coefficient of the first term, index 1 stores the exponent of the variable x and index 2 stores the exponent of the variable y in the first term. The process is repeated for the remaining terms in the polynomial.

It can also be represented as a 2-dimentional array as follows:

 y0y1y2
x0001
x1050
x2200

Representation of polynomial with single variable -

Consider a polynomial -4+7x+6x2 then we can write as:  -4x0+7x1+6x2

For the one-dimensional array, store the coefficients in the index given by the coefficient of the polynomial.

Representation of a polynomial using an array
array representation of polynomial

In the array representation, the array first the first element stores the coefficient of the term with the lowest exponent and the last element contains the coefficient of the term with the highest exponent.

The above diagram shows the array representation of polynomial. A polynomial of a single variable AX can be written as a0+a1X1+a2X2+a3X3+.........+anXn where an0 and degree of AX is n. Here a0, a1, a2, ......an is the coefficient of respective terms.

Polynomial represented as an array

The polynomial is represented using an array of size n which has n+1 terms.

Polynomial Addition using Array

Consider two different polynomials  X1 = 3x1+5x2+7x3 and X2= 7x0+3x1+4x2. The degree of X1 is 3 and the degree of X2 is 2. The steps to add the polynomials are listed below.

  • First identify the highest degree polynomial. The degree of the resultant polynomial is same as the polynomial with the highest degree.
  • Store the coefficient in the index specified by the exponents of the polynomial. 
  • Add the coefficients stored in one array with the corresponding index positions in the other array and store the result in the same index position in the resultant array.
The diagram shows the addition of  two polynomials

Representation of polynomial using linked list

An ordered list of non-zero terms can be thought of as a polynomial. Each non-zero term consists of three sections namely coefficient part, exponent part, and then a pointer pointing to the node containing the next term of the polynomial.

Let's take an example-

If the polynomial is 2x2+3x+4, then it is written in the form of 2x2+3x1+4x0 and represented it using a linked list.  In the diagram, AON means "address of next node".

linked list representation
Linked List Representation

The above diagram shows the linked list representation of polynomial. A polynomial of a single variable can be written as a0+a1X1+a2X2+a3X3+.........+anXn where an0  and degree of AX is n. Here a0, a1, a2, ......an is the coefficient of respective terms.

This diagram shows linked list representation.
linked list representation

Addition of polynomials represented as linked lists

Consider the polynomials 12x4+2x2+10 and 9x3+8x2+x.

Polynomial addition using linked list
polynomial addition

The addition of linked list is done by three cases-

Case 1:

If the exponent of the node pointed by j of X2 is less than the exponent of the current node pointed by i of X1, then copy the value of current node of X1 pointed by i in the new node. If the new node is the first node, make it pointed by X3 and a pointer k. Otherwise, add the new node next to the last node.

Case 2:

If the exponent of the node pointed by j of X2 is greater than the exponent of the current node pointed by i of X1, then copy the value of the current node X2 pointed by j in the new node. If the new node is the first node, make it pointed by X3 and a pointer k. Otherwise, add the new node next to the last node. 

Case 3:

If the exponent of two terms of polynomials X1 and X2 is equal, then the coefficients are added, and the new term is stored in the resultant polynomial X3 and advance i, j and k to move to the next node.

Common Mistakes

There are some common mistakes made in the polynomial. When expanding a binomial raised to a power, students frequently make the error of "distributing the exponent," which is comparable to distributing a coefficient. Here's an illustration:

(x-2)2=x2-22= x2-4

This is a wrong calculation. Remember that squaring a polynomial is the same as multiplying it by itself. If we perform the same thing with this binomial, we get the following:

(x-2)2=x(x-2)-2(x-2) Distribute it one (x+5) factor=x2- 2x -2x + 2·2= x2 -4x + 4   This is a Correct answer

The outcomes are not the same. Remember that the word "distribute" refers to multiplication, not exponents or powers. Note that we could have multiplied the two polynomials with FOIL as well. When factoring a sum or difference of squares, the same mistake is committed in reverse:

x2+9 = (x+3)2 ===> Incorrect

or x2-9 = (x-3)2 ===> Incorrect

There is no factoring formula that uses the "sum of squares." There is, however, a factoring formula based on "difference of squares"; though, the output is not the same binomial squared:

x2 - 9 = (x + 3) (x - 3) ==> correct

When asked to simplify an expression within a radical, another common error is to spread the root. As an example,

x2 + 9 = x2  + 9= x+3     Incorrect!!!

Since we cannot factor x2+9

We didn't write it as a square or some other equation, so the square root can't be calculated.

Context and Applications

This topic is very useful for under graduation and post graduation also. Especially for,

  • Bachelor degree in Computer Science
  • Bachelor degree in Electronics engineering
  • Master in Computer science
  • Polynomial representation in data structure
  • Polynomial in one variable
  • Coefficient of polynomial

Practice Problems

Q1- The Exponent of polynomial must be-

  1. Negative
  2. Non Negative
  3. None
  4. Complex number

Correct answer: Non negative

Explanation- For an algebraic expression to be a polynomial, all of the exponents in it must be non-negative integers. If an algebraic expression contains a radical, it isn't a polynomial, as a general rule.

 

Q2- x2+2x+1 is a polynomial of- 

  1. One variable
  2. Two variable
  3. Three variable
  4. Four variable

Correct Answer- One variable

Explanation-  The expression contains only one variablex x.

 

Q3- What is the way to represent a polynomial?

  1. Representation using Array
  2. Representation using linked list
  3. Both
  4. None

Correct answer- Both

Explanation- There are 2 ways to represent a polynomial and they are array and linked list. 

 

Q4- What is the example of trinomial?

  1. 3x+6y+8y2 
  2. 4x+2y+5z 
  3. 2z3+3z+1 
  4. None

Correct answer- 4x+2y+5z 

Explanation- This expression contains 3 variables x, y and z.

 

Q5- Adding the polynomials require adding the ___________

  1. exponents of the corresponding terms
  2. coefficients of the corresponding terms
  3. both
  4. none

Correct answer- 2. coefficients of the corresponding terms

Explanation- The coefficient of the first polynomial is added with the coefficient of the corresponding term in the second polynomial to obtain the resultant polynomial. 

Want more help with your computer science homework?

We've got you covered with step-by-step solutions to millions of textbook problems, subject matter experts on standby 24/7 when you're stumped, and more.
Check out a sample computer science Q&A solution here!

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.

Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

Tagged in
EngineeringComputer Science

Algorithms

Polynomial

Representation of Polynomial

Representation of Polynomial Homework Questions from Fellow Students

Browse our recently answered Representation of Polynomial homework questions.

Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

Tagged in
EngineeringComputer Science

Algorithms

Polynomial

Representation of Polynomial