Math calculator

Direct Variation Calculator

A constant ratio — which is a stronger claim than a straight line, and the difference is the whole topic.

Direct variation

The ratio y ÷ xⁿ is what stays constant.

y varies directly as

k = 3

y = 3x

k = y ÷ x = 12 ÷ 4 = 3

Constant of variation

3

the ratio every pair shares

x = 7

y = 21

y = 3 × 7 = 21

Doubling x

doubles y

because y follows x

A few values on this variation

Values of x and y on this direct variation
x12345
y3691215

Double x and y doubles. Triple x and y triples. The ratio y/x stays at k no matter which pair you pick, and that is what "varies directly" means.

The graph is a straight line through the origin with slope 3. Through the origin is the part that matters: y = 3x + 3 is also a line, and is not a direct variation.

What this tool shows

One known pair fixes k, and k answers everything else — including whether a table is proportional at all.

  • k from a known pair, and predictions in both directions
  • The power case y = kxⁿ, where doubling x multiplies y by 2ⁿ
  • A table test that computes every ratio rather than checking two
  • The linear-but-not-proportional case named when the ratios disagree
Constant of variation from one pair Exact, including fractions Powers, not just y = kx Free, no signup

Free, no signup — exact ratios, not rounded ones.

Updated 6 September 2026 · Works in any browser, no installation

“y varies directly as x” means the ratio y ÷ x never changes. From the pair (4, 12) that ratio is 3, so the relationship is y = 3x — and at x = 7 it gives y = 21.

At a glance

Formula shown
y = kx\u207f, where k = y \u00f7 x\u207f is the constant of variation. For n = 1 the graph is a line through the origin with slope k.
Scenario support
One known pair, plus a value to predict from \u2014 in either direction.
Educational estimate
Planning support from the values you enter — not professional advice.

The ratio, not the difference

What stays constant in a direct variation is y ÷ x. Not the gap between them, not their sum — the quotient. That single fact answers every question the topic asks.

From (4, 12) the ratio is 3, and it is the same for every other pair on the relationship: (1, 3), (2, 6), (10, 30). Once you have it, predicting is a multiplication.

This is why the topic appears wherever a rate is fixed: cost per unit, distance at a constant speed, mass from volume at a known density. In every case one quantity is a fixed multiple of another, and finding that multiple is the whole job.

Proportional is not the same as linear

y = 2x + 3 is a perfectly good straight line, and it is not a direct variation. Double x and y does not double: at x = 1 it gives 5, at x = 2 it gives 7. The ratios are 5 and 3.5, and they disagree.

The tool catches this explicitly. Given the pairs (1, 5), (2, 7), (3, 9), the ratios come out 5, 7/2, 3 — and rather than stopping at “not a direct variation”, it reports that the points do lie on a line: but the points do lie on a straight line, y = 2x + 3. A line that misses the origin is linear without being proportional, and that is the distinction this test exists to catch.

The distinction has a name in the graph: a direct variation passes through the origin and a general line need not. Doubling the input doubles the output only when there is no constant term to carry along unscaled.

Why x = 0 cannot define the constant

Every direct variation passes through (0, 0) — substitute x = 0 into y = kx and you get y = 0 for any k whatsoever. So that point is true of all of them and identifies none.

A tool that computes k = y ÷ x anyway returns 0/0, or Infinity, or NaN, and presents it as an answer. This one refuses the pair and says why, because the problem is not arithmetic failing — it is that the information genuinely is not there.

The practical consequence: a data point at the origin tells you nothing about the constant. If that is the only pair you have, the question cannot be answered, and no amount of algebra will change that.

Varying as a power

“y varies directly as the square of x” means y = kx², and now it is y ÷ x² that is constant. The wording is the same and the arithmetic is not.

k = y ÷ x² = 18 ÷ (3)² = 18 ÷ 9 = 2, giving y = 2x². Double x and y is multiplied by 4, not by 2 — because it is x² that y follows. Triple x and y is multiplied by 9. The constant ratio here is y ÷ x², not y ÷ x.

y = (27/4)x³ shows the pattern continuing: doubling x multiplies y by 8. This is why area scales as the square of length and volume as the cube — and why doubling the radius of a pipe quadruples what flows through it rather than doubling it, which is a direct variation question wearing a physics hat.

Testing a table properly

Two pairs prove nothing — any two points lie on some line through the origin if you pick the constant to suit. The test needs every pair.

Every ratio y ÷ x comes to 3, so this is a direct variation with k = 3. for (1, 3), (2, 6), (4, 12). All three ratios agree, so the relationship holds across the data rather than at a chosen pair.

(1, 3), (2, 7), (4, 11) fails both tests: the ratios are 3, 7/2, 11/4, and the points are not collinear either. That is a third outcome worth distinguishing from the other two — not proportional, and not even linear.

When the ratio grows and the product does not

The companion relationship is inverse variation, y = k/x, where the PRODUCT xy stays constant instead of the ratio. Doubling x halves y rather than doubling it.

The two are easy to tell apart with one glance at a table: divide for direct, multiply for inverse. A table with a constant ratio is direct; one with a constant product is inverse; one with neither is neither.

They also look completely different graphed. A direct variation is a line through the origin; an inverse variation is a hyperbola in two branches that never touches either axis. The Inverse Variation Calculator covers that case, along with joint and combined variation where more than two quantities are involved.

Sources and methodology

Proportionality is a definition rather than a cited result; the reference below covers the elementary algebra it sits in.

Method. Every figure on this page comes from src/lib/direct-variation.ts over the exact rational arithmetic in src/lib/algebra/poly.ts. The table test compares ratios as exact fractions rather than as rounded decimals, so a table that is proportional passes and one that is nearly proportional does not — which is the mathematical question this page is asking. That engine is verified on every change against 45 hand-written assertions, including that the predicted pair always reproduces the same constant, and that the linear-but-not-proportional fit is only reported when it holds for every row. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Inverse VariationFind k from one pair and predict any other for y = k/x or y = k/x^n, with the asymptotes treated as content, plus joint and combined variation in the same place.
Percentage ChangeWork out percentage increase or decrease, reverse change, loss recovery, percentage points, multi-period change, and CAGR.
Slope PercentageConvert a slope between percentage grade, degrees, a 1:n ratio and rise per run, or find the fall to set out across a known distance.
Doubling TimeHow long a quantity takes to double at a constant rate, or from two measurements — with the rule of 70 and rule of 72 measured against the exact answer.

More in Math, or browse all calculators.

Read the guide

Direct variation is the simplest case of a rate that does not change. For slopes expressed as grades, angles or ratios rather than as a bare constant, the Slope Percentage Calculator handles the conversions, and Adding, Multiplying and Dividing Polynomials covers the algebra underneath.

Educational use disclaimer

This calculator handles direct variation, y = kxⁿ, with exact rational arithmetic. It finds the constant from one known pair and predicts in either direction. Inverse variation — where the product rather than the ratio is constant — is a different relationship and has its own page. Real data rarely fits a variation exactly; the table test here asks whether the ratios are exactly equal, which is the mathematical question rather than a statistical one.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 6 September 2026

  1. Published the direct variation page: k from one pair, predictions in both directions, and the power case y = kxⁿ where doubling x multiplies y by 2ⁿ.
  2. Tests a table by computing every ratio, and identifies the linear-but-not-proportional case — a straight line that misses the origin — which is what gets mistaken for direct variation.
  3. Refuses x = 0 as a defining pair, because every direct variation passes through the origin and that point identifies none of them.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.