ForHosting KIT · Math

Direct variation calculator

Give one known pair and get the constant of variation with its equation: when x is 4 and y is 12, k is 3, so y equals 3x and an x of 7 gives a y of 21. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
X1
4
Y1
12
X2
7
You get
K
3
Equation
y = 3x
Variation
direct
Y2
21

Direct variation problems ask whether and how one quantity scales with another when the relationship is strictly proportional: y equals k times x for a fixed constant of proportionality k. Students meet this model in pre-algebra and Algebra I when comparing unit rates, scaling recipes, map distances, and simple physics statements such as distance proportional to time at constant speed. Tutors and LMS authors need a deterministic oracle that never invents a second constant or silently divides by zero when the given x is zero. This direct variation calculator accepts a known pair x1 and y1, computes k as y1 divided by x1, and optionally predicts y2 for a new x2 or x2 for a new y2 under the same k.

What direct variation means and how k is fixed from one pair

Direct variation is the statement that y varies directly as x, written y equals k times x or y is proportional to x with constant of proportionality k. Graphically the model is a straight line through the origin with slope k: double x and y doubles; triple x and y triples, including when k is negative so the quantities move in opposite directions. The constant k is completely determined by any single non-degenerate pair on the line.

Given known values x1 and y1 with x1 not equal to zero, divide: k equals y1 divided by x1. That single ratio is enough to write the explicit equation y equals kx and to evaluate the model anywhere else on the line. When x1 is zero the ratio is undefined, because every direct-variation graph already forces y to be zero at x equals zero; a nonzero y1 with x1 equals zero would contradict the model entirely.

When y1 is zero and x1 is not, k is zero and the model collapses to the constant function y equals zero for every x—still a valid direct variation, just a flat one. The solver echoes the pair, the rounded k, a short equation string such as y equals 3x, and a formula field restating k equals y1 over x1 and y equals kx so clients can display the identity next to the numeric answer without re-deriving it.

Where direct variation helps in practice

Classrooms and tutoring platforms use a direct variation calculator so learners can check the constant of proportionality and the predicted second pair without sign or cross-multiplication errors. Exam generators and LMS auto-graders need a deterministic oracle that rejects x1 equals zero and ambiguous dual targets instead of inventing roots. Keep requests small, pin the rounded k and predicted values in tests, and you get reproducible homework checks, LMS plugins, and edge workers without standing up symbolic math infrastructure of your own.

Classroom and homework checks

Students enter a known pair and a second x or y; verify k and the predicted value against textbook cross-multiplication methods.

Unit rates and scaling scripts

Scale map distances, recipe quantities, or linear-through-origin measurements in notebooks without importing a full CAS library.

How do I find k when y varies directly as x?

Send finite numbers x1 and y1 for any known pair on the line.

How do I predict a second value?

After the known pair, send either x2 to receive y2 = k·x2, or y2 to receive x2 = y2/k. Do not send both x2 and y2 in the same request.

Why must x1 be non-zero?

The constant of proportionality is k = y1/x1.

Can I find x when I know the new y?

Yes. Enter the new y instead of a new x and the same constant is used in reverse. With a constant of 3, a y of 21 brings you back to an x of 7.

What does a negative k mean in direct variation?

It means the two quantities move in opposite directions while staying proportional. The graph is still a straight line through the origin, only sloping downward instead of upward.

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/algebra/direct-variation

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/algebra/direct-variation \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"x1":4,"y1":12}'
{
  "x1": 4,
  "y1": 12
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.direct_variation",
  "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.

The free browser path and the paid API share one pure module, so homework checks and automation scripts always agree. Failed validation is not billed; successful calls use the published $0.002 base price with no model tokens and no outbound network.

What direct variation means and how k is fixed from one pair

This endpoint therefore rejects x1 equals zero with invalid_input rather than returning Infinity or a silent NaN.

Input contract, prediction modes, and response shape

Sending both x2 and y2 is rejected as ambiguous so callers never wonder which field was treated as unknown. When a prediction ran, x2 and y2 appear together with the predicted value filled in. POST a JSON body with required finite numbers x1 and y1 for the known pair. Optionally send exactly one of x2 or y2 for a prediction: if x2 is present the solver returns y2 equal to k times x2 and marks solved_for as y2; if y2 is present it returns x2 equal to y2 divided by k and marks solved_for as x2, provided k is not zero. Omitting both is allowed and returns only the constant of proportionality with solved_for equal to k—useful when the worksheet only asks for the constant. Each field may arrive as a JSON number or as a numeric string; missing required fields, empty strings, and non-finite values fail with invalid_input naming the field. Alias names known_x, known_y, new_x, new_y, find_y_at_x, and find_x_at_y are accepted for the same slots. On success the body includes x1, y1, k rounded to twelve decimal places for stable goldens, equation, formula, variation set to the literal direct, solved_for, and a short human message. When k is zero and the client asks to solve for x given a nonzero y2, the request fails because no x can produce a nonzero y under y equals zero; asking for x when y2 is also zero fails because every real x would work and no unique answer exists. Pair the response with your own plot of y equals kx if you need a graph; this endpoint returns numbers and display strings only.

Where a direct variation API earns its keep

Science and engineering notebooks often reduce unit-rate and similar-triangle problems to y equals kx when scaling measurements, converting map distances, or applying Hooke-style linear models through the origin; calling a tiny parse API avoids pulling a full computer-algebra system for a two-number ratio.

Exam and LMS auto-grading

Mark direct-variation items with a deterministic oracle that rejects x1 = 0 and never invents a second constant of proportionality.

What if I only need the constant of proportionality?

Send only x1 and y1. The response includes k, equation, and solved_for set to "k" without requiring a second pair.

What does the direct variation calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →