# Working out $\tan x$ using sin and cos expansion

Using only the series expansions $\sin x = x- \dfrac{x^3} {3!} + \dfrac{x^5} {5!} + ...$ and $\cos x = 1 - \dfrac{x^2} {2!} + \dfrac{x^4}{4!} + ...$ Find the series expansions of the $\tan x$ function up to the $x^5$ term.

So it is: $$\frac {x- \dfrac{x^3} {3!} + \dfrac{x^5} {5!} + ...} {1 - \dfrac{x^2} {2!} + \dfrac{x^4}{4!} + ...}$$

However many times I retry, trying long division results :

$$\require{enclose} \begin{array}{rll} Q(x) \\[-3pt] 1 - \dfrac{x^2} {2!} + \dfrac{x^4}{4!} + ... \enclose{longdiv}{x- \dfrac{x^3} {3!} + \dfrac{x^5} {5!} + ...}\kern-.2ex \\[-3pt] \underline{x-\dfrac{x^3} {2!} + \dfrac{x^5} {4!}\phantom{0000}} \\[-3pt] \dfrac{-x^3} {3!} + \dfrac{x^3} {2!}+ \dfrac{x^5} {5!}-\dfrac{x^5} {4!} \phantom{00}&& \\[-3pt] \underline{\phantom{0}\dfrac{-x^3} {3!} + \dfrac{x^3} {2!}- \dfrac{x^5} {2!2!}+ \dfrac{x^5} {3!2!}} && \\[-3pt] \dfrac{x^5} {5!} - \dfrac{x^5} {4!} + \dfrac{x^5} {2!2!}-\dfrac{x^5} {3!2!}&& \\[-3pt] \end{array}$$

Sorry for the horrible format. but this is the best i can do..

$$Q(x) = x + (\frac {x^3}{2!} - \frac {x^3}{3!}) + (\dfrac {x^5}{5!} - \dfrac {x^5}{4!} + \dfrac {x^5}{2!2!} - \dfrac {x^5}{3!2!}) + ...$$

Which results the coefficients of the $x^5$ term $\dfrac 1 {20}$.
This is clearly a wrong value. I can't seem to get $\dfrac 2 {15}$ instead.
Where did I get wrong?

• Another thread of interest. Apr 17, 2015 at 20:43

You may exploit the fact that $\tan x$ is an odd function, hence in a neighbourhood of the origin: $$\tan x=\sum_{n\geq 0} a_{2n+1}\, x^{2n+1}\tag{1}$$ as well as: $$\frac{d}{dx}\tan x=\frac{1}{\cos^2 x}=1+\color{purple}{\tan^2 x} = \sum_{n\geq 0}(2n+1)\,a_{2n+1}\,x^{2n} \tag{2}$$ from which it follows that $a_1=1$ and:

$$a_{2n+1} = \frac{1}{2n+1}\sum_{k=1}^{n}a_{2k-1}a_{2n-2k+1}\tag{3}$$

so the Taylor coefficients of the tangent function can be computed with a rather simple recursion. $(3)$ leads to: $$a_3 = \frac{1}{3}a_1^2 = \frac{1}{3},\quad a_5=\frac{2}{5}a_1 a_3=\frac{2}{15}.\tag{4}$$ No polynomial divisions involved. Pretty nice, don't you think?

• not an answer to the question Apr 17, 2015 at 12:34
• @GEdgar: I might agree this does not provide an answer to the OP's problems, but it shows a much more effective method for computing the Taylor coefficients of $\tan x$, so I think it is worth to stay here. Apr 17, 2015 at 12:45
• @GEdgar: and by the way, this method is just the same as the one shown in the accepted answer. Apr 17, 2015 at 12:50
• This seems like more formal approach, I do find this over my current syllabus but it is interesting nontheless. May I ask how you got RHS of (2) - Is that a formal form of 1/cos^2(x) ? and how did you go from (2) to (3). Thank you! Apr 17, 2015 at 13:12
• @zcahfg2: look at the purple term in the middle of $(2)$: the point is that the derivative of a function is connected with the square of the same function, hence, speaking about Taylor coefficients, $(2n+1)a_{2n+1}$ is given by the shown convolution. Apr 17, 2015 at 13:16

The following way may be easier.

Since $\tan x$ is an odd function, it can be represented as $\tan x=ax+bx^3+cx^5+\cdots.$

Since $\sin x=\cos x\tan x$, one has $$x-\frac{x^3}{3!}+\frac{x^5}{5!}+\cdots=\left(1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots\right)\left(ax+bx^3+cx^5+\cdots\right).$$

Comparing the coefficients gives you $$1=a$$ $$-\frac{1}{3!}=b-\frac{a}{2!}$$ $$\frac{1}{5!}=c-\frac{b}{2!}+\frac{a}{4!}.$$

• An alternate way to write long division Apr 17, 2015 at 12:34
• @GEdgar: Thanks for pointing it out. You are right, and I should have written so. I just prefer multiplication to division especially in this case. Apr 17, 2015 at 12:44
• I never thought of representing $\tan x = ax + bx^3 +cx^5 + ...$ Thanks for pointing it out! Apr 17, 2015 at 12:48
You get that the coefficient for $x^5$ is $\dfrac {1}{5!} - \dfrac {1}{4!} + \dfrac {1}{2!2!} - \dfrac {1}{3!2!}$, which is indeed $\dfrac2{15}$. So, no need to change method.