METHOD 1
The Taylor series for sin(x)=x-x3/3!+x5/5!-... or ∑(-1)rx2r+1/(2r+1)! for integer r≥0.
The Taylor series for cos(x)=1-x2/2!+x4/4!-... or ∑(-1)rx2r/(2r)! for integer r≥0.
Since tan(x)=sin(x)/cos(x)=∑(-1)rx2r+1/(2r+1)!/∑(-1)rx2r/(2r)!.
Let's see what long division looks like:
x is the first term of the series for tan(x).
1-x2/2!+x4/4!-... | x-x3/3!+x5/5!-...
x-x3/2!+x5/4!-...
-x3(⅙-½)+x5(1/120-1/24)+...+(-1)rx2r+1(1/(2r+1)!-1/(2r)!)+... (the first difference).
Coefficient of x2r+1 is (-1)r(1/(2r+1)!-1/(2r)!)=(-1)r+1/[(2r-1)!(2r+1)] for r≥1.
Clearly this is going to get more and more complicated with successive terms, so let's apply an easier approach. However, Method 1 is still useful for a fixed number of terms, and there is a formula for the nth term of an infinite series for tan(x). More of this later.
METHOD 2
f(x)=tan(x), successive derivatives will be designated in the form f(n), where n=1 implies f'(x) and f or f(0) imply f(x).
Also f0(n) implies f(n)(0) and f0 implies f(0).
f(1)=sec2(x)=1+tan2(x)=1+f2
f(2)=2ff(1),
f(3)=2ff(2)+2(f(1))2,
f(4)=(2ff(3)+2f(1)f(2))+4f(1)f(2)=2ff(3)+6f(1)f(2),
f(5)=2(ff(4)+f(1)f(3))+6(f(1)f(3)+(f(2))2)=2ff(4)+8f(1)f(3)+6(f(2))2,
f(6)=2(ff(5)+f(1)f(4))+8(f(1)f(4)+f(2)f(3))+12f(2)f(3)=2ff(5)+10f(1)f(4)+20f(2)f(3),
f(7)=2(ff(6)+f(1)f(5))+10(f(1)f(5)+f(2)f(4))+20(f(2)f(4)+(f(3))2)=2ff(6)+12f(1)f(5)+30f(2)f(4)+20(f(3))2,
f(8)=2(ff(7)+f(1)f(6))+12(f(1)f(6)+f(2)f(5))+30(f(2)f(5)+f(3)f(4))+40f(3)f(4)=2ff(7)+14f(1)f(6)+42f(2)f(5)+70f(3)f(4),
f(9)=2(ff(8)+f(1)f(7))+14(f(1)f(7)+f(2)f(6))+42(f(2)f(6)+f(3)f(5))+70(f(3)f(5)+(f(4))2),
f(9)=2ff(8)+16f(1)f(7)+56f(2)f(6)+112f(3)f(5)+70(f(4))2, ...
f0=0, f0(1)=1, so f0(2)=0, f0(3)=2, f0(4)=0, so f0(2n)=0 for all integer n≥0.
This method of calculating successive derivatives is easier than the long division method and is more closely connected to the Taylor series method. Furthermore, a pattern is emerging for the terms of the derivatives.
n (odd) f0(n) an (Taylor/Maclaurin)
1 1 1
3 2 2/3!=⅓
5 16 16/5!=2/15
7 272 272/7!=17/315
9 7936 7936/9!=62/2835
All even derivatives: f0, f0(2), etc., are zero, so any terms containing them can be ignored.
So tan(x)=x+x3/3+2x5/15+17x7/315+62x9/2835+...
To confirm this we can use Method 1: (x-x3/3!+x5/5!-x7/7!+x9/9!)/(1-x2/2!+x4/4!-x6/6!+x8/8!):
x+x3/3+2x5/15+17x7/315+62x9/2835
1-x2/2!+x4/4!-x6/6!+x8/8! | x-x3/3!+x5/5! -x7/7! +x9/9!
x-x3/2!+x5/4!- x7/6! +x9/8!
x3/3-x5/30 +x7/840 -x9/45360
x3/3-x5/6 +x7/72 -x9/2160 +x11/120960
2x5/15 -4x7/315 +x9/2268-x11/...
2x5/15 -x7/15 +x9/180 -x11/...
17x7/315 -29x9/5670
17x7/315 -17x9/630 +x11/...
62x9/2835
So this division confirms the results for Method 2. But next we can look at the standard formula for the series.
tan(x)=∑[(-1)n-122n(22n-1)B2n]x2n-1/[2n(2n-1)!], where B2n represents the Bernoulli number.