How to expand $\tan x$ in Taylor order to $o(x^6)$
I try to expand $\tan x$ in Taylor order to $o(x^6)$, but searching of all 6 derivative in zero (ex. $\tan'(0), \tan''(0)$ and e.t.c.) is very difficult and slow method.
Is there another way to solve the problem?
Any help would be greatly appreciated :)
Solution 1:
Let's integrate repetitively $\ \tan'(x)=1+\tan(x)^2\ $ starting with $\,\tan(x)\approx x$ :
\begin{align} \tan(x)&\small{=}\ x+O\bigl(x^2\bigr)\\ &\small{=\int 1+\left(x+O\bigl(x^2\bigr)\right)^2\,dx}=x+\frac {x^3}3+O\bigl(x^4\bigr)\\ &\small{=\int 1+\left(x+\frac {x^3}3+O\bigl(x^4\bigr)\right)^2dx=\int 1+x^2+\frac {2x^4}3\,dx+O\bigl(x^6\bigr)}=x+\frac {x^3}3+\frac {2x^5}{15}+O\bigl(x^6\bigr)\\ &= \cdots\\ \end{align}
Every integration gives another coefficient of $\ \displaystyle\tan(x)=\sum_{n\ge 0} a_n\ x^{2n+1}\ $ and we get simply : $$ a_n=\begin{cases} &\quad\ 1&n=0\\[6pt] &\frac 1{2n+1} \sum_{k=0}^{n-1} a_k\ a_{n-1-k}&n>0\\ \end{cases} $$ i.e. the sequence $$(a_n)_{n\in\mathbb{N}}=\left(\frac 11,\frac 13, \frac 2{15}, \frac {17}{315}, \frac {62}{2835}, \frac{1382}{155925},\cdots\right)$$
Solution 2:
This answer is inspired by the answer of coffeemath.
We know the following (from e.g. Wikipedia): \begin{align} &\sin(x) = x -\frac{x^3}{6} +\frac{x^5}{120}+ O(x^7) \\ &\cos(x) = 1 -\frac{x^2}{2} +\frac{x^4}{24} +\frac{x^6}{720} +O(x^8) \\ &\tan(x) = a +bx+ cx^2+dx^3+ex^4+fx^5+gx^6+ O(x^7) \end{align} Furthermore it holds $\tan(x) = \frac{\sin(x)}{\cos(x)} \Rightarrow \sin(x) =\tan(x)\cos(x)$. So we get \begin{align} x -\frac{x^3}{6} +\frac{x^5}{120}+ O(x^7) =& \bigl(1 -\frac{x^2}{2} +\frac{x^4}{24} +\frac{x^6}{720} +O(x^8) \bigr) \\ &\cdot\bigl(a +bx+ cx^2+dx^3+ex^4+fx^5+gx^6+ O(x^7)\bigr) \end{align} If we expand the term on the right hand side we obtain \begin{align} x -\frac{x^3}{6} +\frac{x^5}{120}+ O(x^7) &=a+bx+(-\frac{a}{2}+c)x^2+(-\frac{b}{2}+d)x^3 \\&+(\frac{a}{24}-\frac{c}{2}+e)x^4+(\frac{b}{24}-\frac{d}{2}+f)x^5 \\&+(\frac{a}{720}+\frac{c}{24}-\frac{e}{2}+g)x^6+ O(x^7) \end{align} From this we can deduct the linear system \begin{align} \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0&0\\ 0 & 1 & 0 & 0 & 0 & 0 &0\\ -1/2 &0 &1 & 0& 0& 0&0\\ 0 & -1/2 & 0 & 1 & 0 & 0&0 \\ 1/24 & 0 & -1/2 & 0 & 1 & 0&0\\ 0 &1/24 & 0 & -1/2 & 0 & 1&0\\ 1/720 & 0 & 1/24 & 0 & -1/2 & 0 &1 \end{pmatrix} \begin{pmatrix} a\\b\\c\\d\\e\\f\\g \end{pmatrix} = \begin{pmatrix} 0\\1 \\ 0 \\ -1/6 \\ 0 \\1/120 \\ 0 \end{pmatrix} \end{align} Which has the solution \begin{align} \begin{pmatrix} a\\b\\c\\d\\e\\f\\g \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \\ 0 \\ 1/3 \\ 0 \\2/15 \end{pmatrix} \end{align} [Note that you can actually extract two linear systems of the one given above. You then only have to solve for the odd powers of $x$ as $\tan(x)$ is odd.]
So you finally can write your Taylor series as: \begin{align} &\tan(x) = x+ \frac{1}{3}x^3+\frac{2}{15}x^5+ O(x^7) \end{align} Which is (surprisingly) correct, as we can compare our solution with WolframAlpha.
Solution 3:
If you can use known series for $\sin(x)$ and $\cos(x)$, set up the equation $(\cos x)*(\tan x) = \sin x$, where you put unknown constants as coefficients of the $\tan x$ series. Multiply things out and compare coefficients, giving equations on the letters you used for the $\tan x$ series coefficients. Then solve those equations (they should end up linear equations). This won't be too bad as you only need the first six terms.
ADDED: If you are "not allowed to use" sine and cosine series as already given, it would be easy to derive the first six terms of each, since derivatives of sine and cos have a simple pattern. Also, instead of multiplying out, you could use long division and just divide the first six terms of cosine into the first six of sine, only going until you reach the power $x^6$.
EDIT: Here's the basics for the long division. One is dividing $$1-(1/2)x^3+(1/24)x^4-(1/720)x^6$$ into $$x -(1/3)x^3+(2/15)x^5.$$ The first term in the quotient is $x$, and after multiplying through the divisor by this and subtracting (bringing down only up to before $x^7$) the next line is $$(1/3)x^3-(1/30)x^5 +...$$ (don't need the next $x^7$ term) so the next term of the quotient is $(1/3)x^3$, and again multiply through the divisor by this and subtract, giving the next line which starts out $(2/15)x^5$, and nothing needed beyond that power, giving the desired coefficient of $(2/15)x^5$ as the next term of the qoitient. Stringing the quotient terms together we have the first few terms for tangent as $x+(1/3)x^3+(2/15)x^5.$
Solution 4:
Here's the long division method suggested by coffemath.
\begin{align} \sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \dots &= \sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)!} x^{(2n+1)} &=& \sum_{n=0}^\infty a_{(2n+1)} x^{(2n+1)} \\ \cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \dots &= \sum_{n=0}^\infty \frac{(-1)^n}{(2n)!} x^{(2n)} &=& \sum_{n=0}^\infty b_{(2n)} x^{(2n)} \\ \end{align}
\begin{align} \tan(x) = \frac{\sin(x)}{\cos(x)} \end{align}
\begin{align} \sin(x) - \tan(x)\cos(x) &= 0 \\ \sin(x) - truncated(\tan(x))\cos(x) &= remainder\\ \left( x - \frac{x^3}{3!} + \frac{x^5}{5!} - \dots \right) - \left( 0 \right) \left( 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \dots \right) &= \left( x - \frac{x^3}{6} + \frac{x^5}{120} - \dots \right) \\ \left( x - \frac{x^3}{3!} + \frac{x^5}{5!} - \dots \right) - \left( x \right) \left( 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \dots \right) &= \left( \frac{x^3}{3} - \frac{x^5}{30} + \dots \right) \\ \left( x - \frac{x^3}{3!} + \frac{x^5}{5!} - \dots \right) - \left( x + \frac{x^3}{3} \right) \left( 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \dots \right) &= \left( \frac{2x^5}{15} - \frac{4x^7}{315} + \dots \right) \\ \left( x - \frac{x^3}{3!} + \frac{x^5}{5!} - \dots \right) - \left( x + \frac{x^3}{3} + \frac{2x^5}{15} \right) \left( 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \dots \right) &= \left( \frac{17x^7}{315} - \frac{29x^9}{5670} + \dots \right) \end{align}
\begin{align} \tan(x) = x + \frac{x^3}{3} + \frac{2x^5}{15} + \frac{17x^7}{315} + \dots = \sum_{n=0}^{\infty}c_{(2n+1)}x^{(2n+1)} \end{align}
Where the coefficients are given recursively as: \begin{align} a_{(2n+1)} &= \frac{(-1)^n}{(2n+1)!} \\ b_{(2n)} &= \frac{(-1)^n}{(2n)!} \\ c_{(2n+1)} &= a_{(2n+1)} - \sum_{k=0}^{n-1} b_{(2n-2k)} c_{(2k+1)}. \quad \blacksquare \end{align}
This series converges with radius $\frac{\pi}{2}$ around $x=0$.