# Taylor series $\ln(\tan(x))-\ln(x)$ for point $0$

Well.

I want to find the Taylor series for the function:

$$f(x) = \ln(\tan(x))-\ln(x),$$

order $5$ for point $c=0$. Maple's result is: $$\ln(\tan(x))-\ln(x) = \frac 13x^2+\frac 7{90}x^4+O(x^6).$$

And my simple question is: How?

I really don't see how I can find the Taylor series when $\ln(\tan(0))-\ln(0)$ (which is the first term in the Taylor series) is undefined?

-
If you rewrite the function as $\ln (\frac{\tan x}{x})$, you will realize that this discontinuity is just a removable one. So the function "morally" has the value $0$ (the limit of the function as $x \to 0$) at $0$. –  Srivatsan Sep 10 '11 at 20:00

First, as already noted by many, we have

$$\ln(\tan x)-\ln x=\ln\left(\frac{\tan x}x\right) = \ln\left(\frac{\sin x}x \frac{1}{\cos x}\right)$$

So when $x \to 0$, the term inside the logarithm will go to $1$, so no problems there. From this we can also already conclude that there will be no constant term in the Taylor series, as $\ln(1 \pm \epsilon) \to 0$ as $\epsilon \to 0$.

Next, we can use the Taylor series for $\tan(x)$ to get

$$\frac{\tan x}{x}=1+\frac{1}{3}x^2+\frac{2}{15}x^4+\frac{17}{315}x^6+\frac{62}{2835}x^8+\ldots$$

Using the Taylor series for $\ln(1+x)$ then gives us

$$\ln\left(\frac{\tan x}x\right) = \ln\left(1+\left(\frac{1}{3}x^2+\frac{2}{15}x^4+\frac{17}{315}x^6+\frac{62}{2835}x^8+\ldots\right)\right)$$ $$= y - \frac{1}{2} y^2 + \frac{1}{3} y^3 - \frac{1}{4}y^4 + \ldots$$

where

$$y = \frac{1}{3}x^2+\frac{2}{15}x^4+\frac{17}{315}x^6+\frac{62}{2835}x^8+\ldots$$

The rest is just hard work. You could calculate the lower order terms for each of the powers of $y$ first.

$$\begin{array}{rcl} y &=& \frac{1}{3}x^2+\frac{2}{15}x^4+\frac{17}{315}x^6+\frac{62}{2835}x^8+\ldots \\ \frac{1}{2}y^2 &=& \frac{1}{18}x^4+\frac{2}{45}x^6+\left(\frac{17}{945}+\frac{2}{225}\right)x^8+\ldots \\ \frac{1}{3}y^3 &=& \frac{1}{81}x^6+\frac{2}{135}x^8+\ldots \\ \frac{1}{4}y^4 &=& \frac{1}{324}x^8+\ldots \end{array}$$

Adding it all up, we get

$$\ln(\tan x)-\ln x = y - \frac{1}{2} y^2 + \frac{1}{3} y^3 - \frac{1}{4}y^4 + \ldots$$ $$= \frac{1}{3}x^2 + \left(\frac{2}{15} - \frac{1}{18}\right)x^4 + \left(\frac{17}{315}-\frac{2}{45}+\frac{1}{81}\right)x^6 + \left(\frac{62}{2835} - \frac{17}{945} - \frac{2}{225} + \frac{2}{135} - \frac{1}{324}\right)x^8 + \ldots$$ $$= \frac{1}{3}x^2 + \frac{7}{90}x^4 + \frac{62}{2835}x^6 + \frac{127}{18900}x^8 + \ldots$$

-
Surprisingly, the coefficient of $x^6$ in the final answer is the same as the coefficient of $x^9$ in $\tan(x)$. I have no clue why, possibly it is just a coincidence. –  TMM Sep 10 '11 at 21:03
Note that it's not quite automatic that $\ln(\tan(x)) - \ln(x) = \ln(\tan(x)/x)$ for $x$ in a deleted neighbourhood of 0 in the complex plane (of course it is true when $x > 0$ and $\tan(x) > 0$). –  Robert Israel Sep 11 '11 at 7:17
For example, it would not be true for some branches of the logarithm. –  Robert Israel Sep 11 '11 at 7:26

Hint: As Srivatsan said, you should first write $$\ln(\tan x)-\ln x=\ln\left(\frac{\tan x}x\right).$$ As a next step you should find a sufficient number of terms of the Maclaurin series of $\tan x$, and divide that by $x$: $$\frac{\tan x}{x}=1+\frac{x^2}3+\frac{2x^4}{15}+\cdots$$ Write this as $1+u$. Then as a last step use the series $$\ln(1+u)=u-\frac{u^2}{2}+\frac{u^3}3-\cdots$$

-
And even omitting the $u^3$ term. –  Did Sep 10 '11 at 20:18
@Didier: All depending on whether the OP wants to figure out the sextic term as an exercise or not :-) –  Jyrki Lahtonen Sep 10 '11 at 20:21
@Thijs: You might consider expanding that calculation to a full answer. That may well be more useful to the OP than my attempt. –  Jyrki Lahtonen Sep 10 '11 at 20:34
@Thijs: +1 to your solution. I'm fairly sure that you didn't need my hints. But, yeah, I didn't want any dirt on my hands :-) –  Jyrki Lahtonen Sep 11 '11 at 4:57

Your function is $\ln(\sin(x)) - \ln(\cos(x)) - \ln(x)$, whose derivative is $\cot(x) + \tan(x) - {1 \over x}$. The power series for these functions are well-known and can be looked up readily. So put them together, integrate term by term and you will get the Taylor series for $\ln(\tan(x)) - \ln(x)$. Wolfram alpha gives $${x^2 \over 3} + {7x^4 \over 90} + {62x^6 \over 2835} + {127 x^8 \over 18900} + {146 x^{10} \over 66825} + ...$$

-
–  Ｊ. Ｍ. Sep 11 '11 at 4:54
Or rewrite cot(x)+tan(x) as 2/sin(2x) and find a power series for 1/sin. –  Did Sep 11 '11 at 6:55