## Efficient Algorithm for Exponentiation of Imaginary Number

Hassan Raza Khan1

(1) Hassan Raza Khan is a high-school student at The City School DHA Campus, Lahore.

## Introduction

Al-Khwarizmi (780-850), in his work Algebra, provided solutions to various types of quadratic equations, with geometric-based proofs. Under the caliph al-Ma’mun, al-Khwarizmi became a member of the House of Wisdom, an academy of scientists in Baghdad. This algebraic knowledge reached Italy through translations by Gerard of Cremona (1114-1187) and the work of Leonardo da Pisa (Fibonacci) (1170-1250).

Scipione del Ferro (d. 1526) solved the general cubic equation ${\displaystyle x^{3}+px+q=0}$. His formula, passed to Antonio Maria Fiore, initiated a mathematical contest against Tartaglia, who rediscovered the formula and won. Gerolamo Cardano, learning of this, signed an oath of secrecy and later published the formula in his Ars Magna (1545).

${\displaystyle x={\sqrt[{3}]{{\frac {q}{2}}+{\sqrt {\left({\frac {q}{2}}\right)^{2}+\left({\frac {p}{3}}\right)^{3}}}}}+{\sqrt[{3}]{{\frac {q}{2}}-{\sqrt {\left({\frac {q}{2}}\right)^{2}+\left({\frac {p}{3}}\right)^{3}}}}}}$

Rafael Bombelli (1526-1572) tackled cubic equations in l’Algebra (1572). He fully discussed the casus irreducibilis, demonstrating the expression ${\displaystyle x^{3}=15x+4}$ and Cardan's formula.

${\displaystyle x={\sqrt[{3}]{{\frac {q}{2}}+{\sqrt {\left({\frac {q}{2}}\right)^{2}+\left({\frac {p}{3}}\right)^{3}}}}}+{\sqrt[{3}]{{\frac {q}{2}}-{\sqrt {\left({\frac {q}{2}}\right)^{2}+\left({\frac {p}{3}}\right)^{3}}}}}}$

René Descartes (1596-1650), a philosopher, applied algebra to geometry in his work "La Géométrie," laying the foundations for Cartesian geometry (Descartes, 1637). Pressed by friends, he wrote the treatise "Discours de la méthode pour bien conduire sa raison et chercher la vérité dans les sciences" (1637), where he associated imaginary numbers with geometric impossibility. Descartes coined the term "imaginary," emphasizing the lack of a corresponding quantity for imagined roots (Descartes, 1637).

${\displaystyle z^{2}=az-b^{2}}$

John Wallis (1616-1703) noted in his "Algebra" that negative numbers, long viewed skeptically, have a physical explanation based on a line with a zero mark. He also made progress in giving a geometric interpretation to ${\displaystyle {\sqrt {-1}}}$ (Wallis, 1693).

Abraham de Moivre (1667-1754), seeking religious refuge in London, befriended Newton. In 1698, he mentioned Newton's knowledge of an equivalent expression to what is now known as de Moivre's theorem (Moivre, 1707).

${\displaystyle (\cos(\theta )+i\sin(\theta ))^{n}=\cos(n\theta )+i\sin(n\theta )}$

Leonhard Euler (1707-1783) introduced the notation ${\displaystyle i={\sqrt {-1}}}$. He visualized complex numbers as points with rectangular coordinates and explored the roots of ${\displaystyle z^{n}=1}$ as vertices of a regular polygon. Euler defined the complex exponential and proved the identity ${\displaystyle e^{i\theta }=\cos(\theta )+i\sin(\theta )}$ (Euler, 1748).

These historical works, spanning from Al-Khwarizmi to Gauss, reflect a collective focus on unraveling the complex number ${\displaystyle i={\sqrt {-1}}}$. Despite this rich history, a contemporary challenge persists—finding a quick and efficient method for computing the values of basic complex number exponents. Mathematics can always be simpler.

## The Problem

Say you want to find the value of i) ${\textstyle i^{8237918273}}$; ii) ${\textstyle i^{823718932}}$; iii) ${\textstyle i^{1291393767}}$; iv) ${\textstyle i^{812731274}}$;

