# Understanding Taylor Approximations

I am curious about what quantity a Taylor approximation actually optimizes, when it produces, as they say, the "best" possible nth-degree approximation of a function around the given x-value. Oftentimes graphs make the matter obvious, but given, i.e., $f(x) = (sech\ 9x)^4$, the second-degree Maclaurin approximation actually appears to be more accurate than the fourth-degree Maclaurin approximation, as shown in the images (red is $f(x)$, black is Maclaurin).

If asked to write an algorithm to assess the relative quality of two candidate approximations of some function around some x-value, my initial idea would be to integrate between each candidate and the function, using bounds close to the given x-value, and choose the candidate which yields less area. However, this raises the question of how far away from the given x-value counts as close.

The only metric I'm aware of that objectively captures the idea of being "close to" or "far from" the given x-value is the radius of convergence. However, it's not obvious to me that using the interval of convergence as integration bounds would be justified, and as this metric is viewed as emerging from the full Taylor series, invoking it to explain the decision mechanism behind constituent, finite Taylor approximations might involve circular reasoning.

This idea of defining "close" supposedly explains the counterintuitive phenomenon in the images as well; we're looking "close" to the origin, but if we would look "even closer," then the fourth-degree Maclaurin approximation would outperform the second-degree Maclaurin approximation.

So how close matters? Is there some sort of weighting scheme where the closer a point is to the given x-value, the more valuable its contribution is to the overall quality of the approximation? Does only the closest possible outlook matter at all, so that candidate Maclaurin approximation $p(x)$ would be selected over candidate Maclaurin approximation $q(x)$, even if all three functions are equal at $x = 0$, $q(x)$ better approximates $f(x)$ at every other $x$ in $\mathbb{R}$, but $p(x)$ better approximates $f(x)$ at $x = ±\epsilon$, where $\epsilon$ is some infinitesimally small value in *$\mathbb{R}$? Is the idea of integrating between the candidate approximations and the function hypothetically relevant at all?

If $P_{n}(x)$ is the $n$th order Taylor polynomial approximation to $f(x)$ at $x_0$, then $$f(x) = P_n(x) + o(\|x - x_0\|^n) \quad \text{as } x \to x_0.$$ Moreover, it can be shown that if any other polynomial $p(x)$ of degree less than or equal to $n$ has this property, then $p(x) = P_n(x)$. Thus, $P_n(x)$ is the "best" polynomial approximation of $f$ near $x_0$ of degree at most $n$.