ForHosting KIT · Math

Cofunction calculator

Evaluate any trig function through its partner at the complementary angle, so sin(30) becomes cos(60), which is 0.5, and you see the cofunction and the complement spelled out. Works for all six functions, at any angle. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Function
sin
Angle
30
You get
Value
0.5
Cofunction
cos
Angle degrees
30
Complement degrees
60

Send a function name and an angle and you get back the cofunction used, the complementary angle, and the numeric value rounded to twelve decimal places.

What a cofunction is

Trigonometric functions come in complementary pairs: sine and cosine, tangent and cotangent, secant and cosecant. The 'co' prefix literally means complementary: cosine is the sine of the complementary angle. Two angles are complementary when they add up to 90 degrees, and the cofunction identities state that each function of an angle equals its paired cofunction of the complement — sin(theta) = cos(90 - theta), cos(theta) = sin(90 - theta), tan(theta) = cot(90 - theta), cot(theta) = tan(90 - theta), sec(theta) = csc(90 - theta) and csc(theta) = sec(90 - theta).

These are exact identities, not approximations: they follow directly from the geometry of a right triangle, where the two acute angles are always complementary and the side opposite one of them is adjacent to the other. So sin(30) is exactly cos(60), which is 0.5, and tan(75) is exactly cot(15). This calculator takes a function name and an angle in degrees, computes the complementary angle 90 minus the angle, evaluates the paired cofunction there, and returns the value rounded to twelve decimal places so the published output is byte-stable across machines.

Input, validation and edge cases

Two families of edge cases get special attention. First, the functions that blow up: tangent and secant are undefined at odd multiples of 90 degrees because cosine vanishes there, and cotangent and cosecant are undefined at multiples of 180 degrees because sine vanishes there. The calculator detects those angles explicitly and rejects them with a message saying the function is undefined at that angle, rather than returning a huge float, Infinity or NaN that would poison every downstream computation.

Second, angles are not clamped to 0-90: the cofunction identities hold for any real angle, so sin(120) correctly routes to cos(-30), and both directions are handled by the same code path. Validation happens once, at the boundary, exactly where an automated pipeline needs it.

Why compute through the complement at all

If you can compute sin(theta) directly, why route it through cos(90 - theta)? Three practical reasons. First, education: cofunction identities are a core exam topic, and seeing sin(53) returned as cos(37) with the complement spelled out makes the identity concrete instead of memorized.

Third, legacy and hardware constraints: some embedded libraries and old lookup tables implement only one function per pair, and verifying that a sine-only table produces the right cosine via the complement is exactly the check this calculator performs.

Rewrite an expression into one family

Convert cosine terms into sines when simplifying a trig equation: cos(42) comes back as sin(48) with the numeric value attached.

Which functions are supported?

The six standard ones: sin, cos, tan, cot, sec and csc, case-insensitive.

What exactly is the cofunction value?

Each function is evaluated through its complementary identity: sin(theta) = cos(90 - theta), tan(theta) = cot(90 - theta), sec(theta) = csc(90 - theta), and the same three pairs in reverse.

Does the angle have to be between 0 and 90?

No. The identities hold for any finite angle in degrees, so sin(120) is correctly computed as cos(-30).

Is my input stored?

No. The function name and angle are used for the calculation and discarded; only the computed result is returned.

Why is tangent undefined at 90 degrees?

Because tangent divides by cosine, and cosine is zero at 90 degrees. The calculator rejects such angles with a message saying the function is undefined there, instead of returning a huge or meaningless number. Cotangent and cosecant fail the same way at multiples of 180 degrees.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/math/cofunction

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/math/cofunction \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"function":"sin","angle":30}'
{
  "function": "sin",
  "angle": 30
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.cofunction",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

The cofunction calculator evaluates a trigonometric function at any angle in degrees by routing it through its paired cofunction at the complementary angle: sin(theta) equals cos(90 - theta), tan(theta) equals cot(90 - theta), and sec(theta) equals csc(90 - theta) — with each pair working in both directions. Unsupported function names and non-finite angles are rejected with a clear invalid_input error, and angles where the function is undefined — tan at 90 degrees, csc at 0 — fail loudly instead of returning Infinity or NaN. The exact same module runs free in your browser on this page; you only pay $0.002 per request through the API.

What a cofunction is

The response echoes the function, its cofunction, your angle and the complement, which makes every result self-describing in a log or an audit trail.

Input, validation and edge cases

The API accepts two fields: 'function', one of the six names sin, cos, tan, cot, sec or csc (case-insensitive, with aliases fn and func), and 'angle', a finite number of degrees (with aliases theta and degrees). Anything else is rejected before any arithmetic happens: an unrecognized function name, a missing field, an angle of NaN or Infinity all produce an invalid_input error that names the offending field and what was expected, so client mistakes never turn into silent numeric garbage.

Why compute through the complement at all

Second, simplification: rewriting an expression so all its functions share a family — everything in sines, or everything in tangents — is a standard step in solving trig equations and proving identities, and this endpoint does that rewrite numerically on demand. The computation itself is trivial, but doing it through a strict, validated endpoint means the same answer every time: deterministic, with no network calls, no randomness and no stored state. The identical module powers the free calculator on this page, so the browser and the API can never disagree, and API calls cost $0.002 per request with no per-unit surcharge — cheap enough to validate every call in a pipeline rather than sampling a few.

Verify a cofunction identity

Check that sin(30) equals cos(60) numerically: send function=sin and angle=30 and read the value computed through the complementary angle.

Validate angles in a pipeline

Send every computed angle through the API: undefined cases like tan(90) are rejected loudly instead of propagating Infinity downstream.

What does it cost?

$0.002 per request via the API. It is also free and unlimited to run in your browser on this page.

What happens at angles where the function is undefined?

Angles like tan(90) or csc(0) are rejected with an invalid_input error stating the function is undefined there — never Infinity or NaN.

Read the full KIT documentation →