1. Introduction

In this tutorial, we’ll study how to compute the unit digit in an exponentiation operation.

2. Raising to a Power

The operation of exponentiation or “raising to a power” is a non-commutative binary operation that affects two numbers:

• a base , which indicates the number that we exponentiate
• an exponent that indicates the intensity or amplitude of the change applied to the base by the exponentiation operator

We can indicate the operation of exponentiation of by , alternatively as:

The first of these three methods is common in programming languages such as Java or Kotlin. The second is the one most frequently used in mathematics. At the same time, the last one emphasizes the underlying nature of the operation. In fact, we can always write any exponentiation as a repeated multiplication of the base with itself, with the multiplication happening as many times as indicated by the exponent.

While the operation of exponentiation is defined for larger sets than , for the rest of this article, we’ll only treat cases where both the base and the exponent are natural numbers. Thus, we always assume that . We also assume that if the base is zero, the exponent cannot be zero since that would lead to the form that can be interpreted differently according to the context.

3. Polynomial Decomposition of a Number

First, we must consider an alternative way to express a natural number. When we work in base 10, we can always express any number as the sum of products between the powers of 10 and the unit digits. Let us take, as an example, the number 3456 in base ten. We can express it as:

• three times one thousand,
• four times one hundred,
• five times ten,
• six,

The polynomial decomposition of 3456, according to the powers of ten, would then be . Similarly, the number 789, as a second example, we can decompose into a polynomial of the powers of ten as . More generally, we can express any number in any numerical base as a polynomial of the powers of that base multiplied by some coefficients.

4. Exponentiation of a Polynomial

Let’s think of a number as a polynomial of the numerical base and its powers. We can then think of exponentiation of that number as the operation of raising that polynomial to some power. If, for example, we are calculating , then this is equivalent to calculating because the terms inside the bracket correspond to the original number. For this reason, we can also rewrite the previous expression as . If we then expand the brackets according to the rules for the multiplication of polynomials, we can rewrite it as:

(1)

In doing so, we can now notice how, if we multiply all of the terms within each pair of monomials, we will always obtain a new monomial that is at least as high, in degree, as the greatest degree of the monomials being multiplied. If, for example, we want to multiply the first pair of monomials, , we will end up producing a product between a number and the fourth power of ten:

(2)

5. Unit Digit in Exponentiation of This Polynomial

Notice how has a greater degree (i.e., a greater exponent) than each of the monomials being multiplied. If we instead multiply the last pair of monomials, sorted in decreasing order of degree, we will produce a product between some numbers and :

(3)

Notice that, in this case, this is the only term that contains . And here is an important insight that we can formulate: for any exponentiation of any base to any power, the only monomials that affect the value of the unit digit of the resulting power are those corresponding to the unit digit of the base number. For this reason, if we wanted to express the final result of the polynomial multiplication as a whole number, its unit digit would be the one that corresponds to the unit digit of this last multiplication (and, therefore, of the exponentiation).

Therefore, if all we had wanted to know was the last digit of the power , we could have:

• taken the last digit of the base 789, in this case, the digit 9
• exponentiated the digit 9 to the power, in this case by calculating
• selected the last digit of the result, in this case, 1, and considered that as the last digit of the exponentiation of the original base 789

Since, by constructing the problem, we aren’t interested in any other digit other than the last one, this procedure is sufficient to solve the task at hand.

6. Unit Digit in Exponentiation in General

More generally, if we want to obtain the unit digit of a number , all we need to do is to:

• select the last digit of
• raise that last digit to the power
• select the last digit of the resulting number

This latter digit will then be the unit digit of the base raised to the power of .

7. Conclusion

In this article, we studied how to compute the unit digit in exponentiation.