and there are like 20 seconds left in the exam, and this paper does not allow calculators. You start solving it something like this:

 ${\displaystyle i^{8237918273}={\sqrt {-1}}\cdot {\sqrt {-1}}\cdot {\sqrt {-1}}\cdot {\sqrt {-1}}\cdot {\sqrt {-1}}\cdot {\sqrt {-1}}\cdot {\sqrt {-1}}\cdot {\sqrt {-1}}\ldots }$

and before you know it, the 20 seconds are over. You couldn't even answer any of the questions.

The student next to you, the class topper, recognizes that we can find the value of such a large number of ${\textstyle i}$ using polar coordinates, by using Euler's formula (Euler, 1748). He starts writing:

 ${\displaystyle e^{i\theta }=\cos(\theta )+i\sin(\theta {).}}$
 ${\displaystyle i=\cos \left({\frac {\pi }{2}}\right)+i\sin \left({\frac {\pi }{2}}\right)}$
 ${\displaystyle i^{n}=\left(\cos \left({\frac {\pi }{2}}\right)+i\sin \left({\frac {\pi }{2}}\right)\right)^{n}}$

He now starts using De Moivre's Theorem (Moivre, 1707) ${\textstyle n=8237918273}$

 ${\displaystyle i^{8237918273}=\cos \left(8237918273\times {\frac {\pi }{2}}\right)+i\sin \left(8237918273\times {\frac {\pi }{2}}\right)}$

By now, not only does he realize he needs a calculator to use sin and cos, but the proctor also marches down the aisle and snatches his paper. He could not even solve one of the 4 parts. None of the students was able to solve any part within less than 20 seconds. It was a shame considering how all 4 parts of this question could well be solved within less than 20 seconds using The Algorithm, and no working required.

## The Algorithm

The algorithm involves three steps:

1. Real/Imaginary number determination If the last two digits are even, the value remains unchanged (either 1 or -1). If odd, subtract 1 (resulting in either i or -i).
2. Division by 2 Divide the resultant number by 2.
3. Sign determination If the remaining number after division by 2 is odd, the sign is minus; if it's even, the sign is plus.

## Proving that only the last two digits are necessary

To demonstrate that only the last two digits are necessary for determining the value of ${\textstyle i^{n}}$, where ${\textstyle n}$ is a large exponent, we can take advantage the periodicity of powers of ${\textstyle i}$.

Consider the powers of ${\textstyle i}$ when raised to successive positive integer exponents:

 {\displaystyle {\begin{aligned}i^{1}&=i\\i^{2}&=-1\\i^{3}&=-i\\i^{4}&=1\\i^{5}&=i\\i^{6}&=-1\\i^{7}&=-i\\i^{8}&=1\\\vdots \end{aligned}}}

We can see that the powers of ${\textstyle i}$ repeat in cycles of four: ${\textstyle i,-1,-i,1}$. This periodicity implies that the value of ${\textstyle i^{n}}$ depends only on the remainder when ${\textstyle n}$ is divided by 4.

Now, let's consider the exponent ${\textstyle n=8237918273}$. We want to find ${\textstyle i^{n}}$:

 ${\displaystyle i^{8237918273}=i^{4k+r},}$

Consider ${\textstyle i^{8237918273}}$. We can express this as ${\textstyle i^{4k+r}}$, where ${\textstyle k}$ is an integer and ${\textstyle r}$ is the remainder when ${\textstyle 8237918273}$ is divided by ${\textstyle 4}$. In this case, ${\textstyle r=73}$.

Now, let's break down ${\textstyle i^{8237918273}}$ further:

 ${\displaystyle i^{8237918273}=i^{8237918200+73}.}$

Since ${\textstyle 8237918200}$ has two zeros and is divisible by 100, and since 100 is divisible by 4, we can deduce that ${\textstyle 8237918200}$ is divisible by 4.

Therefore, ${\textstyle i^{4k+r}=i^{8237918200+73}=i^{8237918200}\cdot i^{73}.}$

Now, ${\textstyle i^{8237918200}}$ simplifies to ${\textstyle 1}$ since any power of ${\textstyle i}$ with an exponent divisible by 4 is equal to 1. Therefore, we have:

 ${\displaystyle 1\cdot i^{73}=i^{73}.}$

