Use the Double Argument Property
#cos 2 theta=2cos^2 theta -1#---> If we solve for #cos^2 theta# then we have #color(red)(cos^2 theta =1/2 (cos 2theta+1))#
#cos 4 theta=2cos^2 2theta -1#
#=2(cos 2 theta)^2-1#
#=2(2cos^2theta-1)^2-1#
#=2(4cos^4 theta-4 cos^2 theta +1)-1#
#=8cos^4 theta-8cos^2 theta +2-1#
#=8cos^4 theta-8cos^2 theta +1#--> If we put in #1/2 (cos 2theta+1)# for #cos^2 theta# we have
#=8cos^4 theta-8(1/2 (cos 2 theta+1)) +1#
#=8cos^4 theta-4 (cos 2 theta+1) +1#
#=8cos^4 theta-4 cos 2 theta-4 +1#
#=8cos^4 theta-4 cos 2 theta-3#---> Now solve for #cos^4 theta#
#color(red)(1/ 8 (cos 4 theta+4cos 2 theta+3)= cos^4 theta #
Therefore,
#f(theta)=-cos^2 theta-7 sec^2 theta-5 sec^4 theta#
#=-cos^2 theta -7/cos^2 theta - 5 / cos^4 theta#
#=-1/2 (cos 2theta+1)-7/(1/2 (cos 2theta+1)) - 5 /(1/ 8 (cos 4 theta+4cos 2 theta+3))#
#:.color(blue)(f(theta)=-1/2 (cos 2theta+1)-14/(cos 2theta+1)- 40/(cos 4 theta+4cos 2 theta+3)#