# Real Analysis/Taylor Polynomials

A very solid introductory topic that makes use of sequences and series is the Taylor Series. In this portion, we will cover the Taylor Polynomial, which provides most of the explanations on the behavior of the Taylor Series. A general way to remember the difference is that a Taylor Polynomial is a finite approximation at an interval and the Taylor Series is an infinite representation at an interval. It is important to catch how Taylor Polynomials and Taylor Series are only accurate up around a certain interval. We will explain why in the headings below, but without further ado, the Taylor Polynomial.
This page will only cover Taylor Polynomials. The Taylor Series is covered on a separate page to mirror the similar division between infinite series and finite sequences. However, this page explains the properties better as Taylor Series are an extreme end of a Taylor Polynomial.

## Definition

Given a natural number $n$, a function $f$ that is $n$ degree differentiable, and a number $a$ who $f^{(k)}(a)$ outputs a valid number, a Taylor Polynomial of degree $n$ for $f$ at $a$ is defined as a summation of the sequence
    $a_{k}={\frac {f^{(k)}(a)}{k!}}(x-a)^{k}$
The Taylor polynomial, in summation form, is expressed as
    $P_{n,a,f}={\frac {f(a)}{0!}}+{\frac {f'(a)}{1!}}(x-a)+{\frac {f''(a)}{2!}}(x-a)^{2}+\cdots +{\frac {f^{(n)}(a)}{n!}}(x-a)^{n}$
and expressed in big sigma form as
    $P_{n,a,f}=\sum _{k=0}^{n}{{\frac {f^{(k)}(a)}{k!}}(x-a)^{k}}$
Written as $P_{n,a,f}$, the function $f$ is often dropped if it can be inferred through context.
This definition, expressed as is, will not offer a background on where it comes from. However, its properties will deliver stunning effects for what is essentially a summation of power functions with very specific multiples. Alternatively, we will also mention these following definitions a little ahead of our theorems. These will be important later.
Given a natural number $n$, a function $f$ that is $n$ degree differentiable, and a number $a$ who $f^{(k)}(a)$ outputs a valid number, a Remainder Term of degree $n$ for $f$ at $a$ is defined as a function such that the property
    $f=P_{n,a,f}+R_{n,a,f}$
holds.
Written as $R_{n,a,f}$, the function $f$ is often, even more so than $P_{n,a,f}$, dropped if it can be inferred through context.
Given a natural number $n$, two functions $f$ and $g$ to compare, and a number $a$, the functions $f$ and $g$ are equal up to order $n$ at $a$ when
    $\lim _{x\rightarrow a}{\frac {f-g}{(x-a)^{n}}}=0$
is valid.
Of course, these definitions are difficult to use or make sense of unless some context, in the form of properties given through using theorems, are given. The rest of this section will offer just that; it will prove to you why the Taylor Polynomials work the way they do as estimation tools.

## Properties
### Basic Properties

The first property we will mention will be a short list of tidbits. Merely note the following:

#### $P_{n,a,f}(a)=f(a)$ no matter what value of $n$ or function is used.

    This means that the Taylor polynomial will always estimate the value at a perfectly.

#### $P_{n,a,f}(a)$ is a polynomial.

    Remember that a polynomial is defined as a sequence of real number values $\{a_{n}\}$ such that $P=a_{n}x^{n}+\cdots +a_{1}x+a_{0}$, which of course can have its input values shifted by some value $a$, forming $P=a_{n}(x-a)^{n}+\cdots +a_{1}(x-a)+a_{0}$

### Uniqueness Property

Of course, it is important for a certain mathematical class to be unique. Taylor polynomials are no exception. However, as you will see in this theorem, we will need to further categorize the a Taylor polynomial in order to do so. Not surprisingly, these more specialized forms will be what we will study. After all, uniqueness is a niffy concept to start the journey of higher mathematics with.
We will prod you further by noting that this theorem is split into two parts. This first half will deal with a very general case of simply two polynomials. The next theorem will deal with Taylor polynomials specifically by modifying this theorem slightly whilst justifying itself anyway.
* If there exists two polynomials $P$ and $Q$, written in $(x-a)$ form, such that $\deg(P)\leq n\land \deg(Q)\leq n$—their degrees are both less than or equal to some natural number $n$—and they are both equal up to order $n$ at $a$, then $P=Q$
* The theorem from (1.) proves uniqueness by substituting the polynomials $P$ and $Q$ from the theorem with a polynomial $P$ that is also n-times differentiable and the Taylor polynomial $P_{n,a,f}$.
Summary: To prove this directly, we will take the claim that both polynomials are equal up to order $n$ at $a$. Then, we will use a few properties to wrest out that in order for those two polynomials to be equal up to order $n$ at $a$, they had to cancel out entirely after subtraction, implying that they're equal.
Also note that this theorem is very closely related to the next theorem. Although the next theorem technically cannot be used for this theorem because the function $f$, the one that the Taylor polynomial derives from, may not be a polynomial, we will show in the next theorem that this problem can be easily overlooked in this specific instance.

#### Proof

To begin, we know that these two polynomials are equal up to order $n$ at $a$. That means that the criterion definition of that can be our starting point. We also know that since they are two polynomials written in the form $P=a_{n}(x-a)^{n}+\cdots +a_{1}(x-a)+a_{0}$, the difference of the polynomials $P$ and $Q$ will also be of the form $a_{n}(x-a)^{n}+\cdots +a_{1}(x-a)+a_{0}$, albeit with differing $a_{n}$ values.
    $\lim _{x\rightarrow a}{\frac {P-Q}{(x-a)^{n}}}=0\implies \lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{1}(x-a)+a_{0}}{(x-a)^{n}}}=0$
    Given some set of real numbers $\{a_{n}\}$.
Now, an easy way to verify a rational function's limit like this as equaling 0 is to know whether the numerator equals 0. In this case, we know that if a limit of a rational function equals 0, then a rational function with a denominator of a lower degree is also valid, all the way to degree 0, is valid.
    $\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{1}(x-a)+a_{0}}{(x-a)^{n}}}=0\implies$
    $\left[\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{0}}{(x-a)^{0}}}=0\right]\land \left[\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{0}}{(x-a)^{1}}}=0\right]\land \left[\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{0}}{(x-a)^{2}}}=0\right]\land \cdots \land \left[\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{0}}{(x-a)^{n}}}=0\right]$
Taking a look at the first statement to check (the one with the 0 degree denominator that effectively equals 1), we note that in order for the limit to equal 0, which is given to be true in our assumptions, we can distribute the limit across every term in the polynomial, creating a string of 0s and leaving out the constant $a_{0}$ term. Since the limit as a whole must equal 0, the $a_{0}$ variable must equal 0. For the next statement, we see that even with the $(x-a)$ denominator, we can in fact cancel it out using every term in the polynomial above, since $a_{0}=0$, and evaluate the limit over the numerator which still does not affect the next new constant term, $a_{1}$. This variable now assumes the value 0 too. Analyzing the next statement, we can effectively do the same thing. Substitute the variables we have the values of, cancel out the denominator, then declare that the next element in the sequence is 0.
    $(1{\text{st}})\;\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{0}}{(x-a)^{0}}}=\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{0}}{1}}=\lim _{x\rightarrow a}{a_{n}(x-a)^{n}+\cdots +a_{0}}=0+0+\cdots +a_{0}=0\implies a_{0}=0$
    $(2{\text{nd}})\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{0}}{(x-a)^{1}}}=\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{1}(x-a)+0}{(x-a)}}=\lim _{x\rightarrow a}{a_{n}(x-a)^{n-1}+\cdots +a_{1}}=0+0+\cdots +a_{1}=0\implies a_{1}=0$
    $(3{\text{rd}})\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{0}}{(x-a)^{2}}}=\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{1}(x-a)^{2}+0(x-a)+0}{(x-a)^{2}}}=\lim _{x\rightarrow a}{a_{n}(x-a)^{n-1}+\cdots +a_{2}}=0+0+\cdots +a_{2}=0\implies a_{2}=0$
Iteratively doing this, we soon discover that every coefficient of each term of the polynomial is 0. This implies that the difference between the two polynomials $P$ and $Q$ must be 0, which we know will only be true if they were the same polynomial to begin with. QED.
    $(\cdots )$
    $(n{\text{th}})\lim _{x\rightarrow a}{\frac {a_{n}(x-a)^{n}+\cdots +a_{1}(x-a)+a_{0}}{(x-a)^{n}}}=\lim _{x\rightarrow a}{\frac {0}{(x-a)^{n}}}\implies$
    $P-Q=0\implies P=Q$
$\blacksquare$
Part 2 is shown using the next theorem.

### Best Power Approximate Theorem

Continuing from the previous theorem, we will provide a concrete method to show how the structure of the first theorem can be co-opted for a general function $f$ and a Taylor polynomial $P_{n,a,f}$. The theorem can be interpreted to mean that the Taylor polynomial is better at approximating the function $f$ than any power function of the degree $n$ or below. Mathematically speaking,
If a function is a valid Taylor Polynomial $P_{n,a,f}$, then it must be equal up to order $n$ at $a$; $\lim _{x\rightarrow a}{\frac {f-P_{n,a,f}}{(x-a)^{n}}}=0$
Summary: To prove this directly, we will rewrite this in a format that is friendly to repeated uses of l'Hôpital's Rule, remembering that a power function is infinitely differentiable and the first few properties of a Taylor Polynomial mentioned above to one's benefit.

#### Proof