So, basically, ${\textstyle i^{8237918273}}$ is congruent to ${\textstyle i^{73}}$. This demonstrates a general pattern: for any large exponent ${\textstyle n}$, ${\textstyle i^{n}}$ is congruent to ${\textstyle i^{r}}$, where ${\textstyle r}$ is the remainder when ${\textstyle n}$ is divided by 4. Thus, only the last two digits of the exponent (${\textstyle 73}$ in this case) are necessary for determining the value of ${\textstyle i^{n}}$.

This observation allows for a more efficient approach when dealing with large exponentiation of ${\textstyle i}$ without the need to calculate the entire exponent. The periodic nature of ${\textstyle i}$ simplifies the computation, making it feasible to focus solely on the last two digits of the exponent.

## Demonstrating the algorithm

The three-step algorithm can be used like so:

1. ${\textstyle i^{8237918273}}$;
1. Real/Imaginary number determination The last two digit is 73, an odd number. So it must be an imaginary number (either ${\textstyle i}$ or ${\textstyle -i}$). Since the number is odd, we subtract it by 1 to make it parallel to its even counterpart, resulting in 72.
2. Division by 2 Dividing 72 by 2 results in 36, an even number.
3. Sign determination Since the resultant number after division by 2 is even, we can establish that the sign of this number would be positive. Since the number is both imaginary and positive, it must be ${\textstyle i}$.
2. ${\textstyle i^{823718932}}$;
1. Real/Imaginary number determination The last two digit is 32, an even number. So it must be a real number (either 1 or -1). Since the number is even, we do not subtract it, so it remains 32.
2. Division by 2 Dividing 32 by 2 results in 16, an even number.
3. Sign determination Since the resultant number after division by 2 is even, we can establish that the sign of this number would be positive. Since the number is both real and positive, it must be 1.
3. ${\textstyle i^{1291393767}}$;
1. Real/Imaginary number determination The last two digit is 67, an odd number. So it must be an imaginary number (either ${\textstyle i}$ or ${\textstyle -i}$). Since the number is odd, we subtract it by 1 to make it parallel to its even counterpart, resulting in 66.
2. Division by 2 Dividing 66 by 2 results in 33, an odd number.
3. Sign determination Since the resultant number after division by 2 is odd, we can establish that the sign of this number would be negative. Since the number is both imaginary and negative, it must be ${\textstyle -i}$.
4. ${\textstyle i^{812731274}}$;
1. Real/Imaginary number determination The last two digit is 74, an even number. So it must be a real number (either 1 or -1). Since the number is even, we do not subtract it, so it remains 74.
2. Division by 2 Dividing 74 by 2 results in 37, an odd number.
3. Sign determination Since the resultant number after division by 2 is odd, we can establish that the sign of this number would be negative. Since the number is both real and negative, it must be ${\textstyle -1}$.

In Table 1, we present a matrix which shows the relationship between the final and initial numbers corresponding to different values of the complex unit ${\textstyle i}$. The table categorizes the initial and final numbers as either even or odd and the resulting values of ${\textstyle i}$ for each combination. This matrix is basically a summary of this entire concept of periodicity of ${\textstyle i}$ and its cyclic behavior based on the evenness or oddness of the exponents. Initial Number ${\textstyle N_{0}}$ is the raw form of the last two digits of the exponent of ${\textstyle i}$ , while Final Number ${\textstyle N_{f}}$ is the value of the last two digits of the exponent of ${\textstyle i}$ after being processed by the Algorithm (${\textstyle N_{f}={\frac {N_{0}}{2}}}$ if ${\textstyle N_{0}}$ is even, and ${\textstyle N_{f}={\frac {N_{0}-1}{2}}}$ if ${\textstyle N_{0}}$ is Odd)

 Initial Number ${\displaystyle N_{0}}$ Even Odd Final Number ${\displaystyle N_{f}}$ Even 1 ${\displaystyle i}$ Odd -1 ${\displaystyle -i}$

## Purpose of Odd/Even Analysis

The divisional remainder and its congruent complex number counterpart can be expressed as below:

 ${\displaystyle 1\equiv i{\pmod {4}}}$ ${\displaystyle 2\equiv -1{\pmod {4}}}$ ${\displaystyle 3\equiv -i{\pmod {4}}}$ ${\displaystyle 0\equiv 1{\pmod {4}}}$

