# Finding Taylor polynomial of the right degree and checking the remainder

There are few things which I can't quite grasp while trying to find Taylor polynomial of composite functions and their products. This will be lenghty for such an easy topic so i apologize in advance. I will use this problem as an example:

Find Taylor polynomial centered at $$0$$ of the fourth degree of the function:$$f(x) = \frac{1+x+x^2}{1-x+x^2}$$

I work with remainder in Peano form, defined to be $$\omega(x)= \frac{R_n}{(x-a)^n}$$ and $$R_n = f(x)-P_n(x)$$, where $$P_n$$ is Taylor polynomial of n-th degree and $$a$$ is where the polynomial is centered at. By Taylor theorem we know for $$P_n$$ this holds: $$\lim_{x\to a}\omega(x) = 0$$ and any given polynomial with this property is Taylor polynomial.

So since they're basically two multiplied functions I tried to make use of the Taylor expansion for $$(1+x)^\alpha$$ like this:$$(1+x+x^2)(1+(-x+x^2))^{-1}=(1+x+x^2)\bigg(\sum_{k=0}^{n}{\alpha\choose{k}}(-x+x^2)^k+\omega(-x+x^2)(-x+x^2)^n\bigg)$$ Where in $$\omega(-x+x^2)$$ the argument of $$\omega(x)$$ tends to zero as x tends to zero, so by limit of composite function: $$\lim_{x\to0}\omega(-x+x^2)=0$$. The remainder is multiplyied by $$(-x+x^2)^n$$. (Sorry for that notation. They use it at our uni and I'm not sure whether it's standard or not)

What degree should I plug into the sum? The problem asks for polynomial of degree $$4$$ but it's multiplied by polynomial of second degree. My initial thought was that I can expand the sum to second degree and I will get polynomial of 4th degree. It obviously didn't work. Can someone explain why I can't do this? The only explanation I came up with was that the remainder won't satisfy this limit: $$lim_{x\to\infty}\frac{R_4}{x^4}$$ so by Taylor theorem I can't tell if it's Taylor polynomial or not.

How does this multiplication of remainder change it? Is it okay to multiply it like this? From the expansion above:$$\omega(-x+x^2)(-x+x^2)^n+\omega(-x+x^2)(-x^2+x^3)^n+\omega(-x+x^2)(-x^3+x^4)^n$$ Does this whole term need to tend to zero when divided by $$x^4$$ by Taylor theorem? That would explain why I need to plug at least $$n=4$$, for $$n<4$$ the $$\omega(-x+x^2)(-x+x^2)^n$$ would be $$\frac{0}{0}$$.

To get the Taylor expansion around $$x=0$$, you should expand the terms of the form $$(-x+x^2)^k$$ as a sum of powers of $$x$$, adding equal powers up to order $$4$$. There are easier ways to get the Taylor expansion.
1. Long division. You divide $$1+x+x^2$$ by $$1-x+x^2$$ as polynomials, but in increasing orders of powers. The first term in the quotient will be $$1$$. Then compute $$1+x+x^2-1\times(1-x+x^2)=2\,x.$$ Dividing $$2\,x$$ by $$1-x+x^2$$, we find that the next term in the expansion will be $$2\,x$$. Compute now $$2\,x-(2\,x)\times(1+x+x^2)=-2\,x^2-2\,x^3.$$ Keep on going until you get to $$x^4$$.
2. Undetermined coefficients. Let $$\frac{1+x+x^2}{1-x+x^2}=a_0+a_1\,x+a_2\,x^2+a_3\,x^3+a_4\,x^4+\dots$$ Then $$1+x+x^2=(1-x+x^2)\times(a_0+a_1\,x+a_2\,x^2+a_3\,x^3+a_4\,x^4+\dots)\tag{*}$$ Multiply the right hand side keeping only powers $$\le4$$. I wild it up to $$x^2$$: $$a_0+(a_1-a_0)x+(a_2-a_1+a_0)x^2+\dots$$ Identifying coefficients on both sides of (*) we get the equations \begin{align} 1&=a_0\\ 1&=a_1-a_0\\ 1&=a_2-a_1+a_0\\ 0&=\dots \end{align} This allows to computebthe values of the coefficients $$a_k$$ recursively.