MySQL COT() Function: Calculate cotangent

COT() returns the cotangent of an angle measured in radians, which is the reciprocal of TAN() where defined.

COT(): Quick SQL Example

Run this SELECT query directly in MySQL or phpMyAdmin. It uses fixed inputs so you can verify the result without creating a table.

SELECT ROUND(COT(RADIANS(45)), 2) AS cotangent_value;
cotangent_value
1.00
On this page — Show page sectionsHide page sections

More SQL Examples and Explanations

COT(X) returns the cotangent of X in radians. Cotangent is undefined where the sine is zero; for example, COT(0) produces an out-of-range error in current MySQL rather than a normal numeric result.

SELECT ROUND(COT(PI() / 2), 2); -- Output: 0.00
SELECT ROUND(COT(PI() / 3), 2); -- Output: 0.58
SELECT COT(1); -- Finite cotangent value

Syntax

SELECT COT(X);

Use PI() for π and ROUND() when you need fewer decimal places.

COT() with RADIANS()

SELECT COT(RADIANS(45)); -- Output: 1
SELECT ROUND(COT(RADIANS(90)), 2); -- Output: 0.00
-- Avoid 0°, 180° and other points where cotangent is undefined

How to Interpret the Result

COT(0) produces an out-of-range error in MySQL. Do not use COT() where the sine is zero.

Common Question

Can I use degrees directly with COT()?
No. Use RADIANS() to convert degree values before calculation.

Related: ASIN()

↑ Back to top




Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer