# Taylor Series beyond 2-3 terms?

im looking to understand the tangent taylor series, but im struggling to understand how to use long division to divide one series (sine) into the other (cosine). I also can't find examples of the Tangent series much beyond X^5 (wikipedia and youtube videos both stop at the second or third term), which is not enough for me to see any pattern. (x^3/3 + 2x^5/15 tells me nothing).

Wiki says Bernouli Numbers which i plan on studying next, but seriously, i could really use an example of tangent series out to 5-6 just to get a ballpark of what's going on before i start plug and pray. If someone can explain why the long division of the series spits out x^3/3 instead of x^3/3x^2, that would help too,

because I took x^3/6 divided by x^2/2 and got 2x^3/6x^2, following the logic that 4/2 divided by 3/5 = 2/0.6 or 20/6. So I multiplied my top and bottom terms for the numerator, and my two middle terms for the denominator (4x5)/(2x3) = correct.

But when i do that with terms in the taylor series I'm doing something wrong. does that first x from sine divided by that first 1 from cosine have anything to do with it?

Completely lost.

• The power series coefficients for the tangent (expanded at the origin) are somewhat mysterious, and yes, the Bernoulli numbers are worth studying if you really want to know what they are and how to compute them. The process of dividing two power series can also produce a continued fraction, with a much more easily recognized pattern. – hardmath Jul 5 '18 at 21:03
• An odd question: When you say 'understand', what particularly are you aiming to understand? If your interest is in calculation then there are much better ways of calculating tangent than its Taylor series; if your interest is in understanding the coefficients themselves, then I don't know that computing them past the first few terms will help particularly much with that understanding (but studying Bernoulli numbers will). What's your ultimate goal? – Steven Stadnicki Jul 5 '18 at 22:54
• not sure this will even be seen, but note on the series long division below: in 5th row of the long division, when i derive (x^3/3 * x^6/720 = x^9/2160)'' i get (9 * 8 * x^7/2160) = x^7/30, NOT x^7/72. How did they get 72? I divided 2160 by 72 and got 30 – Tristian Jul 7 '18 at 4:31

$$\tan(x) = x+{\frac{1}{3}}{x}^{3}+{\frac{2}{15}}{x}^{5}+{\frac{17}{315}}{x}^{7}+ {\frac{62}{2835}}{x}^{9}+{\frac{1382}{155925}}{x}^{11}+{\frac{21844}{ 6081075}}{x}^{13}+\ldots$$

EDIT: Long division:

$$\matrix{& & x &+ \frac{x^3}{3} &+ \frac{2 x^5}{15} &+ \frac{17 x^7}{315}&+ \ldots\cr& &---&---&---&---&--- \cr 1 - \frac{x^2}{2} + \frac{x^4}{24} - \frac{x^6}{720} + \ldots & | & x &- \frac{x^3}{6} &+ \frac{x^5}{120} &- \frac{x^7}{5040} &+ \ldots\cr & & x &- \frac{x^3}{2} &+ \frac{x^5}{24} &- \frac{x^7}{720} &+ \ldots\cr & & ---&---&---&---&---\cr & & &\frac{x^3}{3} &- \frac{x^5}{30} &+ \frac{x^7}{840} &+ \ldots\cr & & & \frac{x^3}{3} & - \frac{x^5}{6} & + \frac{x^7}{72} &+\ldots\cr & & & --- & --- & --- & ---\cr & & & & \frac{2 x^5}{15} & - \frac{4 x^7}{315} & +\ldots\cr & & & & \frac{2 x^5}{15} & - \frac{2 x^7}{30} & +\ldots\cr & & & & --- & --- & ---\cr & & & & & \frac{17 x^7}{315} & + \ldots }$$

• wow!! how did you get those? and how do I get those? – Tristian Jul 5 '18 at 20:03
• This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – max_zorn Jul 5 '18 at 20:37
• @max_zorn: With respect, it actually does answer the Question. OP asks about the Taylor series for "the tangent" and says after looking at Wikipedia's mention of Bernoulli numbers that (s)he "plan(s) on studying next, but seriously, [I] could really use an example of tangent series out to 5-6 [terms]". – hardmath Jul 5 '18 at 20:43
• @hardmath: I interpret this as if the OP wants to see details on the division of the two power series. How does dumping a solution show Tristian anything? How were the coefficients obtained? By Wolfram Alpha or some other tool or by some paper-and-pencil work? – max_zorn Jul 5 '18 at 20:50
• @max_zorn: I like your idea of showing the OP how to form the ratio of two power series, because this matches what they seem to have tried. But the OP seems overwhelmed by the details of what such a computation entails and specifically asks for "a solution" (I assume so that they can know what the answer should look like). Certainly there is an opportunity to write up something further on this Question, if you are so inclined. – hardmath Jul 5 '18 at 20:57

You might find it conceptually easier to set up the identity of power series and compare the first few coefficients, and solve. This is algebraically equivalent to long division, though the order of some of the arithmetic operations is somewhat rearranged.

