Spherical law of cosines
Find side c of a spherical triangle from sides a and b and the angle C between them, or recover C from all three sides: sides of 1 and 1 with an angle of 1 radian give a third side of 0.830509. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Side a
- 1
- Side b
- 1
- Angle C
- 1
- Calculate
- Side c
- Decimal places
- 6
- Side c
- 0.830509
Solve side c or angle C on a unit sphere (radians). Search intent: spherical law of cosines. No network calls or random seeds are required. Failed jobs are not billed.
What the spherical law of cosines says
On a sphere, the sides of a triangle are arcs rather than straight lines, so the flat law of cosines no longer fits. The spherical version links the three sides and one angle: the cosine of side c equals the cosine of a times the cosine of b, plus the sine of a times the sine of b times the cosine of C. This calculator works on a sphere of radius 1, where every side is measured in radians as the angle it spans at the centre. It runs in two directions: give two sides and the angle between them to get the third side, or give all three sides to get the angle C.
Getting a reliable answer
The most common slip is typing degrees where radians are expected: a side of 1 means one radian, not one degree. The second is mixing up the angles: C is the angle opposite side c, the one formed where sides a and b meet. Every value is checked before any arithmetic, so a missing or impossible entry is refused with a message instead of producing a misleading number. If you ask for a fixed number of decimals, the result is rounded only once, with halves rounded up, from the full-precision value. The worked case of sides 1 and 1 with an angle of 1 radian always gives 0.830509.
What you can do with it
Teaching
Pinned goldens.
FAQ
How do I find the third side of a spherical triangle?
Choose to solve for side c, then enter sides a and b and the angle C between them, all in radians. With a and b of 1 and C of 1, the third side comes out as 0.830509.
Can it work out the angle instead of the side?
Yes. Switch to solving for angle C and enter the three sides a, b and c in radians. The calculator rearranges the same law to recover the angle opposite side c.
Should I enter degrees or radians?
Radians, for both the sides and the angle. The triangle sits on a sphere of radius 1, so each side is measured as an angle seen from the centre. Convert any value in degrees before you enter it.
How is this different from the ordinary law of cosines?
The ordinary law works on a flat triangle with straight sides. Here the sides are arcs on a sphere, so the rule mixes cosines and sines of the sides: cos c equals cos a cos b plus sin a sin b cos C.
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/math/spherical-law-of-cosines \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"side_a":1,"side_b":1}'const res = await fetch("https://api.kit.forhosting.com/math/spherical-law-of-cosines", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"side_a": 1,
"side_b": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/spherical-law-of-cosines",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"side_a": 1,
"side_b": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/spherical-law-of-cosines", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"side_a":1,"side_b":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"side_a":1,"side_b":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/spherical-law-of-cosines", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"side_a": 1,
"side_b": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.spherical_law_of_cosines",
"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
The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos.
How it works
Solve side c or angle C on a unit sphere (radians). cos c = cos a cos b + sin a sin b cos C. No network calls or random seeds are required. Failed jobs are not billed. No network calls or random seeds are required. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets,
Inputs, limits and rounding
Optional decimals use half-up once. Optional output fields are omitted, never null. No network calls or random seeds are required. Failed jobs are not billed. No network calls or random seeds are required. Provide required JSON fields with DOM-safe names. Invalid types raise invalid_input. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks,
When to use it
Use when search intent matches. Solve side c or angle C on a unit sphere (radians). EN-only delivery; Nitro hydrates locales. No network calls or random seeds are required. Failed jobs are not billed. No network calls or random seeds are required. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or teaching demos. The calculator is free in the browser, deterministic, and identical on the API path. Inputs are validated before arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE values when decimals are requested. Use the same JSON from spreadsheets, CMS hooks, automation, or
Integration use cases
Quick check
Free widget.
Automation
API same JSON.
Technical questions
Free?
Yes tier A.
Network?
No.
Bad input?
invalid_input.
API?
Yes.
Locales?
EN-only; Nitro hydrates.