First, we will find a way to re-express the problem. We know that the last term of a Taylor Polynomial contains the power function represented in the denominator. Including the fact that a Taylor Polynomial is a summation, we can remove one term from the summation and rewrite the expression so that we will have a free term hanging out as so.
    $\lim _{x\rightarrow a}{\frac {f-P_{n,a,f}}{(x-a)^{n}}}=\lim _{x\rightarrow a}{{\frac {f-P_{n-1,a,f}}{(x-a)^{n}}}-{\frac {f^{(n)}}{n!}}}=0$
Since we can distribute a limit across subtraction (we are implicitly assuming that both terms in the limit are valid numbers, as the equation suggests they will), we will do just that. Note that since a Taylor Polynomial is continuous, we can compute the limit easily through a mere variable swap.
    $\lim _{x\rightarrow a}{{\frac {f-P_{n-1,a,f}}{(x-a)^{n}}}-{\frac {f^{(n)}}{n!}}}=0\implies \lim _{x\rightarrow a}{\frac {f-P_{n-1,a,f}}{(x-a)^{n}}}={\frac {f^{(n)}(a)}{n!}}$
We will assess whether the equation is indeed equal to each other by taking a look at the limit statement on the left of the equation. Aiming for fulfilling the criteria for l'Hôpital's Rule, we will test whether the limit of the numerator and the limit of the denominator are both equal to a matching pair of infinity or 0. The denominator, a power function, is a valid continuous function. Thus, the limit can simply swap out the $x$ input variable and computed to equal 0. The numerator's first term, $f$, is continuous as a consequence of being n-degree differentiable. The numerator's second term, $P_{n-1,a,f}$, is continuous as a result of its definition. Thus, both limits can be equated to essentially $f(a)-f(a)$, which is 0. Thus, l'Hôpital's Rule does apply.
    $\because \left[\lim _{x\rightarrow a}{f-P_{n-1,a,f}}=f(a)-f(a)=0\right]\land \left[\lim _{x\rightarrow a}{(x-a)^{n}}=0^{n}=0\right]\implies$
       $\lim _{x\rightarrow a}{\frac {f-P_{n-1,a,f}}{(x-a)^{n}}}\implies \lim _{x\rightarrow a}{\frac {f'-P'_{n-1,a,f}}{n(x-a)^{n-1}}}$
Since we know that both numerator and denominator are n-times differentiable with l'Hôpital's Rule working for its entirety, we will choose to differentiate only $n-1$ times before doing it for the nth time. Here, we know that $P_{n-1,a,f}^{(n-1)}=f^{(n-1)}(a)$, which is a constant. So, that means that one more iteration of l'Hôpital's Rule will have us left with a function subtracted by 0 over a denominator of simply n factorial. On the nth derivation, we finally calculate the limit normally to reveal that the equation holds. QED.
    $\lim _{x\rightarrow a}{\frac {f'-P'_{n-1,a,f}}{n(x-a)^{n-1}}}\implies \lim _{x\rightarrow a}{\frac {f^{(n-1)}-P_{n-1,a,f}^{(n-1)}}{n!(x-a)}}=\lim _{x\rightarrow a}{\frac {f^{(n-1)}-f^{(n-1)}(a)}{n!(x-a)}}\implies$
    $\lim _{x\rightarrow a}{\frac {f^{(n)}}{n!}}={\frac {f^{(n)}(a)}{n!}}$
$\blacksquare$

### Integral Form of the Remainder

This following theorem is not commonly used, although it is a major step in order to derive the much more used version—the Lagrange form. Typically in first year calculus, the Lagrange form will be utilized.
The obvious fact about Taylor polynomials is that, barring special circumstances, they are not equal to the function $f$ that they relate to. Although we have defined the remainder term as being a function that corrects this error given any input $a$, this does not rigorously guarantee this behavior. The following theorem seeks to define, and thus justify, the claim that the remainder term of a Taylor polynomial exists and is also a function.
If a function is a valid Taylor Polynomial $P_{n,a,f}$ and it's also $n+1$ times differentiable, then its remainder form can be written as $R_{n,a,f}=\int _{x}^{a}{{\frac {f^{n+1}}{(n+1)!}}\operatorname {d} \!t}$
Summary: To prove this, we will use the Fundamental Theorem of Calculus, some sneaky algebraic manipulations, and mathematical explanation for the first 3 iterations in order to create a pattern that is, in the second half, justified using mathematical induction.

#### Proof
### Lagrange Form of the Remainder

This version, although derived from the previous theorem, is the more used version due to its many properties this form presents, namely its inductive-like appearance.
If a function is a valid Taylor Polynomial $P_{n,a,f}$ and it's also $n+1$ times differentiable, then there exists some $t\in (a,x)$ such that its remainder form can be written as $R_{n,a,f}={\frac {f^{n+1}(t)}{(n+1)!}}$

#### Proof
## Overview

The previous two theorems titled Uniqueness Property and Best Power Approximate Theorem readily makes use of the assumption that the function $f$ must be differentiable to the nth degree in order to assure uniqueness. On the next chapter, Taylor Series, this caveat will be taken to its extreme when we will assume infinite differentiability.