Direct proportion calculator
This direct proportion calculator turns one known pair into a reusable constant of proportionality, then applies that constant to a new input.
Run — free
Enter a known x value, its matching y value, and the target x value. The result shows both the constant and the predicted target y, with the relationship and calculation written out for checking. It is designed for quantities that scale together at an unchanged rate, including unit pricing, recipe amounts, distance at constant speed, production estimates, map scales, and measurement conversions with no offset.
Decide whether the relationship is directly proportional
A direct proportion has the form y = k × x, where k is a constant that does not change between matching pairs. This means that multiplying x by any factor multiplies y by exactly the same factor. If five identical items cost twelve units, doubling the number of items doubles the cost when there are no fixed charges, discounts, or changing rates. That is a suitable direct proportion. Before calculating, ask whether a zero input would naturally produce a zero output and whether the ratio y divided by x stays constant. Both conditions are useful signals. The calculator is not appropriate for a relationship with a starting fee, because that needs an added intercept. It is also unsuitable for inverse proportion, where increasing one quantity makes the other decrease so their product remains constant. Curved growth, tiered pricing, bulk discounts, taxes added after a threshold, and rates that change over time need different models. Identifying the relationship first prevents a precise-looking answer from being applied to a situation that does not actually scale at one constant rate.
Find the constant from the known pair
Enter the complete observed pair as known_x and known_y. The calculator divides known_y by known_x to obtain the constant of proportionality k. For example, if five meters of material weigh twelve kilograms, the constant is 12 ÷ 5, or 2.4 kilograms per meter. That constant carries the meaning of the relationship, including its compound unit, so it is worth labeling it when you use the result elsewhere. The known x value cannot be zero because division by zero cannot establish a unique rate from the pair. Negative and decimal values are accepted for algebraic uses, but your real-world subject may impose additional limits. Keep units consistent: do not pair meters in the known value with centimeters in the target unless you convert one of them first. Numeric strings are normalized, and every input must represent a finite number. The returned relationship writes the result as y = k × x, making the rate explicit and easy to compare with a formula, worksheet, specification, or earlier observation.
Predict and check the matching target value
After finding k, the calculator multiplies it by target_x to predict target_y. With the five-meter and twelve-kilogram pair, a target of eight meters produces 2.4 × 8, or 19.2 kilograms. The response includes the constant, predicted value, symbolic relationship, and substituted calculation so you can audit how the number was produced. Check direction before accepting it: for a positive direct proportion, a larger positive x should produce a larger y, while halving x should halve y. You can also divide the returned target_y by target_x and compare that ratio with the reported constant, provided target_x is not zero. Small display differences can occur when decimal fractions cannot be represented exactly in binary, so the calculator stabilizes numeric output to practical precision. Apply domain-specific rounding only after the proportional result is found. Currency may require two decimal places, packaging may require rounding upward to whole units, and scientific work may require significant figures based on measurement accuracy. Automated API calls cost $0.002 each and use the same deterministic calculation without network access, randomness, or changing external data.
What you can do with it
Scale ingredient quantities
Derive an amount per serving from a known recipe and predict the required amount for a different serving count.
Estimate constant-rate costs
Find the unit-price constant and calculate a matching cost when no fixed fees, discounts, or price tiers apply.
Convert proportional measurements
Use one trusted measurement pair to predict another value for map scales, production rates, or unit conversions without an offset.
FAQ
What formula does the calculator use?
It calculates constant = known_y ÷ known_x, then target_y = constant × target_x.
What does the constant mean?
The constant is the amount of y per one unit of x. Its unit depends on the quantities you enter.
Can known_x be zero?
No. A known_x of zero would require division by zero and cannot establish a unique proportional constant.
Does this calculator handle inverse proportion?
No. It is only for quantities that scale together with a constant ratio y divided by x.
How much does an API calculation cost?
Each API request costs $0.002. The calculation is deterministic and requires no external service.
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/algebra/direct-proportion \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"known_x":5,"known_y":12,"target_x":8}'const res = await fetch("https://api.kit.forhosting.com/algebra/direct-proportion", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"known_x": 5,
"known_y": 12,
"target_x": 8
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/direct-proportion",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"known_x": 5,
"known_y": 12,
"target_x": 8
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/direct-proportion", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"known_x":5,"known_y":12,"target_x":8}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"known_x":5,"known_y":12,"target_x":8}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/direct-proportion", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"known_x": 5,
"known_y": 12,
"target_x": 8
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.direct_proportion",
"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. |