1.5 Mathematical aside: Taylor expansion
In this section we see how to approximate functions by polynomials. This will be useful when we search for the asymptotic distribution of the MLE.
We would like to approximate a function \(f(x)\) by a polynomial \(p(x)\) of degree \(n\), around a point \(x_0\). That is, if \(x\approx x_0\) we would like \(f(x)\approx p(x)\). How should we choose \(p(x)\)?
Let us write \[ p(x) = c_0 + c_1(x-x_0) + c_2(x-x_0)^2 + \cdots + c_n(x-x_0)^n. \] To ensure that \(f(x)\approx p(x)\) close to \(x_0\), we first require that \[ f(x_0)=p(x_0)=c_0, \] so that we have found the first parameter. To make the approximation better, we further require that the first derivatives are the same at \(x_0\), \[ f'(x_0) = p'(x_0) = c_1 + 2c_2(x-x_0) + 3c_3(x-x_0)^2+\cdots + nc_n(x-x_0)^{n-1}|_{x=x_0} = c_1, \] and so the second parameter of \(p(x)\) has been determined.
Continuing, we want \[ f''(x_0) = p''(x_0) = 2c_2 + 2\cdot 3c_3(x-x_0) + 3\cdot 4c_4(x-x_0)^2 + \cdot (n-1)nc_n(x-x_0)^{n-2}|_{x=x_0} = 2c_2, \] so that \(c_2 = f''(x_0)/2\). For the \(k\)th derivative, \[ f^{(k)}(x_0) = p^{(k)}(x_0) = 2\cdot 3\cdots kc_k = k!c_k, \] so that \(c_k = f^{(k)}(x_0)/k!\).
To summarize, the order \(n\) polynomial approximation of \(f(x)\) close to \(x_0\) is \[ f(x) \approx f(x_0) + f'(x_0)(x-x_0) + \frac{f''(x_0)}{2!}(x-x_0)^2 + \cdots \frac{f^{(n)}(x_0)}{n!}(x-x_0)^n. \] This is known as a Taylor series.
In fact, we can do even better by giving a formula for the error. Taylor’s theorem says thatAs an example, let us consider the approximation of \(\ln x\) around 1. We begin by calculating the derivatives,
\[\begin{align} \ln 1 &= 0 ,\\ \partial_x\ln x|_{x=1} &= \frac{1}{x}|_{x=1} = 1 \\ \partial_x^2 \ln x|_{x=1} &= -\frac{1}{x^2}|_{x=1} = -1,\\ \partial_x^3 \ln x|_{x=1} &= \frac{2}{x^3}|_{x=1} = 2. \end{align}\]
Therefore the 3rd order polynomial approximation of \(\ln x\) is \[ \ln x \approx (x-1) - \frac{1}{2}(x-1)^2 + \frac{1}{3}(x-1)^3. \]
Figure 1.6: Taylor series approximation of ln x