The odd/even analysis serves is an approach that efficiently determine the divisional remainder of the numbers in the context of complex exponentiation. By focusing solely on the last two digits of the exponent, we can evaluate whether the number is divisible by 4.

For instance, consider an exponent with the last two digits being 32. If we divide 32 by 2, we obtain 16, an even number. This indicates that the original exponent is divisible by 2 twice, meaning it is divisible by 4. Therefore, the number is congruent to 0 modulo 4.

On the contrary, let's take another example with the last two digits being 34. If we divide 34 by 2, we get 17, an odd number. In this case, 34 can only be divided by 2 once while remaining a whole number. Consequently, it is congruent to 2 modulo 4.

The same approach is applied to odd numbers, where they are subtracted by 1 in order to align them with their even counterparts. This adjustment ensures that odd numbers maintain their distinctive properties in the modulo 4 arithmetic.

One could also add 1 instead of subtracting 1 from the odd number. However, by adopting the subtraction approach, the signs no longer become universally positive for even final numbers and negative for odd final numbers. That is why subtracting helps with the association of odd numbers with negative results and even numbers with positive results, making it a more straightforward interpretation of the outcomes.

## Acknowledgements

I want to express my sincere appreciation for the the support and encouragement I received from my friends, family, and teachers throughout the entire research process.

I extend my gratitude to the dedicated reviewers and editors at the Journal of Dawning Research for their insightful feedback, which played a crucial role in refining and improving my paper.

Lastly, I would like to express gratitude to Dr Javed Hussain from IBA Sukkur University for his expert guidance. As a high school student new to research papers, his assistance was invaluable. He not only helped me with the basics of research but also instilled in me the importance of intellectual curiosity and hard work.

### BIBLIOGRAPHY

Khan, H. R. (2023, October). Efficient Algorithm for Identifying Repeating Patterns Modulo 4 and its Application in Complex Numbers. Source

Merino, O. (2006, January). A Short History of Complex Numbers. University of Rhode Island.

Euler, L. (1748). Introductio in analysin infinitorum. Apud Marcum-Michaelem Bousquet & Socios.

De Moivre, A. (1730). Miscellanea Analytica de Seriebus et Quadraturis [Analytical Miscellany on Series and Integration].

Zhou, X. (2017). Number Theory - Modular Arithmetic: Math for Gifted Students. CreateSpace Independent Publishing Platform.

Halmos, P. (1980). The Heart of Mathematics. American Mathematical Monthly, 87, 519–524.

Nahin, P. (1998). An Imaginary Tale: The Story of ${\displaystyle {\sqrt {-1}}}$ New Jersey: Princeton University Press.

Mazur, Barry & Pesic, Peter & Sabbagh, Karl. (2004). "Imagining Numbers" (Particularly the Square Root of Minus Fifteen). The American Mathematical Monthly. 111. 75. 10.2307/4145034.

Needham, T. (1997). Visual Complex Analysis. New York: Oxford University Press.

Dunham, W. (1999). Euler, The Master of Us All, The Dolciani Mathematical Expositions, Number 22, Mathematical Association of America.

Argand, R. (Reprinted 1971). Essai sur une Maniere de Representer Les Quantites Imaginaires dans Les Constructions Geometriques. A. Blanchard.

Descartes, R. (1952). La Geometrie, translated from French and Latin by D. E. Smith and M. Latham. Open Court Publishing Company, La Salle, Illinois.

Crowe, M. (1967). A History of Vector Analysis. U. of Notre Dame Press, Notre Dame.

van der Waerden, B. L. (1985). A History of Algebra. Springer Verlag, NY.

Wallis, J. (1685). Treatise on Algebra.

Andreescu, T., & Andrica, D. (2007). Complex Numbers: An Introduction. Birkhäuser.

Andreescu, T., & Andrica, D. (2009). Complex Numbers from A to ...Z. Birkhäuser.

Richeson, D. S. (2008). Euler's Gem: The Polyhedron Formula and the Birth of Topology. Princeton University Press.

Boyer, C. B. (1968). A History of Mathematics. John Wiley & Sons.

Carr, V. (1996). Complex Numbers Made Simple. Elsevier Science. (Original work published 1996)

### Document information

Published on 19/12/23
Submitted on 15/11/23

Volume 5, 2023