ForHosting KIT · Math

cos(2θ) calculator

Enter an angle θ in radians and get the cosine of its double, worked out as cos²θ minus sin²θ: a θ of 0.7853981634, a quarter of π, gives exactly 0. Angles in degrees need multiplying by π/180 first. 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
Theta
0.7853981634
You get
Theta
0.7853981634
Cos 2 theta
0
Identity
cos(2θ) = cos²(θ) − sin²(θ)

The cos(2θ) calculator takes an angle θ in radians and returns the cosine of its double, cos(2θ), evaluated through the double-angle identity cos²θ − sin²θ rather than by scaling the angle first. Double-angle cosine appears everywhere a phase is doubled: signal mixing, polarisation optics, gear kinematics, alternating-current power. The only input is a finite number in radians; anything else is rejected with a clear invalid-input error before any computation happens.

What cos(2θ) means and why it is computed with an identity

Doubling an angle and taking its cosine sounds like it should need no more than a multiplication and a call to cos. In floating-point arithmetic, though, evaluating cos(2θ) directly multiplies the input error in θ by two before the transcendental function ever runs, and near the peaks and zeros of the cosine curve that error can dominate the result.

The double-angle identity cos(2θ) = cos²θ − sin²θ sidesteps the problem: it works with cos θ and sin θ at the original angle, so the only amplified quantity is the one you actually care about. The identity is exact for every real θ, it requires no series truncation, and it costs two transcendental evaluations plus a handful of multiplications. That is why this calculator computes the value through the identity instead of calling cos(2·θ).

You pass one number — the angle θ in radians — and receive the value of cos(2θ), the θ you supplied echoed back, and the identity used, so the response documents itself in any pipeline or audit trail where it ends up.

Input rules: one finite number in radians

The contract is deliberately small. The field theta is required and must be a finite number, expressed in radians. What is not accepted is anything that fails to be a finite number: an empty field, a non-numeric string, NaN, Infinity, or a missing input object altogether.

Radians are the only unit because the double-angle identity is unitless and radian input avoids a conversion step that would add rounding before the computation begins — if your angle is in degrees, multiply by π/180 first.

Where the double-angle cosine shows up in practice

The doubled-angle cosine is the workhorse of any model where a phase is squared or a frequency is doubled. In electronics, mixing two sinusoids produces a term in cos(2ωt) that a demodulator has to predict. In mechanics, the resultant of two equal forces at angle θ and the stress transformation on a rotated element both reduce to cos(2θ) terms.

Check a polarisation calculation

Turn a Malus's-law cos²θ intensity into its (1 + cos 2θ)/2 form without doing the identity by hand for every angle.

Teach the double-angle identity

Show students that cos²θ − sin²θ and the direct cosine of the doubled angle agree exactly, from a single radian input.

What does it cost?

The same algorithm is free to run in your browser on this page.

What unit is the angle in?

Radians only. If your angle is in degrees, multiply it by π/180 before sending it.

Which identity is used?

cos(2θ) = cos²θ − sin²θ, evaluated from sin θ and cos θ at the original angle. The identity used is returned in the response.

What happens if the angle is not a number?

Non-numeric strings, NaN and Infinity are all refused.

Can I pass the angle as a string?

Yes. A numeric string like "0.5235987756" is parsed as a number; blank or non-numeric strings are rejected.

How precise is the result?

The value is computed in double precision and rounded to ten decimal places, so identical inputs always produce identical outputs.

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/cos-2-theta

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/cos-2-theta \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"theta":0.7853981633974483}'
{
  "theta": 0.7853981633974483
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.cos_2_theta",
  "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.

Input rules: one finite number in radians

A JSON number is the natural form, but a numeric string such as "1.0471975512" is accepted and converted, because form submissions and query strings arrive as text. Each of those cases is rejected with an invalid_input error and a message that says exactly which rule was broken, so a calling program can branch on the code instead of parsing prose.

Where the double-angle cosine shows up in practice

In optics, Malus's law for polarised light is a statement about cos²θ, which the identity rewrites as (1 + cos 2θ)/2 — the quantity this endpoint returns. The API costs $0.002 per request, and the identical algorithm runs free in the browser on this page, so you only pay when you automate the call.

Verify a signal-mixing model

Confirm the cos(2ωt) term your demodulator should produce at a given phase, with a golden-tested value you can pin in a regression test.

Read the full KIT documentation →