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=2sinthetacostheta# and
#cos2theta=cos^2theta-sin^2theta=1-2sin^2theta#
From these deduce that
#tan2theta=(sin2theta)/(cos2theta)=(2sinthetacostheta)/(cos^2theta-sin^2theta)=(2tantheta)/(1-tan^2theta)#
We can now use these iteratively to deduce formulae for #4theta# and #8theta#.
#tan4theta=(2tan2theta)/(1-tan^2 2theta)=(2((2tantheta)/(1-tan^2theta)))/(1-((2tantheta)/(1-tan^2theta))^2)#
#=(4tantheta)/(1-tan^2theta)*((1-tan^2theta)^2-4tan^2theta)/((1-tan^2theta)^2)#
#=(4tantheta)/((1-tan^2theta)^3)(1-6tan^2theta+4tan^4theta)#
#cos8theta=1-2sin^2 4theta=1-2(2sin2thetacos2theta)^2#
#=1-8sin^2 2thetacos^2 2theta=1-8sin^2 2theta(1-sin^2 2theta)#
#=1-8(2sinthetacostheta)^2(1-(2sinthetacostheta)^2)#
#=1-32sin^2thetacos^2theta(1-4sin^2thetacos^2theta)#
#=1-32sin^2thetacos^2theta+128sin^4thetacos^4theta#
Combining these results:
#f(theta)=tan4theta+sin2theta+3cos8theta=#
#(4tantheta)/((1-tan^2theta)^3)(1-6tan^2theta+4tan^4theta)+2sinthetacostheta+3-96sin^2thetacos^2theta+384sin^4thetacos^4theta#