Math & Engineering
Cotangent (COT), Cosecant (CSC) & Secant (SEC) Roof Pitch & Optical Formulas
Calculate cotangent, cosecant, and secant from degree or radian angles using exact COS/SIN and 1/SIN identities while guarding 0 and 180 degree singularities.
Use COS(x)/SIN(x) rather than 1/TAN(x) so 90 degrees evaluates cleanly to 0
Structural truss, surveying, and optical Snell-law sheets rely on cotangent cot(theta) = Horizontal Run / Vertical Rise and cosecant csc(theta) = Slant Hypotenuse / Vertical Rise. Defining cot(theta) as COS(RADIANS(deg)) / SIN(RADIANS(deg)) rather than 1 / TAN(RADIANS(deg)) stays well-behaved at 90 degrees (where sin = 1 and cos = 0, giving exact 0).
Because sin(theta) vanishes at integer multiples of 180 degrees (MOD(deg, 180) = 0), guarding MOD(B2, 180) = 0 catches exact cotangent and cosecant vertical asymptotes cleanly instead of leaking #DIV/0!.
| Pitch Angle (deg) | cot(theta) = cos/sin | csc(theta) = 1/sin | Horizontal Run (Rise = 4m) | Rafter Length (Rise = 4m) |
|---|---|---|---|---|
| 30 deg | 1.732051 | 2.000000 | 6.9282 m | 8.0000 m |
| 45 deg | 1.000000 | 1.414214 | 4.0000 m | 5.6569 m |
| 90 deg | 0.000000 | 1.000000 | 0.0000 m | 4.0000 m |
| 0 or 180 deg | Undefined | Undefined | Singularity Guard | Singularity Guard |
Singularity-Safe Cotangent from Angle in Degrees
Guards multiples of 180 degrees and returns cot(B2) rounded to 6 decimals.
=IF(MOD(B2, 180) = 0, "Undefined Singularity", ROUND(COS(RADIANS(B2)) / SIN(RADIANS(B2)), 6))Rafter Slant Length Using Cosecant (Rise * csc(theta))
Computes slant hypotenuse length B3 / SIN(RADIANS(B2)) for vertical rise B3.
=IF(OR(MOD(B2, 180) = 0, B3 <= 0), "Invalid Angle or Rise", ROUND(B3 / SIN(RADIANS(B2)), 4))Try the example
Use the original values or change them to test your understanding.