Tangent from sine and cosine calculator
Divide sine by cosine and read the tangent at once: a sine of 0.6 with a cosine of 0.8 gives 0.7499999999999999, the plain machine ratio with no hidden rounding. A zero cosine is stopped, never shown as infinity. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Sine
- 0.6
- Cosine
- 0.8
- Tangent
- 0.75
This tangent from sine and cosine calculator finds tangent directly from two values you already know. Enter a finite sine value and a finite cosine value, and it applies the identity tangent equals sine divided by cosine. The calculator does not need the original angle, an angle unit, or an inverse trigonometric step.
How tangent is obtained from sine and cosine
The sine value becomes the numerator, the cosine value becomes the denominator, and one deterministic division produces tangent. For example, a sine of 0.5 and a cosine near 0.8660254037844386 produce a tangent near 0.5773502691896257. The algorithm does not call an angle function, infer degrees or radians, normalize the pair, or adjust the values to force the identity sin squared plus cos squared equals one.
It calculates the requested ratio exactly from the supplied finite values. This makes it suitable both for genuine trigonometric pairs and for ratio checks in intermediate numerical work where the two components may already include rounding.
Why cosine equal to zero makes tangent undefined
Cosine is the denominator in the identity tan(theta) = sin(theta) / cos(theta), so a cosine value of zero makes the quotient undefined. In geometric terms, this occurs at angles such as 90 degrees and 270 degrees, where a vertical direction has no finite rise-over-run slope. In arithmetic terms, division by zero cannot yield a finite real tangent.
Notice that the rule is based on equality to zero, as stated by the formula. A very small but nonzero cosine is accepted and may produce a very large finite tangent; that result reflects the exact values submitted by the caller. Sine may equal zero without causing a domain problem when cosine is nonzero: the valid tangent is then zero.
These explicit rules make errors predictable for classroom work and safe for automated consumers that should never have to interpret JavaScript Infinity or NaN.
Using the calculator accurately in study and software
Begin by copying the sine and cosine values from the same angle or the same stage of your calculation. Place sine in the sine field and cosine in the cosine field; swapping them computes cotangent instead, so field order matters. Keep enough digits from the source to avoid unnecessary rounding error, especially when cosine is close to zero and a small denominator magnifies changes in the quotient.
The calculator returns the direct floating-point ratio without choosing a display precision or pretending that rounded inputs are exact symbolic values. For a homework check, compare the result with the tangent printed by your scientific calculator while confirming that both sine and cosine came from the same angle mode. Interactive browser use is free.
What you can do with it
Complete a trigonometry exercise
Find tangent when a problem gives sine and cosine but does not provide the original angle.
Check a computed ratio
Verify that an existing tangent value matches the sine-to-cosine quotient from the same calculation.
Create deterministic test data
Generate a structured tangent result or a predictable zero-cosine error for automated tests and teaching tools.
FAQ
What formula does the calculator use?
It uses tangent = sine / cosine, provided cosine does not equal zero.
Can sine be zero?
Yes. When sine is zero and cosine is nonzero, tangent is zero.
Do sine and cosine have to come from a valid unit-circle point?
No. The calculator validates finite numeric inputs and divides them; it does not enforce sin squared plus cos squared equals one.
What happens if the cosine is zero?
The tangent does not exist, because you would be dividing by zero. That happens at angles such as 90° and 270°. The calculator gives a clear message instead of infinity or a misleading huge number.
What do I get if I swap sine and cosine?
You get the cotangent instead of the tangent, because the order decides which value is divided by which. Put the sine first and the cosine second, both taken from the same angle.
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/tan-from-sin-cos \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"sine":0.5,"cosine":0.8660254037844386}'const res = await fetch("https://api.kit.forhosting.com/trig/tan-from-sin-cos", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"sine": 0.5,
"cosine": 0.8660254037844386
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/trig/tan-from-sin-cos",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"sine": 0.5,
"cosine": 0.8660254037844386
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/trig/tan-from-sin-cos", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"sine":0.5,"cosine":0.8660254037844386}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"sine":0.5,"cosine":0.8660254037844386}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/trig/tan-from-sin-cos", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"sine": 0.5,
"cosine": 0.8660254037844386
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "trig.tan_from_sin_cos",
"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
If cosine equals zero, the ratio is undefined, so the request returns a clear validation error rather than Infinity or a misleading decimal. Browser calculations are free, while a successful API request costs $0.002 for reproducible use in worksheets, scripts, tests, and data pipelines.
How tangent is obtained from sine and cosine
For any angle where cosine is not zero, tangent is defined by the quotient of sine and cosine: tan(theta) = sin(theta) / cos(theta). This calculator starts with those two function values rather than starting with theta itself. That distinction is useful when a triangle problem, measurement table, simulation, or earlier calculation has already supplied sine and cosine. Inputs may be ordinary JSON numbers or strictly formatted numeric strings, but both must resolve to finite real numbers.
Why cosine equal to zero makes tangent undefined
The calculator therefore rejects both positive zero and negative zero with an invalid_input error that names cosine and explains the undefined result. It deliberately does not return Infinity, a very large substitute, or null, because each would blur the mathematical domain boundary and could silently contaminate later calculations. The final ratio must itself remain finite, so extreme finite inputs whose division overflows are also rejected instead of emitting a non-JSON numeric value.
Using the calculator accurately in study and software
The API charges $0.002 for each successful request, allowing scripts, spreadsheets, educational systems, and test pipelines to use the identical calculation through a stable structured response.
Technical questions
What happens when cosine is zero?
The calculator returns invalid_input because division by zero makes tangent undefined. It does not return Infinity.
How much does the API calculation cost?
Interactive browser use is free. Each successful API request costs $0.002; invalid inputs are not charged.