ForHosting KIT · Developer Utilities

Cosine of a difference calculator

The cosine of a difference calculator evaluates cos(A − B) by applying cos(A)cos(B) + sin(A)sin(B) to two supplied angles.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter both angles in degrees or radians, and the result shows the sine and cosine of each angle, the two products, their sum, and the final value. This makes the calculator useful for getting a numerical answer and for checking every stage of textbook work without hiding the identity behind a single calculator key.

Set up the two angles in the correct order

Enter the first angle as A and the second angle as B, then select the unit that applies to both. The calculator evaluates cos(A − B), so it subtracts B from A before describing the difference. Although cosine is an even function and cos(A − B) equals cos(B − A), keeping the requested order is still important when you compare the output with a written exercise or reuse the displayed difference in later work. Degrees are the default and are convenient for familiar values such as 30, 45, 60, and 90. Choose radians when the angles come from calculus, programming, physics, or a formula already expressed in radians. Do not convert one angle while leaving the other unchanged: the selected unit is shared by both inputs. Negative angles and angles outside one full turn are accepted because the sine and cosine functions are periodic and remain defined for every finite real angle. The output repeats both inputs and their difference so you can verify the setup before trusting the arithmetic.

Follow the cosine difference identity term by term

The calculation uses the identity cos(A − B) = cos(A)cos(B) + sin(A)sin(B). First, it finds cosine A and cosine B and multiplies them to produce the cosine product. Next, it finds sine A and sine B and multiplies those values to produce the sine product. Finally, it adds the two products. The plus sign is the detail most often confused with the cosine sum identity: subtracting the angles inside cosine produces addition between the products, while adding the angles produces subtraction between them. The response exposes cosine_a, cosine_b, sine_a, sine_b, cosine_product, and sine_product before returning value, so each line of a manual solution can be checked independently. Results are rounded to twelve decimal places to suppress insignificant binary floating-point noise while retaining ample precision for ordinary numerical work. Values extremely close to zero are returned as zero, avoiding distracting results such as a tiny scientific-notation remainder where exact-angle mathematics expects zero.

Interpret and verify the returned value

The final value is the sum of the two displayed products and represents the cosine of the angle difference. Like every cosine value for a real angle, it should lie between −1 and 1, inclusive. A value near 1 means the two directions are close after periodicity is considered; a value near 0 means their difference is near a right angle; and a value near −1 means their directions are nearly opposite. This geometric interpretation makes the result useful beyond identity exercises, including comparing headings, resolving phase differences, checking rotations, and computing normalized directional similarity. For a quick independent check, subtract the input angles and evaluate the cosine of that single difference using the same unit. The direct result and the identity result should agree apart from normal rounding. The endpoint returns transparent numeric components rather than a symbolic proof, so it is best suited to supplied numerical angles. It does not parse expressions such as pi/6, infer mixed units, or simplify variables. API automation costs $0.002 per item, while the generated browser calculator uses the same deterministic solving function.

Check a trigonometry exercise

Compare every sine, cosine, product, and final sum with a handwritten use of the cosine difference identity.

Compare two directions

Evaluate the cosine of the angular separation between headings, bearings, or two-dimensional orientations.

Verify phase calculations

Compute the cosine of a degree or radian phase difference while retaining the intermediate terms for an audit trail.

Which identity does the calculator use?

It uses cos(A − B) = cos(A)cos(B) + sin(A)sin(B).

Can I enter degrees or radians?

Yes. Select deg or rad; the selected unit applies to both angles.

Why is there a plus sign in the formula?

For cosine, a difference inside the function corresponds to addition between the cosine product and sine product.

Are negative angles accepted?

Yes. Any finite real numeric angles are accepted, including negative angles and values beyond one full turn.

Why are results rounded?

The calculator rounds to twelve decimal places to remove insignificant floating-point artifacts while preserving practical precision.

What does an API calculation cost?

Each API item costs $0.002; the browser calculator is free to use.

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/trig/cos-difference

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/trig/cos-difference \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"angle_a":60,"angle_b":30}'
{
  "angle_a": 60,
  "angle_b": 30
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "trig.cos_difference",
  "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.

Read the full KIT documentation →