Sunday, 12 March 2017

Power Towers and Tetration

How is an expression like \(2^{{{2}^{2}}^{0}}\) evaluated? Such an expression is often termed a power tower and the convention is that the evaluation takes place from the top down so we have:

\(2^{{2}^{1}}=2^2=4\)

I saw this question posed in Quora and it evoked hundreds of responses.

The term used in this context is tetration which Wikipedia explains as follows:
In mathematics, tetration (or hyper-4) is the next hyper-operation after exponentiation, and is defined as iterated exponentiation. The word was coined by Reuben Louis Goodstein, from tetra-(four) and iteration. Tetration is used for the notation of very large numbers.  
The notation \({^{n}a}\) means \({a^{a^{\cdot^{\cdot^{a}}}}}\), the application of exponentiation \(n-1\) times.
Shown below are the first four hyperoperations, with tetration as the fourth:

Addition
\(a + n = a + \underbrace{1 + 1 + \cdots + 1}_n\)
\(n\) copies of 1 added to \(a\).

Multiplication
\(a \times n = \underbrace{a + a + \cdots + a}_n\)
\(n\) copies of \(a\) combined by addition.

Exponentiation
\(a^n = \underbrace{a \times a \times \cdots \times a}_n\)
\(n\) copies of \(a\) combined by multiplication.

Tetration
\({^{n}a} = \underbrace{a^{a^{\cdot^{\cdot^{a}}}}}_n\)
\(n\) copies of \(a\) combined by exponentiation, right-to-left.

Here is a proper definition:

For any positive real number \(a>0\) and non-negative integer \(n \ge 0 \), we define \(\,\! {^{n}a} \) by:$${^{n}a} := \begin{cases} 1 &\text{if }n=0 \\ a^{\left[^{(n-1)}a\right]} &\text{if }n>0 \end{cases} $$As we can see from the definition, when evaluating tetration expressed as an "exponentiation tower", the exponentiation is done at the deepest level first (in the notation, at the highest level). For example:$$\,\!\ ^{4}2 = 2^{2^{2^2}} = 2^{\left[2^{\left(2^2\right)}\right]} = 2^{\left(2^4\right)} = 2^{16} = 65,\!536$$Note that exponentiation is not associative, so evaluating the expression in the other order will lead to a different answer:$$\,\! 2^{2^{2^2}} \ne \left[{\left(2^2\right)}^2\right]^2 = 2^{2 \cdot 2 \cdot2} = 256$$Exponential towers must be evaluated from top to bottom (or right to left). Computer programmers refer to this choice as right-associative.

Source: https://en.wikipedia.org/wiki/Tetration 

Note: there's nothing very original about this post. I've copied the rather involved LaTeX code from the Wikipedia editing page, modified it by getting rid of the maths arrow brackets and replaced them with \( signs. I was mainly interested to see how the LaTeX would convert and as it turned out the transfer from Wikipedia to Blogger was quite straightforward.

Thursday, 2 March 2017

The Gaussian Integral

By way of revising some earlier topics that I've covered and of practising my LaTeX skills, I'm covering the evaluation of the Gaussian Integral: $$ \int_{-\infty}^\infty e^{-x^2} \mathrm{d}x$$ $$ \text{Let } I= \int_{-\infty}^\infty e^{-x^2} \mathrm{d}x \,
\text{ and }  \,I= \int_{-\infty}^\infty e^{-y^2} \mathrm{d}y$$ $$ \text{Then } I^2=\displaystyle \int_{-\infty}^\infty \int_{-\infty}^\infty e^{-(x^2+y^2)} \mathrm{d}x \,\mathrm{d}y$$ Changing to polar coordinates requires use of the Jacobian \(r\), treated after the evaluation of the integral: $$I^2= \int_0^\infty re^{-r^2} \mathrm{d}r \int_0^{2 \pi} \mathrm{d}\theta$$ $$I^2= 2\pi\int_0^\infty  r \, e^{-r^2} \mathrm{d}r$$ $$I^2= 2 \pi\, \left[ - \frac{1}{2} \, e^{-r^2} \right ]_0 ^ \infty=\pi $$ $$ \text{Therefore }I=\sqrt{\pi} \, \text{ and } \, \int_{-\infty}^\infty e^{-x^2} \mathrm{d}x=\sqrt{\pi}$$Now, about the Jacobian, let's suppose that \( x \) and \( y \) are functions of both \(u\) and \(v \), that is \( x=g(u,v) \) and \( y=h(u,v) \). The Jacobian is defined as: $$
\begin{equation}
\frac{\partial (x,y)}{\partial (u,v)} =
\left|
\begin{array}{cc}
\dfrac{\partial x}{\partial u}& \dfrac{\partial x}{\partial v} \\
\dfrac{\partial y}{\partial u}& \dfrac{\partial y}{\partial v} \\
\end{array}
\right|
\end{equation}$$ Let's work with the specific change from rectangular to polar coordinates that is used in the solution to the Gaussian Integral.

We have \(x=r \cos \theta \) and \(y=r \sin \theta\)

This means that \( \dfrac{\partial x}{\partial r}=\cos \theta \) and \( \dfrac{\partial x}{\partial \theta}=-r \sin \theta \)
Also \( \dfrac{\partial y}{\partial r}=\sin \theta \) and \( \dfrac{\partial y}{\partial \theta}=r \cos \theta \). Thus: $$
\begin{equation}
\frac{\partial (x,y)}{\partial (r,\theta)} =
\left|
\begin{array}{cc}
\cos \theta & -r \sin \theta \\
\sin \theta  &r \cos \theta\\
\end{array}
\right|
\end{equation}$$ The determinant evaluates to \(r \cos^2 \theta + r \sin^2 \theta=r \) (the value of the Jacobian).

The Gaussian Integral is closely connected with the normal distribution via the probability density function \( \phi (x)=\dfrac{1}{\sqrt{2 \pi}}e^{-\frac{1}{2}x^2} \), where $$\int_{-\infty} ^\infty \phi(x) \mathrm{d}x=\dfrac{1}{\sqrt{2 \pi}}\int_{-\infty} ^\infty e^{-\frac{1}{2}x^2} \mathrm{d}x =1$$ Wikipedia states that "in statistics one often uses the related error function, or \( \text{erf}(x) \), defined as the probability of a random variable with normal distribution of mean 0 and variance 1/2 falling in the range \( [-x,x] \)"; that is: $$\text{erf}(x)=\dfrac{1}{\sqrt{\pi}}\int_{-x}^x e^{-t^2} \mathrm{d}t$$Here is an informative video which explains why \( \pi \) appears as the evaluation of the integral. It also explains how the double integral used to evaluate the integral is two dimensional and is finding the volume under a surface. By using the shell method to evaluate the integral, the need for the Jacobian is avoided: