Finding Maclaurin series for trig function

Homework Statement

Find the Maclaurin series for (tanx)2

Homework Equations

$$f(0)+\frac{f'(0)}{1!}x+\frac{f''(0)}{2!}x^{2}+...$$

The Attempt at a Solution

I don't see how it's reasonable to do this problem without using a computer.
The derivative of (tanx)2 is 2tanxsec2x, then the derivative of that is -2(cos2x-2)sec4x, then the derivative of that is -2(sin3x-11sinx)sec5x.

Going up to only the third derivative is pretty difficult, but just going that far doesn't give me much information about the series. It only gives me x2, because the other terms are 0.

So is there another way of doing this, or is deriving these long expressions the only way?

Thanks.

The Attempt at a Solution

Typically for a problem like this you only want to write down the first few terms. Since it is an infinite series you don't really have to go too far with it.

Taking those first three terms and using them appropriately should be enough. You could also look for some patterns, a lot of your terms end up being zero.

STEMucator
Homework Helper
I can see a pretty easy way to accomplish this question if you know the Mclaurin series for ##sin(x)## and ##cos(x)##.

By using long division you can derive the series you want.

Homework Statement

Find the Maclaurin series for (tanx)2

Homework Equations

$$f(0)+\frac{f'(0)}{1!}x+\frac{f''(0)}{2!}x^{2}+...$$

The Attempt at a Solution

I don't see how it's reasonable to do this problem without using a computer.
The derivative of (tanx)2 is 2tanxsec2x, then the derivative of that is -2(cos2x-2)sec4x, then the derivative of that is -2(sin3x-11sinx)sec5x.

Going up to only the third derivative is pretty difficult, but just going that far doesn't give me much information about the series. It only gives me x2, because the other terms are 0.

So is there another way of doing this, or is deriving these long expressions the only way?

Thanks.
What class is this for? Are you comfortable with complex analysis? I think a Laurent series and a limit works.

vela
Staff Emeritus
Homework Helper
You could find the series for tan x and then square it.

Well I used the method of taking the derivative of tanx, and then the derivative of that, and the derivative of that. I did that 4 times. The 4th time I did it, I already have a ridiculous trig function: 8tanx(secx)^4+8(secx)^4tanx+8(tanx)^3(secx)^2. I'd have to take the derivative of that to get the value of the 5th coefficient. But the problem with this is a0 = 0, a1 = 1, a2 = 0, a3 = 1/3, a4 = 0. So I only get 2 values out of that. I then multiply them together to get the series for (tanx)^2 and it's inaccurate. I get x^2 + 2/3 x^4 + 1/9 x^6. I need more terms for it to be accurate even to the 3rd term.

STEMucator
Homework Helper
Well I used the method of taking the derivative of tanx, and then the derivative of that, and the derivative of that. I did that 4 times. The 4th time I did it, I already have a ridiculous trig function: 8tanx(secx)^4+8(secx)^4tanx+8(tanx)^3(secx)^2. I'd have to take the derivative of that to get the value of the 5th coefficient. But the problem with this is a0 = 0, a1 = 1, a2 = 0, a3 = 1/3, a4 = 0. So I only get 2 values out of that. I then multiply them together to get the series for (tanx)^2 and it's inaccurate. I get x^2 + 2/3 x^4 + 1/9 x^6. I need more terms for it to be accurate even to the 3rd term.

That's because doing this problem with derivatives is going to take you forever. There's no real pattern in the derivatives.

This problem is designed to make use of the fact that :

$$sin(x) = \sum_{n=0}^{∞} (-1)^n \frac{x^{2n+1}}{(2n+1)!}$$

$$cos(x) = \sum_{n=0}^{∞} (-1)^n \frac{x^{2n}}{(2n)!}$$

$$tan(x) = \frac{sin(x)}{cos(x)}$$

Write out the first few terms for each series and see what happens when you divide them.

Last edited:
vela
Staff Emeritus
Homework Helper
That's because doing this problem with derivatives is going to take you forever. There's no real pattern in the derivatives.
Sure there is. I just got the first 5 derivatives in just a few minutes. Just keep everything in terms of tan x so you don't have to keep using the product rule.
\begin{align*}
f(x) &= \tan x \\
f'(x) &= \sec^2 x = 1 + \tan^2 x \\
f''(x) &= 2\tan x\sec^2 x = 2 \tan x (1+\tan^2 x) = 2 (\tan x + \tan^3 x) \\
f'''(x) &= 2(\sec^2 x+3\tan^2 x \sec^2 x) = 2(1+3\tan^2 x)\sec^2 x = 2(1+4\tan^2 x+3 \tan^4 x)
\end{align*} and so on.

STEMucator
Homework Helper
Sure there is. I just got the first 5 derivatives in just a few minutes. Just keep everything in terms of tan x so you don't have to keep using the product rule.
\begin{align*}
f(x) &= \tan x \\
f'(x) &= \sec^2 x = 1 + \tan^2 x \\
f''(x) &= 2\tan x\sec^2 x = 2 \tan x (1+\tan^2 x) = 2 (\tan x + \tan^3 x) \\
f'''(x) &= 2(\sec^2 x+3\tan^2 x \sec^2 x) = 2(1+3\tan^2 x)\sec^2 x = 2(1+4\tan^2 x+3 \tan^4 x)
\end{align*} and so on.

That definitely looks much nicer, so I tried it this way and got the same answer. I was truthfully going with the derivative wolfram outputted due to my laziness.

Dividing the sine series and cosine series can get you in some hot water, even if you only take the first few terms it isn't accurate (since it neglects a majority of the series). Squaring it leads to a similar issue

It may be annoying to take derivatives but go for it, get the first 6 if you are adventurous. Or just the first four if you want. Since, all the odd derivatives will yield 0 we know what 5 will be without trying to write it explicitly down.

You can also try using some language to help you (i.e. mathematica).

Thanks for the responses. I'll try vela's way of getting the derivatives. Keeping it in terms of tangent is a good idea.

I tried dividing, but it's been a while since I divided polynomials. When you divide polynomials, don't you normally rearrange the dividend in order from highest to lowest powers? Can you do that with series?

Thanks.

STEMucator
Homework Helper
Thanks for the responses. I'll try vela's way of getting the derivatives. Keeping it in terms of tangent is a good idea.

I tried dividing, but it's been a while since I divided polynomials. When you divide polynomials, don't you normally rearrange the dividend in order from highest to lowest powers? Can you do that with series?

Thanks.

Writing it out you should get :

$$\frac{sin(x)}{cos(x)} = \frac{x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + ...}{1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!}+ ...}$$

No re-arranging needed.

vela
Staff Emeritus
Homework Helper
Dividing the sine series and cosine series can get you in some hot water, even if you only take the first few terms it isn't accurate (since it neglects a majority of the series). Squaring it leads to a similar issue.
This is misleading at best. Being able to manipulate series in this way is an important skill to develop. You indeed have to keep track of all the terms that may contribute to the final answer, but you can safely ignore the rest.

vela
Staff Emeritus
Homework Helper
You can also use the fact that ##\frac{1}{1-z} = 1+z+z^2+z^3+\cdots## and turn it into a series multiplication problem:
\begin{align*}
\frac{\sin(x)}{\cos(x)} &= \frac{x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots}{1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots}
= \frac{x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots}{1 - \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right)} \\
&= \left(x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots\right) \left[1 + \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right) + \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right)^2 + \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right)^3 + \cdots\right]
\end{align*} The key here is to keep track of only the terms that will contribute to your final answer and neglect the rest.

So is there another way of doing this, or is deriving these long expressions the only way?

Well, you know $\frac{d}{dx} \tan(x)=\sec^2(x)$ and $\tan^2(x)=\sec^2(x)-1$ so that:

$$\frac{d}{dx}\left(\tan(x)-x\right)=\sec^2(x)-1=\tan^2(x)$$

The power series for $\tan(x)$ is a bear and not easy to derive but you can look it up in Mathworld for example. Let's just say:

$$\tan(x)=\sum_{n=1}^{\infty} a_n x^{2n-1}$$

Now, using the power series for $\tan(x)$, can you now derive a power series for $\tan^2(x)$?

Edit: And here's a nice derivation of the series for tan(z):

http://mathhelpforum.com/math-challenge-problems/108861-power-series-tangent-function.html

Last edited:
Ray Vickson
Homework Helper
Dearly Missed
You can also use the fact that ##\frac{1}{1-z} = 1+z+z^2+z^3+\cdots## and turn it into a series multiplication problem:
\begin{align*}
\frac{\sin(x)}{\cos(x)} &= \frac{x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots}{1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots}
= \frac{x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots}{1 - \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right)} \\
&= \left(x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots\right) \left[1 + \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right) + \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right)^2 + \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right)^3 + \cdots\right]
\end{align*} The key here is to keep track of only the terms that will contribute to your final answer and neglect the rest.

For what it's worth, ##\tan(x)## is expandable in terms of Bernoulli numbers:
$$\tan x = \sum_{n=1}^{\infty} \frac{(-4)^n (1-4^n)B_{2n}}{(2n)!} x^{2n-1}$$
(see http://en.wikipedia.org/wiki/Taylor_series#List_of_Maclaurin_series_of_some_common_functions )
Here ##B_k## is the ##k##th Bernoulli number; see http://en.wikipedia.org/wiki/Bernoulli_number

So, squaring the series gives something in terms of a convolution involving Bernoulli numbers.

You can also use the fact that ##\frac{1}{1-z} = 1+z+z^2+z^3+\cdots## and turn it into a series multiplication problem:
\begin{align*}
\frac{\sin(x)}{\cos(x)} &= \frac{x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots}{1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots}
= \frac{x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots}{1 - \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right)} \\
&= \left(x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots\right) \left[1 + \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right) + \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right)^2 + \left(\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots\right)^3 + \cdots\right]
\end{align*} The key here is to keep track of only the terms that will contribute to your final answer and neglect the rest.

This is only true when we are dealing with small z, |z|<1. There is no such restriction like that in the problem. If we self impose that criteria we might as well use,

Tan(x) ≈ Sin(x) ≈ x for small values of x

Series manipulation is great and crucial in many problems, but only if it brings us close to a value. Larger terms are non-negligible because we allow x→∞, atleast up to 2∏.

Try your method and see if you generate the proper values:
the first 8 terms are 0,0,1,0, 2/3, 0, 17/5, 0 (this comes from the actual derivatives)

vela
Staff Emeritus
Homework Helper
This is only true when we are dealing with small z, |z|<1. There is no such restriction like that in the problem.
Fair point, but there's no problem here. Since we're expanding about x=0, the series for ##\tan^2 x## you obtain is only valid for ##|x|<\pi/2## because ##\tan^2 x## has a singularity at ##x=\pi/2##. In this range, you have that ##0 \lt \cos x \le 1##, which implies ##z=\frac{x^2}{2!} - \frac{x^4}{4!} + \cdots = 1-\cos x## is positive and strictly less than 1.

If we self impose that criteria we might as well use,

Tan(x) ≈ Sin(x) ≈ x for small values of x
Except that you know (or should know) this means your answer result would only be valid for terms up to order x1. You're either being disingenuous here or revealing why you've had trouble manipulating series.

Series manipulation is great and crucial in many problems, but only if it brings us close to a value. Larger terms are non-negligible because we allow x→∞, atleast up to 2∏.
The last time I looked, ##2\pi## was smaller than infinity.

For larger values of x, yes, you have to include more terms to obtain the desired accuracy, but it doesn't change the series. In this problem, for instance, you won't get one series for x≈0 and a different one for x≈1.5. In deriving the series, you don't need to worry about terms of order x7 or higher if all you want to write down is terms up to order x6.

Try your method and see if you generate the proper values:
the first 8 terms are 0,0,1,0, 2/3, 0, 17/5, 0 (this comes from the actual derivatives)
I have, and it does. I suggest you try figure out why you can't get it to work for yourself — or at least quit claiming a method won't work if you haven't tried it yourself.

Ok, I'll bite, let's try it your way:

(x-x3/3!+x5/5!-...)*(1+(x2/2!-x4/4!+...)+(1+(x2/2!-x4/4!+...)2+...)

The lowest term we can end with is when we multiply x *1. Well, that means that the a0 coefficient is 0: good.

The a1 coefficient is 1: wrong.

Do you really think this approach is a better approach to taking a few derivatives? Just because you are capable of doing something doesn't mean it is always beneficial.

STEMucator
Homework Helper
Here's another cool way to express it :

##(tan(x))^2 = (sec(x))^2 - 1 = \frac{1}{(cos(x))^2} - 1##

##= \frac{1}{(\sum_{n=0}^{∞} (-1)^n \frac{x^{2n}}{(2n)!})^2} - 1##

##( \sum_{n=0}^{∞} (-1)^n \frac{x^{2n}}{(2n)!} )^{-2} - 1##

More work than is necessary, but it shows that there's more than one way to represent a function as a series.

vela
Staff Emeritus
Homework Helper
Ok, I'll bite, let's try it your way:

(x-x3/3!+x5/5!-...)*(1+(x2/2!-x4/4!+...)+(1+(x2/2!-x4/4!+...)2+...)

The lowest term we can end with is when we multiply x *1. Well, that means that the a0 coefficient is 0: good.

The a1 coefficient is 1: wrong.
The leading term for tan x, which is the series you're calculating here, is indeed x.

Do you really think this approach is a better approach to taking a few derivatives? Just because you are capable of doing something doesn't mean it is always beneficial.
Yes.

I'm being a bit flippant here. Obviously, some methods will be easier to apply than others, but just because you can get the answer using one method doesn't mean you shouldn't try other methods as well.

Last edited:
vela
Staff Emeritus
Homework Helper
$$\tan^2 x = \sec^2 x - 1 = \left(\frac{d}{dx}\tan x\right) - 1.$$ Once you have the series for tan x, differentiate it term by term and subtract 1.