# Mathematics - Exponentiation (square, cube) - Power

## About

Exponentiation is a binary operation involving two numbers:

- the base (b)
^{1)} - the exponent (n) (or index or power).

<MATH> base^{exponent} = b^n = b_1 \times b_2 \times \dots \times b_n </MATH>

## Example

<MATH> 2^3 = 2 \times 2 \times 2 = 8 </MATH>

## Text

In text notation or computer language, generally the exponentiation operator is noted ^

`2^3 = 2 . 2 . 2 = 8`

## Usage

### Permutation

The exponentiation is the formula to calculate the number of possible permutation (with repetition) in a set.

For instance, if you have a set of 3 elements {1,2,3}, if you can draw 2 elements, you have the following 9 possible selections (permutation):

- 1 1
- 1 2
- 1 3
- 2 1
- 2 2
- 2 3
- 3 1
- 3 2
- 3 3

that you can express with an exponentiation <MATH> 9 = 3^2 = b^n </MATH> because for each draw n, you have b choices. <MATH> b_1 \times b_2 \times \dots \times b_n = b^n </MATH>

### Base Calculation

You can even generalize the permutation calculation to base calculation (that's why b is called the base)

For instance, in a set of 10 digits { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 }, if you can draw 2 numbers, you will have 100 possibilities (permutation). <MATH> b^n = 10^2 = 100 </MATH>

Note that:

- a set of 10 digits in mathematics is also known as the base 10 used in the decimal system
- 100 is the maximal number that you can get with the digits (ie 99+0)

therefore the exponentiation gives you also the maximum number in any base for any length.

For instance, in base 2 (binary) with 8 digits (octet/byte), the maximum (decimal) number is <MATH> b^n = 2^8 = 256 </MATH> You can then translate any base into decimal. For instance, to translate the binary string 10101 into decimal: <MATH> 10101 = 1 \times \text{max of 4 digits} + 1 \times \text{max of 2 digits} + 1 \times \text{max of 0 digits} = 1 \times 2^4 + 1 \times 2^2 + 1 \times 2^0 = 16 + 4 + 1 = 21 </MATH>

## Pronunciation

The exponentiation <math>b^n</math> can be read as:

- b raised to the n-th power,
- b raised to the power of n,
- b raised by the exponent of n,
- most briefly as b to the n.

Example: The Exponent raises the first number, the base, to the power of the second number, the exponent.

Some exponents have their own pronunciation.

### Squared

<math>b^2</math> is usually read as b squared.

See Mathematics - Square (Quadratus)

### Cubed

<math>b^3</math> is usually read as b cubed.

Cubing a number is the same as raising it to the third power.

## Law

<MATH>base^a * base^b = base^{a+b}</MATH>

## When the exponent (n) is

### a positive integer

When the exponent (n) is a positive integer, exponentiation corresponds to repeated multiplication.

<MATH> b^n = \underbrace{b \times \dots \times b}_{n} </MATH>

It's a product of n factors, each of which is equal to b (the product itself can also be called power):

### even

The exponents of a product are all even, the product is a perfect square.

Example: <math> 2^2*3^6 = (2*3^2)^2 </math>

## Inverse

- With the below exponentiation

<MATH> b^n = a </MATH>

<MATH> b = \sqrt[n]{a} </MATH>

- While the logarithm permits to get the exponent,

<MATH> n = log_b(a) </MATH>

## Javascript

`Array(8).fill().map((element,index) => console.log(`2 pow ${index} is ${Math.pow(2,index)}`));`

## Documentation / Reference

^{1)}