Calculate cotangent with cot
cot(x) returns the cotangent of angle x in radians. It is the reciprocal of tangent and can be written cos(x) / sin(x). Cotangent is useful where a reciprocal slope or trigonometric ratio is the natural form.
Examples and relationships
cot(pi / 4) is 1. Because cotangent is built from cos and sin, it repeats every pi radians. Compare it with tan, which is its reciprocal wherever both are defined, and acot, which returns a principal inverse angle.
Poles and numerical care
Cotangent is undefined where sine is zero: at integer multiples of pi. Near those angles its magnitude becomes very large, so finite-precision calculations can be sensitive to small input errors. Test for the special case before dividing, especially in geometric formulas. csc has the same sine-zero restriction.
Practical use
In a right triangle, cotangent is adjacent over opposite when x is an acute angle. In coordinate geometry and wave calculations, expressing a result through cotangent can simplify a reciprocal tangent term. Keep units consistent: calculator trig functions expect radians, so convert degree measurements using pi.