# Polynomials

graph LR
classDef currentPage stroke:#333,stroke-width:4px

ALG(["fas:fa-trophy Algorithmis fas:fa-trophy "])

ASY_ANA(["fas:fa-check Asymptotic Analysis#160;"])
click ASY_ANA "./math-asymptotic-analysis"

MAT_NOT(["fas:fa-check Mathematical Notation#160;"])
click MAT_NOT "./math-notation"

POL(["fas:fa-check Polynomials #160;"])
click POL "./math-polynomials"

class POL currentPage

MAT_FUN(["fas:fa-check Math Functions#160;"])
click MAT_FUN "./math-functions"

LOG(["fas:fa-check Logarithms#160;"])
click LOG "./math-logarithms"

COM(["fas:fa-check Combinatorics#160;"])
click COM "./math-combinatorics"

SET_NOT(["fas:fa-check Set Notation#160;"])
click SET_NOT "./math-set-notation"

GRA(["fas:fa-check Graphing#160;"])
click GRA "./math-graphing"

BW(["fas:fa-check Bitwise Logic#160;"])
click BW "./math-bitwise"

MAT(["fas:fa-check Matrices#160;"])
click MAT "./math-matrices"

ASY_ANA-->ALG
BW-->ALG
MAT-->ALG
COM & GRA & SET_NOT-->ASY_ANA
MAT_NOT--> SET_NOT
POL & LOG--> MAT_FUN
MAT_FUN--> GRA

Polynomials are a staple in mathematical thinking. The concept is simple; however, they encapsulate the full expressibility of addition and multiplication. Studying polynomials not only unlocks tools for algorithmic analysis, comprehension leads to computational thinking. In other words, even if the knowledge is not directly applied the effect of its influence on brain power is priceless.

The first step in harnessing the power of polynomials is to understand what they are. Consider the formal definition below.

A single variable polynomial with real coefficients is a function $f$ that takes a real number as input, produces a real number as output, and has the form:

$f(x) = a_0 + a_1 x + a_2 x^2 + ... + a_n x^n$

$a_i$, the coefficients of $f$, are real numbers. Each exponent is a positive whole number and the highest exponent is the degree of the polynomial which is specified by $n$. The one exception is the zero polynomial ($f(x) = 0$) that by convention is said to have a degree of $-1$.

It’s a lot to take in, so it’s best to break it down one piece at a time:

• $f$ is the name of a function. You can give it any name you want. $t(x), j(x), \sigma(x)$ are all valid. However, $f(x)$ and $g(x)$ are the most common.
• $x$ is an input variable. Again, this can be anything. $f(t), f(g), f(\sigma)$ are all valid.
• $a_0, a_1, …, a_n$ are the coefficients. The choice of $a$ is again arbitrary, any name will suffice. Coefficients are analogous to an array that is indexed by the subscripts. A coefficient can be any real number.
• $n$ defines the degree of the polynomial. $f(x) = 1 + 2x + 4\hl{x^2}$ has a degree of 2 and $f(x) = 1 + 2x + 4x^2 + 5\hl{x^3}$ has a degree of 3. Remember that all the exponents in a polynomial are whole numbers.

To use a concrete example, consider a function $g(t)$ where $n = 4$ and $b_0=2, b_1=0, b_2=4, b_3=-1$. This is written out as:

$g(t) = 2 + 0^t + 4t^2 + (-1)t^3$

This may look a bit funny, because polynomials are rarely written out exactly like this. Zero values are omitted because they do not change the end result. Additionally, adding a negative value is equivalent to subtracting the value. Therefore, this becomes:

$g(t) = 2 + 4t^2 - t^3$

With a defined function, it’s possible to feed input variables in and get answers.

$g(\hl{10}) = 2 + 4(\hl{10}^2) - \hl{10}^3 = -598$ $g(\hl{2}) = 2 + 4(\hl{2}^2) - \hl{2}^3 = 10$

Polynomials are often simplified until they don’t look anything like the definition above. The two functions below are equivalent. The bottom function is a simplified form of the top function.

$f(x) = -1+(-1)x+0x^2+0x^3+0x^4+1x^5$ $f(x) = x^5-x-1$

In a more general sense, a polynomial is any function that accepts a single numeric input and can be expressed using only addition, multiplication, and constants. The actual form used to express the polynomial is not important. Any expression that can be expanded to the form in the formal definition is a valid polynomial.

## Exercises

1. Write the following polynomial using the expanded representation outlined in the formal definition.

$\pi x^6 - 4x^3 + 5$

$5 + 0x + 0x^2 + (-4)x^3 + 0x^4 + 0x^5 + \pi x^6$
2. For each function below, determine if it is a polynomial or not. If it is, identify the coefficients and degree of the polynomial.
a. $f(x) = 0$
b. $\sigma(x) = 3.2 + \frac{1}{x} - \frac{7}{x^2}$
c. $g(x) = x^{\frac{1}{2}}$
d. $q(t) = t + t^2$
e. $f(x) = \pi - x + x^3$

1. $f(x)$ is a polynomial.
coefficients: $a_0=0$
2. $\sigma(x)$ is NOT a polynomial because there are negative exponents.
$\frac{1}{x} = x^{-1}$
$\frac{7}{x^2} = 7x^{-2}$
3. $g(x)$ is NOT a polynomial because it has a fractional exponent
4. $q(t)$ is a polynomial.
coefficients: $a_0=0, a_1=1, a_2=1$
5. $f(x)$ is a polynomial.
coefficients: $a_0=\pi, a_1=1, a_2=0, a_3=1$