Write the desired Taylor series at $x = 0$ as $$\tan x \sim a_0 + a_1 x + a_2 x^2 + a_3 x^3 + \cdots .$$ Since $\tan$ is odd, all of the coefficients of the even terms vanish, i.e., $0 = a_0 = a_2 = a_4 = \cdots$. (This insight isn't necessary---we'd recover this fact soon anyway---but it does make the next computation easier.)

Replacing the functions in $$\cos x \tan x = \sin x$$ with their Taylor series gives $$\left(1 - \frac{1}{2!} x^2 + \frac{1}{4!} x^4 - \cdots\right)(a_1 x + a_3 x^3 + a_5 x^5 \cdots) = x - \frac{1}{3!} x^3 + \frac{1}{5!} x^5 - \cdots .$$

Now, comparing the coefficients of the terms $x, x^3, x^5, \ldots$, on both sides respectively gives \begin{align*} a_1 &= 1 \\ a_3 - \tfrac{1}{2} a_1 &= -\tfrac{1}{6} \\ a_5 - \tfrac{1}{2} a_3 + \tfrac{1}{24} a_1 &= \tfrac{1}{120} \\ & \,\,\vdots \end{align*} and successively solving and substituting gives $$\tan x \sim x + \tfrac{1}{3} x^3 + \tfrac{2}{15} x^5 + \cdots .$$ Of course, it's straightforward (if eventually tedious) to compute as many terms as you want this way.

An efficient proof of the formula you mentioned involving the Bernoulli numbers for the general coefficient is given in this answer.

My impression is that it's kind of backwards, in a numerical sense, to think about the coefficients of the $\tan$ series in terms of the Bernoulli numbers because it's simple and numerically stable to calculate the $\tan$ coefficients directly and in fact provides a reasonable method for computing the Bernoulli numbers given the formula in @RobJohn's post. Since $y(x)=\tan x$ is an odd function of $x$ analytic at $x=0$, $$y=\sum_{n=0}^{\infty}a_nx^{2n+1}$$ Then $y^{\prime}=\sec^2x=\tan^2x+1=y^2+1$ so $$\sum_{n=0}^{\infty}(2n+1)a_nx^{2n}=1+\sum_{i=0}^{\infty}\sum_{j=0}^{\infty}a_ia_jx^{2i+2j+2}=1+\sum_{n=1}^{\infty}\left(\sum_{i=0}^{n-1}a_ia_{n-i-1}\right)x^{2n}$$ The constant term reads $$a_0=1$$ The terms in $x^{4n}$ are $$a_{2n}=\frac1{4n+1}\sum_{i=0}^{2n-1}a_ia_{2n-i-1}=\frac2{4n+1}\sum_{i=0}^{n-1}a_ia_{2n-i-1}$$ While the terms in $x^{4n+2}$ are $$a_{2n+1}=\frac1{4n+3}\sum_{i=0}^{2n}a_ia_{2n-i}=\frac1{4n+3}\left(a_n^2+2\sum_{i=0}^{n-1}a_ia_{2n-i}\right)$$ The numerical stability arises because all terms in the formulas for $a_n$ have the same sign.

An alternative and straightforward method is: \begin{align}y&=\tan x \ (=0)\\ y'&=\frac{1}{\cos^2 x}=1+\tan^2x=1+y^2 \ (=1)\\ y''&=2yy'=2y(1+y^2)=2y+2y^3 \ (=0) \\ y'''&=2y'+6y^2y'=2+8y^2+6y^4 \ (=2)\\ y^{(4)}&=16yy'+24y^3y'=16y+40y^3+24y^5 \ (=0)\\ y^{(5)}&=16+120y^2y'+120y^4y'=16+136y^2+240y^4+120y^6 \ (=16)\\ y^{(6)}&=272yy'+960y^3y'+720y^5y'=272y+1232y^3+1680y^5+720y^7 \ (=0)\\ y^{(7)}&=272y'+3696y^2y'+8400y^4y'+5040y^6y'=272+3968y^2+\cdots \ (=272)\end{align} Hence: \begin{align}\tan x&=0+\frac{1}{1!}x+\frac{0}{2!}x^2+\frac{2}{3!}x^3+\frac{0}{4!}x^4+\frac{16}{5!}x^5+\frac{0}{6!}x^6+\frac{272}{7!}x^7+\cdots\\ &=x+\frac{1}{3}x^3+\frac{2}{15}x^5+\frac{17}{315}x^7+\cdots\end{align} Note: You can continue as far as you want, though the computation gets tedious. WA shows the expansion to many more terms (press on "More terms" button).

Write $\frac{\sin x}{x}=\frac{\tan x}{x}\cos x$ as a power series in $x^2$, with $\frac{\tan x}{x}=t_0+t_1 x^2+t_2 x^4+\cdots$. Equating coefficients of powers of $x^2$ one by one gives $1=t_0,\,-\frac{1}{6}=-\frac{t_0}{2}+t_1,\,\frac{1}{120}=\frac{t_0}{24}-\frac{t_1}{2}+t_2$ etc. Write down as many of those as you like. Thus $t_0=1,\,t_1=\frac{1}{3},\,t_2=\frac{2}{15}$ etc.