## Alternate Bases and Polynomials

A theme emerged from our previous discussion about visualizing functions -- namely: "There's more than one way to do things!"

Believe it or not, the same is true for counting! Of course, we all know how to count -- this is a skill we likely learned in kindergarten. However, thinking carefully through the mechanics of counting in our traditional Hindu-Arabic system will reveal opportunities to create entirely new ways to count!

Let us see how...

If we were to write down the first many whole numbers (defined to be the non-negative integers $0,1,2,3,\ldots$) we would of course start by writing down ten different symbols we have adopted for the first ten numbers $\{0,1,2,3,4,5,6,7,8,9\}$. We call these symbols digits, from the Latin digitus which means finger or toe.

Note the bijection that can be formed between these symbols and one's fingers!

There are certainly more than ten numbers -- but we can't have a different symbol for every integer, as we would require infinitely many (and then kindergarten would have been so much harder)!

Instead, we use sequences of these symbols (sometimes called a digit strings) to describe larger integers.

We need to ensure that as we write down the digit strings for larger and larger numbers, that no digit string shows up more than once, as otherwise, we won't be able to say which whole number it actually represents. (Do you smell injectivity here?)

The mechanical counters seen in old cars (and like the one shown on the right) provide a physical manifestation of how we traditionally do this. These devices start with a string of all $0$s showing on some number of "digit wheels" to represent an initial count of zero. Then, as these devices count upwards, their right-most wheel spins to increment the digit it represents from $0$ to $1$ to $2$, etc. Eventually, upon running out of digits to display, the right-most wheel cycles back to $0$ again -- but at that same time a special gear mechanism also increments the digit on the wheel to its immediate left, ensuring a new, unseen string of digits is created.

This happens over and over again, we increment the right-most digit repeatedly until we run out of digits, then it resets to $0$ and we increment the digit to its immediate left. Of course, eventually we will run out of digits in our second position too. Note, this happens when the last two digits are both $9$s. However, this difficulty can be overcome with a similar strategy -- we simply reset both $9$s to $0$, and then increment the third digit from right, again ensuring we generate a new, previously unseen digit string for the next number counted. We follow a similar pattern as we run out of digits on the third wheel from the right, and then the fourth, and so on.

Of course, unlike mechanical counters -- whose number of internal "digit wheels" limits how high they can count -- we adopt the convention of allowing ourselves digit strings of arbitrary length, assuming an infinite number of (unwritten) zeros initially exist to the left of the left-most digit we actually write down.

Following this strategy, note while the right-most digit changes every time we add one to the overall value, the second digit from the right only increments with every ten added. Similarly, the third digit changes only with every hundred added -- the fourth, every thousand, etc.

As such, each digit contributes to the overall value of the digit string the product of itself and some appropriate power of ten (as determined by the position of the digit). As an example, note that: $$\begin{array}{rcl} 5760 &=& 5000 + 700 + 60 + 3\\ &=& 5 \cdot 10^3 + 7 \cdot 10^2 + 6 \cdot 10^1 + 3 \cdot 10^0 \end{array}$$

Again, all of this is "old news". You've probably been counting since you were five.

But here's the wrinkle -- what if we were all born with some different number of fingers and toes? What if, instead of ten of each, we only had 8? ... what if we only had 3? ... or 16?

