using the reduction formula of #secx^n#
#intsecx^ndx#=#intsecx^(n-2)*secx^2dx#
integrate #intsecx^(n-2)*secx^2dx# by parts (#uv- intvdu#)
where #u=secx^(n-2)# and #dv=secx^2#
therefore #intsecx^(n-2)*secx^2dx#
=#tanx*secx^(n-2)-(n-2)inttan^2*secx^(n-2) dx#
=#tanx*secx^(n-2)-(n-2)int(secx^2-1)*secx^(n-2)dx#
=#tanx*secx^(n-2)-(n-2)intsecx^n*secx^(n-2)dx#
if #I_"n"=intsecx^ndx#
therefore
#I_"n"=tanx*secx^(n-2)-(n-2)intsecx^n-secx^(n-2)dx#
#I_"n"=tanx*secx^(n-2)-(n-2)I_n+(n-2)I_"n-2"#
#(n-1)I_"n"=tanx*secx^(n-2)+(n-2)I_"n-2"#
#I_"n"=1/(n-1)*(tanx*secx^(n-2))+(n-2)/(n-1)I_"n-2"#
Where #I_"n"=intsecx^ndx# and #I_"n-2"#=#intsecx^(n-2)dx#
Substitute every n with 4 in #I_"n"=1/(n-1)*(tanx*secx^(n-2))+(n-2)/(n-1)I_"n-2"#
Therefore
#intsecx^4dx=1/3 secx^2*tanx-1/2intsecx^2dx#
=#1/3 secx^2*tanx-1/2tanx#
This method can be used to integrate sec x to the power of anything as long as the power is bigger than 1