Notice that the three multiples of thetaθ are all powers of 2, so we can use double angle formulae to expand them. Start with
sin2theta=2sinthetacosthetasin2θ=2sinθcosθ and
cos2theta=cos^2theta-sin^2theta=1-2sin^2thetacos2θ=cos2θ−sin2θ=1−2sin2θ
From these deduce that
tan2theta=(sin2theta)/(cos2theta)=(2sinthetacostheta)/(cos^2theta-sin^2theta)=(2tantheta)/(1-tan^2theta)tan2θ=sin2θcos2θ=2sinθcosθcos2θ−sin2θ=2tanθ1−tan2θ
We can now use these iteratively to deduce formulae for 4theta4θ and 8theta8θ.
tan4theta=(2tan2theta)/(1-tan^2 2theta)=(2((2tantheta)/(1-tan^2theta)))/(1-((2tantheta)/(1-tan^2theta))^2)tan4θ=2tan2θ1−tan22θ=2(2tanθ1−tan2θ)1−(2tanθ1−tan2θ)2
=(4tantheta)/(1-tan^2theta)*((1-tan^2theta)^2-4tan^2theta)/((1-tan^2theta)^2)=4tanθ1−tan2θ⋅(1−tan2θ)2−4tan2θ(1−tan2θ)2
=(4tantheta)/((1-tan^2theta)^3)(1-6tan^2theta+4tan^4theta)=4tanθ(1−tan2θ)3(1−6tan2θ+4tan4θ)
cos8theta=1-2sin^2 4theta=1-2(2sin2thetacos2theta)^2cos8θ=1−2sin24θ=1−2(2sin2θcos2θ)2
=1-8sin^2 2thetacos^2 2theta=1-8sin^2 2theta(1-sin^2 2theta)=1−8sin22θcos22θ=1−8sin22θ(1−sin22θ)
=1-8(2sinthetacostheta)^2(1-(2sinthetacostheta)^2)=1−8(2sinθcosθ)2(1−(2sinθcosθ)2)
=1-32sin^2thetacos^2theta(1-4sin^2thetacos^2theta)=1−32sin2θcos2θ(1−4sin2θcos2θ)
=1-32sin^2thetacos^2theta+128sin^4thetacos^4theta=1−32sin2θcos2θ+128sin4θcos4θ
Combining these results:
f(theta)=tan4theta+sin2theta+3cos8theta=f(θ)=tan4θ+sin2θ+3cos8θ=
(4tantheta)/((1-tan^2theta)^3)(1-6tan^2theta+4tan^4theta)+2sinthetacostheta+3-96sin^2thetacos^2theta+384sin^4thetacos^4theta4tanθ(1−tan2θ)3(1−6tan2θ+4tan4θ)+2sinθcosθ+3−96sin2θcos2θ+384sin4θcos4θ