Sum and difference angle calculator
Combine two angles without guessing: 30° and 45° give a sum of 75° and a difference of −15°, each with its sine, cosine and tangent. If the tangent of the result does not exist, you are told so. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- First angle measure
- 30
- Second angle measure
- 45
- Operation
- both degrees
- A degrees
- 30
- B degrees
- 45
- A radians
- 0.5235987756
The angle-sum and angle-difference identities are the standard way to evaluate sine, cosine, and tangent of a combined angle without first adding or subtracting on a calculator and then pressing a single trig key. Given two finite measures a and b, this calculator returns sin(a+b), cos(a+b), and tan(a+b), and optionally the same trio for a−b, by expanding the classical product forms: sine of a sum is sin a cos b plus cos a sin b, cosine of a sum is cos a cos b minus sin a sin b, and the difference formulas flip the inner signs.
How the sum and difference identities work
Start with two real angles a and b expressed in the same unit. Convert both to radians for evaluation if the caller sent degrees, then compute sin a, cos a, sin b, and cos b once. The sum identities state that sin(a+b) equals sin a cos b plus cos a sin b, and cos(a+b) equals cos a cos b minus sin a sin b.
The difference identities use the same products with a sign flip on the mixed terms: sin(a−b) equals sin a cos b minus cos a sin b, and cos(a−b) equals cos a cos b plus sin a sin b. Tangent of the combined angle is then the ratio of the corresponding sine to cosine, which is defined only when cosine is not zero. That geometric condition means a+b or a−b is not an odd multiple of ninety degrees (or of π/2 in radians).
Using the sin-over-cos form after the identities, rather than the textbook tan formula that divides by one minus tan a tan b, avoids false failures when an individual angle sits on a vertical asymptote while the combined angle remains well-defined. Because the path uses only floating-point sine, cosine, multiplication, and addition, it is fully deterministic: the same numeric pair always yields the same rounded components and combined values within ordinary double precision. There is no sampling, no random seed, and no network call—only validation and pure trigonometry.
What you send and what you get back
Optionally set unit to degrees (the default) or radians; short forms deg and rad are accepted and matching is case-insensitive. Optionally set operation to sum, difference, or both (the default); synonyms plus, minus, and all are accepted. Classic check: thirty degrees and forty-five degrees yield sin seventy-five degrees about zero point nine six six and tan of negative fifteen degrees about negative zero point two six eight.
Requesting sum alone for sixty degrees plus thirty degrees fails because cos of ninety degrees is zero and tan is undefined. Wire the free browser tool for quick homework checks, then call the identical contract from scripts when you need bulk identity evaluation without reimplementing the expansions in every language.
What you can do with it
Homework and exam checks
Expand sin, cos, and tan of a+b or a−b with the classical identities and verify against known exact values such as thirty and forty-five degrees.
Phase and heading combination
Combine two orientation or phase angles and obtain the sine and cosine of the sum or difference for graphics, audio, or navigation pipelines.
FAQ
What formulas does this calculator use?
It uses the classical angle-sum and angle-difference identities: sin(a±b) = sin a cos b ± cos a sin b and cos(a±b) = cos a cos b ∓ sin a sin b. Tangent is then sin of the combined angle divided by cos of the combined angle.
Does it accept radians as well as degrees?
Yes. Set unit to "radians" (or "rad"). The default unit is degrees. The response always includes both degree and radian fields for each input and for each combined angle.
When is tangent undefined?
When cosine of a+b or a−b is zero (the combined angle is an odd multiple of 90° or π/2). Example: 60° + 30° = 90°, so tan is undefined.
Can I compute only the sum or only the difference?
Yes. Set operation to "sum" or "difference". The default is "both", which returns sum and difference objects in one response (and fails if either tangent is undefined).
What does it cost?
The browser tool is free and runs locally.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/trig/sum-difference \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":30,"b":45}'const res = await fetch("https://api.kit.forhosting.com/trig/sum-difference", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 30,
"b": 45
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/trig/sum-difference",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 30,
"b": 45
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/trig/sum-difference", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":30,"b":45}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":30,"b":45}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/trig/sum-difference", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 30,
"b": 45
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "trig.sum_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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
When a resulting tangent is undefined—because cosine of the combined angle is zero—the request fails with invalid_input instead of inventing Infinity or NaN. The free browser tool and the paid API share one pure function, so demos and automated scripts stay aligned on every example.
What you send and what you get back
Provide two required finite numbers under the fields a and b, with aliases angle_a, alpha, first for a and angle_b, beta, second for b. Missing fields, empty strings, non-numeric text, NaN, and Infinity are rejected with invalid_input and are not charged. On success the JSON response echoes a, b, unit, and operation; reports a_degrees, b_degrees, a_radians, and b_radians; returns components with sin_a, cos_a, sin_b, and cos_b; includes method as the string angle_sum_difference_identities; and, for each requested combination, a sum and/or difference object with angle_degrees, angle_radians, sin, cos, and tan.
Where sum and difference formulas show up in real work
Surveying and navigation combine heading offsets; audio and signal processing add phase angles; game engines and CAD pipelines rotate orientations by successive increments and still need the exact sin and cos of the combined measure for basis vectors. If you later need a single reference angle, inverse cosine of a ratio, law-of-cosines angle solving, or a full right-triangle solver, treat those as separate search intents rather than overloading this sum-and-difference landing. Secondary-school and college trigonometry courses constantly ask students to expand sin of a plus b or cos of a minus b without a calculator, then check the numeric value against a table; a trusted API with a strict undefined-tangent gate speeds grading and removes spreadsheet mistakes where someone divides by a near-zero cosine. Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.
Integration use cases
Deterministic test fixtures
Generate stable sum-and-difference identity fixtures for unit tests and docs with the same pure function in browser and API.