In each case, the same strategy still works! We will just "run out of digits" at different times -- the "wheels" will either spin a little faster, or a little slower. To see this, in the table below, we count to $41$ using our normal way of writing numbers based on 10 fingers (which we call base 10) and then to the same value in alternative numbering systems based on having only 3, 8, or 16 fingers (unsurprisingly called base 3, base 8 (or octal), and base 16 (or hexadecimal). Note, we'll need a total of 16 digits for hexadecimal numbers. Traditionally, we use the symbols $\{0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F\}$ for these, in that order.

Pay particular attention to how the digit "2" in base 3, the digit "7" in base 8, and the digit "F" in base 16 all play the same role as the digit "9" in base 10. These each represent the last digit you can use in the corresponding base before changing the digit to its immediate left, and resetting others to zero:

Base 10Base 3Base 8Base 16Base 10Base 3Base 8Base 16
0 0 00 21 2102515
1 1 11 22 2112616
2 2 22 23 2122717
3 10 33 24 2203018
4 11 44 25 2213119
5 12 55 26 222321A
6 20 66 27 1000331B
7 21 77 28 1001341C
8 22 108 29 1002351D
9 100 119 30 1010361E
10 101 12A 31 1011371F
11 102 13B 32 10124020
12 110 14C 33 10204121
13 111 15D 34 10214222
14 112 16E 35 10224323
15 120 17F 36 11004424
16 121 2010 37 11014525
17 122 2111 38 11024626
18 200 2212 39 11104727
19 201 2313 40 11115028
20 202 2414 41 11125129

Recall again how in base $10$, we can write $5763$ as the sum $5000 + 700 + 60 + 3$, or equivalently: $$5763 = 5 \cdot 10^3 + 7 \cdot 10^2 + 6 \cdot 10 + 3$$ Adopting a convention of using subscripted parentheses to indicate a digit string whose base is not $10$, we see a similar pattern in the calculations below for these other bases, $3$, $8$, and $16$. Indeed, this pattern holds for all integer bases $2$ or greater: $$\begin{array}{rcccl} 5763 &=& (\color{red}{21220110})_3 &=& \color{red}{2} \cdot 3^7 + \color{red}{1} \cdot 3^6 + \color{red}{2} \cdot 3^5 + \color{red}{2} \cdot 3^4 + \color{red}{0} \cdot 3^3 + \color{red}{1} \cdot 3^2 + \color{red}{1} \cdot 3 + \color{red}{0}\\ &=& (\color{blue}{13203})_8 &=& \color{blue}{1} \cdot 8^4 + \color{blue}{3} \cdot 8^3 + \color{blue}{2} \cdot 8^2 + \color{blue}{0} \cdot 8 + \color{blue}{3}\\ &=& (\color{green}{1683})_{16} &=& \color{green}{1} \cdot 16^3 + \color{green}{6} \cdot 16^2 + \color{green}{8} \cdot 16 + \color{green}{3} \end{array}$$

In this way, for any positive integer base $b \gt 1$, we can express the integer value $(d_n d_{n-1} d_{n-2} \ldots d_1 d_0)_b$ with the following expression: $$d_n b^n + d_{n-1} b^{n-1} + d_{n-2} b^{n-2} + \cdots + d_1 b + d_0$$ where each $d_i$ is some integer taken from $\{0,1,2,\ldots,(b-1)\}$

With the above providing the rudiments of how to convert from one base to another, we can convince ourselves that the mechanics of performing basic arithmetic operations in base $10$ (i.e., addition, subtraction, multiplication, and division) all have direct analogs in these other bases too!

For example, one can add two base 16 numbers natively (i.e.., without converting things back to base 10 first) as long as you remember that you "carry" every time you calculate a sum that is greater than or equal to your base (instead of greater than or equal to 10), and that what you "carry" is the number of times you can pull out the base from your sum without going negative.

This is best illustrated by an example. Suppose you wish to add the hexadecimal numbers $(52F5A)_{16}$ and $(D3CF7)_{16}$.

Then, starting with the right column (and remembering in hexadecimal $A=10, B=11, C=12, D=13, E=14$ and $F=15$):

Note $\color{blue}{A} + \color{blue}{7} = 17 = \color{red}{1} \cdot 16 + \color{red}{1}$, we write a $1$ in the "units" digit and carry a $1$ to the "tens/sixteens" column.

$$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & & & \color{red}{\scriptsize 1} &\\ & 5 & 2 & F & 5 & \color{blue}{A}\\ + & D & 3 & C & F & \color{blue}{7}\\\hline & & & & & \color{red}{1} \end{array}$$ Then, adding the column to its left, we have $\color{blue}{1} + \color{blue}{5} + \color{blue}{F} = 21 = \color{red}{1} \cdot 16 + \color{red}{5}$, so we write a $5$ as the next digit of our answer, and carry a $1$. $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & & \color{red}{\scriptsize 1} & \color{blue}{\scriptsize 1} &\\ & 5 & 2 & F & \color{blue}{5} & A\\ + & D & 3 & C & \color{blue}{F} & 7\\\hline & & & & \color{red}{5} & 1 \end{array}$$ Similarly for the next column left, we have $\color{blue}{1} + \color{blue}{F} + \color{blue}{C} = 28 = \color{red}{1} \cdot 16 + \color{red}{12}$, so we write a $C$ and carry a $1$. $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & \color{red}{\scriptsize 1} & \color{blue}{\scriptsize 1} & {\scriptsize 1} &\\ & 5 & 2 & \color{blue}{F} & 5 & A\\ + & D & 3 & \color{blue}{C} & F & 7\\\hline & & & \color{red}{C} & 5 & 1 \end{array}$$ Seeing $\color{blue}{1} + \color{blue}{2} + \color{blue}{3} = 6 = \color{red}{0} \cdot 16 + \color{red}{6}$ for the next column, we only write a $6$ and carry nothing. $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & \color{blue}{\scriptsize 1} & {\scriptsize 1} & {\scriptsize 1} &\\ & 5 & \color{blue}{2} & F & 5 & A\\ + & D & \color{blue}{3} & C & F & 7\\\hline & & \color{red}{6} & C & 5 & 1 \end{array}$$ Finally, we finish by noting in the left-most column $\color{blue}{5} + \color{blue}{D} = 18 = \color{red}{1} \cdot 16 + \color{red}{2}$, we write a $2$ and carry a $1$. As this last carry goes to a column with nothing in it, we simply bring it down as the final digit of our answer. $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & \scriptsize 1 & {\scriptsize 1} & {\scriptsize 1} &\\ & \color{blue}{5} & 2 & F & 5 & A\\ + & \color{blue}{D} & 3 & C & F & 7\\\hline \color{red}{1} & \color{red}{2} & 6 & C & 5 & 1 \end{array}$$

Thus, $(52F5A)_{16} + (D3CF7)_{16} = (126C51)_{16}$

Of course, if desired we can verify this is true by converting everything back to base 10: $$\begin{array}{lll} (52F5A)_{16} &=& 5 \cdot 16^4 + 2 \cdot 16^3 + 15 \cdot 16^2 + 5 \cdot 16 + 10 = 339802\\ (D3CF7)_{16} &=& 13 \cdot 16^4 + 3 \cdot 16^3 + 12 \cdot 16^2 + 15 \cdot 16 + 7 = 867575\\ (126C51)_{16} &=& 1 \cdot 16^5 + 2 \cdot 16^4 + 6 \cdot 16^3 + 12 \cdot 16^2 + 5 \cdot 16 + 1 = 1207377 \end{array}$$ and, as expected: $$339802 + 867575 = 1207377$$

### Multiplication in other Bases

Multiplication in bases other than $10$ works similarly to addition. Consider the product of $(82A)_{16}$ and $(C73)_{16}$, calculated below:

Similar to how we would start a multiplication problem in base $10$, we start with the product of $3$ and the top number.

To find this product, we first calculate $\color{blue}{3} \cdot \color{blue}{A} = 30 = \color{red}{1} \cdot 16 + \color{red}{E}$, and consequently "carry" a $1$. $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & & & \color{red}{\scriptsize 1} & \\ & & & 8 & 2 & \color{blue}{A}\\ & \times & & C & 7 & \color{blue}{3}\\\hline & & & & & \color{red}{E} \end{array}$$

Next, we find $\color{blue}{3} \cdot \color{blue}{2} + \color{blue}{1} = \color{red}{0} \cdot 16 + \color{red}{7}$, which does not require a carry. $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & & & \color{blue}{\scriptsize 1} & \\ & & & 8 & \color{blue}{2} & A\\ & \times & & C & 7 & \color{blue}{3}\\\hline & & & & \color{red}{7} & E \end{array}$$ To complete the product of $3$ and the top number, we next calculate $\color{blue}{3} \cdot \color{blue}{8} = 24 = \color{red}{1} \cdot 16 + \color{red}{8}$. This produces a "carry" of $1$ to an empty column -- so we simply bring it down. $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & & & {\scriptsize 1} & \\ & & & \color{blue}{8} & 2 & A\\ & \times & & C & 7 & \color{blue}{3}\\\hline & & \color{red}{1} & \color{red}{8} & 7 & E \end{array}$$ Now, we repeat the process to find the products of $7$ and the top number, and $C$ and the top number, respectively: $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & & \color{blue}{8} & \color{blue}{2} & \color{blue}{A}\\ & \times & & C & \color{blue}{7} & 3\\\hline & & 1 & 8 & 7 & E\\ & \color{red}{3} & \color{red}{9} & \color{red}{2} & \color{red}{6} & \\ \end{array}$$ $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & & \color{blue}{8} & \color{blue}{2} & \color{blue}{A}\\ & \times & & \color{blue}{C} & 7 & 3\\\hline & & 1 & 8 & 7 & E\\ & 3 & 9 & 2 & 6 & \\ \color{red}{6} & \color{red}{1} & \color{red}{F} & \color{red}{8} & & \end{array}$$ Finally, we add the resulting 3 rows, carrying as appropriate, to find the product: $$\begin{array}{c@{\,},c@{\,},c@{\,},c@{\,},c@{\,}c} & & & 8 & 2 & A\\ & \times & & C & 7 & 3\\\hline & & \color{blue}{1} & \color{blue}{8} & \color{blue}{7} & \color{blue}{E}\\ & \color{blue}{3} & \color{blue}{9} & \color{blue}{2} & \color{blue}{6} & \\ \color{blue}{6} & \color{blue}{1} & \color{blue}{F} & \color{blue}{8} & & \\\hline \color{red}{6} & \color{red}{5} & \color{red}{A} & \color{red}{2} & \color{red}{D} & \color{red}{E} \end{array}$$ Again, we can confirm this is the correct answer by converting everything back to base 10: $$(82A)_{16} = 2090, \quad (C73)_{16} = 3187, \quad (65A2DE)_{16} = 6660830, \quad \textrm{ and}$$ $$2090 \times 3187 = 6660830$$

### Subtraction and Alternate Forms

As we think about how to generalize subtraction to work in other bases, we are reminded that sometimes, in our traditional base $10$, we need to "borrow" from the next digit when we subtract, in order that we generate only positive differences.

As an example, consider what happens when we get to the blue digits below when calculating the following difference:$\require{cancel}$ $$\begin{array}{c@{\quad},c@{\,},c@{\,}c} & 4 & 6 & \color{blue}{3} & 8 & 9\\ - & & 1 & \color{blue}{7} & 5 & 2\\\hline & & & \color{red}{?} & 3 & 7 \end{array} \quad \Longrightarrow \quad \begin{array}{c@{\quad},c@{\,},c@{\,}c} & & {\scriptsize 5} & & & \\[-1cm] & 4 & \cancel{6} & \color{blue}{{}^{1}3} & 8 & 9\\ - & & 1 & \color{blue}{7} & 5 & 2\\\hline & & & \color{red}{6} & 3 & 7 \end{array} \quad \Longrightarrow \quad \begin{array}{c@{\quad},c@{\,},c@{\,}c} & & {\scriptsize 5} & & & \\[-1cm] & 4 & \cancel{6} & {}^{1}3 & 8 & 9\\ - & & 1 & 7 & 5 & 2\\\hline & 4 & 4 & 6 & 3 & 7 \end{array}$$ As can be seen, we dropped the $6$ down to a $5$, allowing us to add $10$ to the $3$. Of course, lowering the $6$ to $5$ actually reduces the overall number by $100$, and adding $10$ to the $3$ actually raises the value of the overall number by $10$ tens, or $100$ -- for no net change.

This is the mirror to how dropping any digit by $10$ (which happens in the process of counting when we "cycle back" to zero after 10 successive increments) results in incrementing the digit to its left by one.

More generally, since any digit represents $10$ times the value of the digit to its immediate right, we can always drop a digit by $1$ and add $10$ to the digit on its right, with no change in the overall value.

Let that sink in for a minute...

Something important just happened!

We just gave ourselves an alternative way to write the same value! Drawing attention to where this happens in the work above, notice we equated the following two expressions: $$4 \;\; 6 \;\; 3 \;\; 8 \;\; 9 \;\; = \;\; 4 \;\; 5 \;\; {}^1 3 \;\; 8 \;\; 9$$

Do you see how the $13$ (drawn as ${}^1 3$ above) is playing the role of a "digit" in base $10$, despite not being in $\{0,1,2,\ldots,9\}$?

Now, imagine you're writing something like the above to share with a friend -- but you are doing so in a hurried manner, not paying careful attention to the spacing and positioning. Do you see the potential for your friend to confuse what you intended to write, (i.e., $4 \;\; 5 \;\; {}^1 3 \;\; 8 \;\; 9$) with $451389$ (notably a very different value)? Given this danger that we all could fall prey to, let us separate the "digits" with commas for clarity -- and wrap the entire digit string in subscripted parentheses as we have already seen. Restating the above with this slightly modified notation, we've equated the following: $$(4,6,3,8,9)_{10} = (4,5,13,8,9)_{10}$$

Strangely, keeping the digits between zero and one less than the base (which we traditionally insist upon) actually turns out not to be that important! We still get the same value, as can be seen below: $$\begin{array}{rcl} \color{red}{4} \cdot 10^4 + \color{red}{5} \cdot 10^3 + \color{red}{13} \cdot 10^2 + \color{red}{8} \cdot 10 + \color{red}{9} &=& 40000 + 5000 + 1300 + 80 + 9\\ &=& 46389 \end{array}$$

Not surprisingly, a similar operation can be used to rewrite any base $b$ value (for $b \ge 2$) by decrementing any digit, but then adding $b$ to the digit on its right, with no change in the overall value -- as long as we allow ourselves to have "digits" outside of $\{0,1,2,\ldots,(b-1)\}$.

This means of tranforming one "digit string" into another can actually provide many different representations of the same value. As an example, consider the base $8$ value $(3,6,7,2)_8$.

Decrementing the $6$ to $5$ yields $(\color{red}{3},\color{red}{5},\color{red}{15},\color{red}{2})_8$. (To keep things as simple as possible, notice that we are writing the red digits in base $10$. We will do the same thing for the blue, green, magenta, and orange digits coming up.)

Decrementing the resulting $5$ again then produces $(\color{blue}{3},\color{blue}{4},\color{blue}{23},\color{blue}{2})_8$.

Decrementing the $7$ in the original number, we produce $(\color{green}{3},\color{green}{6},\color{green}{6},\color{green}{10})_8$. All of these represent the same value, as the following calculations justify: $$\begin{array}{rcl} 3 \cdot 8^3 + 6 \cdot 8^2 + 7 \cdot 8 + 2 &=& 1978\\ \color{red}{3} \cdot 8^3 + \color{red}{5} \cdot 8^2 + \color{red}{15} \cdot 8 + \color{red}{2} &=& 1978\\ \color{blue}{3} \cdot 8^3 + \color{blue}{4} \cdot 8^2 + \color{blue}{23} \cdot 8 + \color{blue}{2} &=& 1978\\ \color{green}{3} \cdot 8^3 + \color{green}{6} \cdot 8^2 + \color{green}{6} \cdot 8 + \color{green}{10} &=& 1978 \end{array}$$

But wait! If we can always drop a digit in this way, must we not entertain the notion of "negative" digits? As an example -- in base $6$, shouldn't we have $(\color{magenta}{4},\color{magenta}{0},\color{magenta}{2},\color{magenta}{5})_6 = (\color{orange}{4},\color{orange}{-1},\color{orange}{10},\color{orange}{5})_6$?

Of course we must! This checks out just fine, as the following calculations confirm! $$\begin{array}{rcl} \color{magenta}{4} \cdot 6^3 + \color{magenta}{0} \cdot 6^2 + \color{magenta}{2} \cdot 6 + \color{magenta}{5} &=& 881\\ \color{orange}{4} \cdot 6^3 + \color{orange}{(-1)} \cdot 6^2 + \color{orange}{8} \cdot 6 + \color{orange}{5} &=& 881 \end{array}$$

That said, we shouldn't believe this to be a general rule based only on a few examples that seem to work. We need proof that this business of dropping a digit by $1$ coupled with increasing the digit to its right by the base $b$ results in no net change!

The proof, howevever, is almost immediate upon remembering the following property of real numbers:

The Distributive Property:   $x (y+z) = xy + xz$   and   $(y+z)x = yx + zx$,   for all real $x$, $y$, and $z$

Recall we said earlier that for any positive integer base $b \gt 1$, we can express the integer value $(d_n d_{n-1} d_{n-2} \ldots d_1 d_0)_b$ (for digits $d_i$) with the expression: $$d_n b^n + d_{n-1} b^{n-1} + d_{n-2} b^{n-2} + \cdots + d_1 b + d_0$$ Let us focus on any two adjacent digits, $d_{k+1}$ and $d_k$. Note that $$\begin{array}{rcl} d_{k+1}b^{k+1} + d_k b^k &=& (d_{k+1}-1+1) b^{k+1} + d_k b^k \quad \scriptsize{\textrm{adding a well-chosen value of 0}}\\ &=& (d_{k+1}-1)b^{k+1} + b^{k+1} + d_k b^k \quad \scriptsize{\textrm{using the distributive property}}\\ &=& (d_{k+1}-1)b^{k+1} + (b + d_k) b^k \quad \scriptsize{\textrm{using the distributive property again}} \end{array}$$ As such, we can be confident in replacing any such pair of adjacent digits $d_{k+1}$ and $d_k$ with $(d_{k+1}-1)$ and $(b+d_k)$ -- even when this results in "negative digits".

### Polynomial Functions

Admittedly, having the meaning of the word "digit" expanded to include things like $13$ -- which itself is made up of digits $1$ and $3$ -- seems odd. Perhaps we should use a different term -- maybe one that emphasizes how these individual digits work together to produce a similar result. Interestingly, the word coefficient, which in Latin means "cooperating to produce a result", seems to fit the bill nicely.

Also let us note that, a given digit string -- or should we say "coefficient string" -- can take on a lot of different values, depending on the base. One could even go so far as to say the value "is a function of" the base.

Using some (potentially unknown) $x$ as our base, and replacing the previously used $d_i$ factors previously used to denote "digits" with more generic-looking $a_k$ factors (since we are now calling these "coefficients"), we are interested in functions of the form $$f(x) = a_n x^n + a_{n-1} x^{n-1} + a_{n-2} x^{n-2} + \cdots + a_1 x + a_0$$ where each coefficient $a_k$ is some integer (notably including negative integers).

Perhaps related to the fact that we must name the many values of $a_k$ to pin down exactly how this function works, we call such functions polynomial functions with integer coefficients. Note polynomial comes from polys (Greek for "many") and nomen (Latin for "name").

We apply the expected abbreviations -- writing only $x^k$ when $a_k = 1$, or omitting the term $x^k$ entirely when $a_k=0$.

Notably, we restrict the exponents seen in the terms of a polynomial function to be non-negative integers. This is to draw out certain similarities between polynomial functions and integers that would be hard to see otherwise.

Also, as some additional verbiage, the expressions that define polynomial functions can be further categorized by the number of terms $a_k x^k$ they involve.

Polynomial expressions with only a single term like those below are called monomials: $$3x^2, \quad \quad-7x^5, \quad \quad 9$$ Polynomials of two terms like the following are instead called binomials: $$x^2 + 5x,\quad \quad -8x+1,\quad \quad x^{50}-x^{25}$$ Those with three terms are unsurprisingly called trinomials: $$x^2 + 7x + 12, \quad \quad x^3 - x + 5$$

### Polynomial Arithmetic

Recall the concatenation of braids, the composition of permutations and functions, and sums and products of real numbers are all examples of closed operations -- operations that combine two things of a particular type in a particular way that the result is also of that type.

Polynomial functions with integer coefficients are similarly "closed" under the operations of addition, subtraction, and multiplication.

This arises directly from the associativity and commutativity of real numbers under addition and multiplication, and the distributive property (more formally called the "distributive property of multiplication over addition", as it reveals one important way these two operations interact):

Let us demonstrate the closure of polynomials under addition with the following example:

Supppose $f(x) = 3x^4 - 5x^3 + x^2 -7x + 1$ and $g(x) = 6x^3 + 8x^2 + 7x +9$. Then $(f+g)$ is given by: $$\begin{array}{rcl} (f+g)(x) &=& (3x^4 - 5x^3 + x^2 -7x + 1) + (6x^3 - 8x^2 + 7x +11)\\ &=& 3x^4 + (-5x^3 + 6x^3) + (x^2 - 8x^2) + (-7x + 7x) + (1 + 11) \quad \scriptsize{\textrm{via associativity/commutativity}}\\ &=& 3x^4 + (-5+6)x^3 + (1-8)x^2 + (-7+7)x + 12 \quad \scriptsize{\textrm{via the distributive property}}\\ &=& 3x^4 + x^3 + 7x^2 + 12 \quad \scriptsize{\textrm{notably, this is another polynomial}} \end{array}$$

Subtraction follows similarly, upon realizing a couple of things:

• The trivial polynomial function $p(x) = 0$ serves as an additive identity for polynomials.

• Just like division is defined as multiplication by the multiplicative inverse, subtraction is defined as addition of the additive inverse. Related to this, the polynomial function $a_n x^n + a_{n-1} x^{n-1} + a_{n-2} x^{n-2} + \cdots a_1 x + a_0$, has additive inverse of $-a_n x^n - a_{n-1} x^{n-1} - a_{n-2} x^{n-2} - \cdots - a_1 x - a_0$

Thus, if $f(x) = 3x^4 - 5x^3 + x^2 -7x + 1$ and $g(x) = 6x^3 - 8x^2 + 7x +11$, the difference $(f-g)$ is given by: $$\begin{array}{rcl} (f-g)(x) &=& (3x^4 - 5x^3 + x^2 -7x + 1) - (6x^3 - 8x^2 + 7x +11)\\ &=& (3x^4 - 5x^3 + x^2 -7x + 1) + (-6x^3 + 8x^2 - 7x -11) \quad \scriptsize{\textrm{via the additive inverse}}\\ &=& 3x^4 + (-5x^3 - 6x^3) + (x^2 + 8x^2) + (-7x - 7x) + (1 - 11) \quad \scriptsize{\textrm{via associativity/commutativity}}\\ &=& 3x^4 + (-5-6)x^3 + (1+8)x^2 + (-7-7)x - 10 \quad \scriptsize{\textrm{via the distributive property}}\\ &=& 3x^4 - 11x^3 + 9x^2 -14x - 10 \quad \scriptsize{\textrm{notably, this is again another polynomial}} \end{array}$$

As a matter of common parlance, the act of re-ordering the terms so that powers of the same variable and with the same exponent are next to one another, with the intent of using the distributive property to simplify things (as happened in both examples above) is often referred to as "collecting like terms".

The closure of polynomials under multiplication is similarly demonstrated, although typically requires distributing a factor over more than two terms.

Note, as long as the distributive property on two terms (as previously stated) holds, we can easily generalize the property to more terms. Consider $(x + y + z)w =((x+y) + z)w = (x+y)w + zw = xw + yw + zw$. Distributing over 4 or more terms is argued similarly.

Consider how we can the product of polynomial functions $f$ and $g$ as another polynomial:

If $f(x) = x^2+3x-5$ and $g(x) = 2x^3-x+7$, then $$\begin{array}{rcl} (fg)(x) &=& (x^2+3x-5)(2x^3-x+7)\\ &=& (x^2+3x-5)(2x^3) + (x^2+3x-5)(-x) + (x^2+3x-5)(7)\\ &=& (2x^5 + 6x^4 -10x^3) + (-x^3-3x^2+5x) + (7x^2+21x-35)\\ &=& 2x^5 + 6x^4 + (-10x^3 -x^3) + (-3x^2 + 7x^2) + (5x+21x) -35\\ &=& 2x^5 + 6x^4 -11x^3 + 4x^2 + 26x - 35 \quad \scriptsize{\textrm{again, the result is a polynomial}} \end{array}$$

### Polynomial Arithmetic, Redux

The discussion of polynomials as extensions of integers written in different bases allows for another way to "mechanize" the arithmetic of polynomials.

Recall that the "borrowing" in subtraction is really just a mirror image of "carrying" as seen in addition and multiplication. Both serve only to ensure our answer ends up only with digits from $0,1,2,3,\ldots,(b-1)$ for numbers written in base $b$.

As we have seen however -- keeping our digits in this range is not terribly important. This is useful, as when doing arithmetic with polynomials, our base -- being a variable -- is essentially unknown. Without knowing the value of the base, how could we possibly know when to carry or how much to borrow? With that in mind, if carrying/borrowing is not terribly important, let's not do it!

Consider what happens when we do addition and subtraction without any carrying or borrowing. That is to say -- if in some column we exceed the base with our sum, so be it. If in some column the difference is negative, life goes on:

$$\begin{array}{ccccc} & 2 & 5 & 0 & 7\\ + & 3 & 8 & 5 & 9\\\hline & 5 & 13 & 5 & 16 \end{array} \quad \quad \begin{array}{ccccc} & 8 & 1 & 6 & 4\\ - & & 7 & 3 & 9\\\hline & 8 & -6 & 3 & -5 \end{array}$$

Now compare the above with the following two results done the "long way" -- as described earlier and involving "collecting like terms":

$$\begin{array}{rcl} (2x^3 + 5x^2 + 7) + (3x^3 + 8x^2 + 5x + 9) &=& (2x^3 + 3x^3) + (5x^2 + 8x^2) + 5x + (7 + 9)\\ &=& (2+3)x^3 + (5+8)x^2 + 5x + (7+9)\\ &=& 5x^3 + 13x^2 + 5x + 16 \end{array}$$ $$\begin{array}{rcl} (8x^3 + x^2 + 6x + 4) - (7x^2 + 3x + 9) &=& 8x^2 + x^2 + 6x + 4 - 7x^2 -3x - 9\\ &=& 8x^3 + (x^2 - 7x^2) + (6x - 3x) + (4 - 9)\\ &=& 8x^3 - 6x^2 + 3x - 5 \end{array}$$

Of course, to use this to find sums and differences of any two polynomials, we'll again need to make peace with "negative digits". For example, to find $(3x^4 - 5x^3 + x^2 -7x + 1) - (6x^3 - 8x^2 + 7x +11)$, we can write the following: $$\begin{array}{ccccc} & 3 & -5 & 1 & -7 & 1\\ - & & 6 & -8 & 7 & 11\\\hline & 3 & -11 & 9 & -14 & -10 \end{array} \quad \Longrightarrow \quad 3x^4 - 11x^3 + 9x^2 -14x -10$$

Here again, we could do this the "long way" and get the same answer: $$\begin{array}{rcl} (3x^4 - 5x^3 + x^2 -7x + 1) - (6x^3 - 8x^2 + 7x +11) &=& 3x^4 - 5x^3 + x^2 - 7x + 1 - 6x^3 + 8x^2 - 7x - 11\\ &=& 3x^4 + (-5x^3 - 6x^3) + (x^2 + 8x^2) + (-7x - 7x) + (1 - 11)\\ &=& 3x^4 -11x^3 + 9x^2 - 14x - 10 \end{array}$$

Multiplication can be done in a similar way, as evinced by the example below where we find the product $(2x^3 -x+7)(x^2 + 3x -5)$. Again, remember -- don't carry anything, just leave products or sums greater than the base as they are: $$\begin{array}{ccccc} & & 2 & 0 & -1 & 7\\ & \times & & 1 & 3 & -5\\\hline & & -10 & 0 & 5 & -35\\ & \phantom{1}6 & 0 & -3 & 21 &\\ 2 & \phantom{1}0 & -1 & 7 & &\\\hline 2 & \phantom{1}6 & -11 & 4 & 26 & -35 \end{array} \quad \Longrightarrow \quad 2x^5 + 6x^4 - 11x^3 + 4x^2 + 26x - 35$$ Compare the resulting polynomial above with the product of the same two polynomials found at the end of the last section. Yup, same thing!

### Polynomials (of one variable) behave a LOT like integers!

Recall we can add, subtract, and multiply any two integers together and get an integer back. Similarly, we have shown we can add, subtract, and multiply any two polynomials (of the same variable) together and get a polynomial of the same type back.

A moment's reflection should make it clear that the quotient of two polynomials is not always a polynomial. Consider the quotient of monomials $1$ and $x$: $$\frac{1}{x} = x^{-1}$$ and recall we said earlier this is restricted from being a polynomial given the presence of the negative exponent.

On the other hand, even though the quotient of two polynomials is not always a polynomial -- sometimes it will be. For example, one can quickly verify the product $$(x^3+2x-1)(x^2-5)=x^5-3x^3-x^2-10x+5$$ But this immediately tells us that (at least for some values of $x$): $$\frac{x^5-3x^3-x^2-10x+5}{x^3+2x-1} = x^2-5$$

Think how similar this is to integer division. The quotient of two integers need not be an integer (e.g., $\frac{1}{2}$), but it sometimes will be (e.g., $\frac{21}{7} = 3$).

When the quotient $\frac{b}{a}$ is an integer, we say $a$ is a factor of $b$. Indeed, a central result in the branch of mathematics known as number theory allows us to uniquely express every positive integer as the product of prime factors that themselves can't be broken down any further. We call this the prime factorization of an integer, and the process of identifying these primes as factoring. Proving this central result of number theory here would take us too far from our intended goal -- but one has to wonder: Is there something similar we could say for polynomial functions?

Also, remember the various sets of numbers of interest to us that we detailed earlier. The integers $\mathbb{Z}$ were one such set of interest, but the rationals $\mathbb{Q}$ were another, and even larger set -- one defined to be the set of all quotients of two integers. In a similar way, could we consider some superset of polynomial functions that contains all quotients of polynomials? Would this set behave anything like the rationals (i.e., fractions)?

We will explore these two avenues of investigation in the coming sections...

### Polynomials of Multiple Variables

Before we conclude this section however, let us consider one important generalization on the idea of a polynomial as expressed so far...

Recall that we introduced the notion of a polynomials (in one variable, like $x$) by considering the value of a base $x$ integer.

In this way, we essentially equated $a_n x^n + a_{n-1} x^{n-1} + \cdots + a_2 x^2 + a_1 x + a_0$ with $(a_n,a_{n-1},\ldots,a_2,a_1,a_0)_x$.

We saw that products of polynomials in the same variable could also be expressed as a polynomial of that same variable -- which parallels finding products of two values written in the same base. As an example, $$\begin{array}{rcl} (1,2,-3)_x \cdot (1,-4)_x &=& (x^2 + 2x - 3)(x-4)\\ &=& x^2(x-4) + 2x(x-4) -3(x-4)\\ &=& x^3 - 4x^2 + 2x^2 - 8x -3x + 12\\ &=& x^3 - 2x^2 - 11x + 12\\ &=& (1,-2,-11,12)_x \end{array}$$

This begs a question, however. What about products of polynomials in different variables -- and the associated products of two numbers written in different bases? For example, what can we say about something like the following $$(1,2,-3)_x \cdot (1,-4)_y$$ The specific product above (and any similar such product) is easy to find, given the distributive and other properties: $$\begin{array}{rcl} (1,2,-3)_x \cdot (1,-4)_y &=& (x^2 + 2x - 3)(y - 4)\\ &=& x^2(y-4) + 2x(y-4) -3(y-4)\\ &=& x^2y -4x^2 + 2xy - 8x - 3y + 12 \end{array}$$ Granted, in this case we can't easily rewrite the result as a number in some given base -- but notice the nature of the algebraic expression produced. Here, we end up with a sum of terms, where each term is the product of some coefficient and some number of powers of different variables. We call such an expression a polynomial of multiple variables.