We start with the double angle identities :
#sin(2 theta) = 2 sin theta cos theta#
and
#cos(2 theta) = cos^2 theta - sin^2 theta = 2cos^2 theta-1 = 1-2sin^2 theta#
Now
#cos (4 theta) = cos(2times 2theta)#
#qquadqquadqquad = 1-2 sin^2(2theta)#
#qquadqquadqquad = 1-2(2 sin theta cos theta)^2#
#qquadqquadqquad = 1-8sin^2theta cos^2theta#
and
#sin(4 theta) = sin(2 times 2theta)#
#qquadqquadqquad = 2 sin(2theta)cos(2theta)#
#qquadqquadqquad = 2(2 sin theta cos theta)(1-2sin^2theta)#
#qquadqquadqquad = 4 sin theta cos theta (1-2 sin^2 theta)#
leading to
#tan(4theta) = sin(4 theta)/cos(4 theta)#
#qquadqquadqquad = (4 sin theta cos theta (1-2 sin^2 theta))/(1-8sin^2theta cos^2theta)#
Thus
#f(theta) = -tan(4 theta)+sin(2 theta)+cos(4 theta)#
#qquad\ quad=-(4 sin theta cos theta (1-2 sin^2 theta))/(1-8sin^2theta cos^2theta)#
#qquadqquad -2sin theta cos theta+1-8sin^2theta cos^2theta#