Solving a basic trigonometric equation involving tangent, cotangent, secant or cosecant