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 b, which indicates the number that we exponentiate
  • an exponent p that indicates the intensity or amplitude of the change applied to the base b by the exponentiation operator

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

  • \text{pow}(b, p)
  • b^p
  • \overbrace{b*b*...*b*b}^{p \text{ times}}

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 \mathbb{N}, 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 b \in \mathbb{N} \wedge p \in \mathbb{N}. We also assume that if the base is zero, the exponent cannot be zero since that would lead to the form 0^0 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, 3*10^3
  • four times one hundred, 4*10^2
  • five times ten, 5*10^1
  • six, 6*10^0

The polynomial decomposition of 3456, according to the powers of ten, would then be 3456 = 3*10^3 + 4*10^2 + 5*10^1 + 6*10^0. Similarly, the number 789, as a second example, we can decompose into a polynomial of the powers of ten as 789 = 7*10^2 + 8*10^1 + 9*10^0. 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 789^2, then this is equivalent to calculating (7*10^2 + 8*10^1 + 9*10^0)^2 because the terms inside the bracket correspond to the original number. For this reason, we can also rewrite the previous expression as 789^2 = (7*10^2 + 8*10^1 + 9*10^0)*(7*10^2 + 8*10^1 + 9*10^0). If we then expand the brackets according to the rules for the multiplication of polynomials, we can rewrite it as:

(1)   \begin{equation*}$(7*10^2)*(7*10^2) + (7*10^2)*(8*10^1) + ... + (9*10^0)*(7*10^2) + (9*10^0)*(9*10^0)$\end{equation*}

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, (7*10^2)*(7*10^2), we will end up producing a product between a number and the fourth power of ten:

(2)   \begin{equation*}$(7*10^2)*(7*10^2) = 7*7*10^4$\end{equation*}

5. Unit Digit in Exponentiation of This Polynomial

Notice how 10^4 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 10^0:

(3)   \begin{equation*}$(9*10^0)*(9*10^0) = 9*9*10^0$\end{equation*}

Notice that, in this case, this is the only term that contains 10^0. 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 789^2, 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 9^2 = 81
  • 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 b^p, all we need to do is to:

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

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

7. Conclusion

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

Comments are closed on this article!