given u = cos(x), therefore du/dx=-sin(x), as tan(x)=sin(x)/cos(x), can rewrite tan(x)=(-du/dx)/u, therefore integral can become [(-1/u)du], after inegrating you are left with -ln(u)+c, therefore ln(1/u)+c, subbing back in leaves us with ln((1/cos(x)))+c