TExcelTAD
Home › Basic Math & Pre-Algebra › Direct and Inverse Variation

Direct and Inverse Variation

Two quantities vary directly when one is always a fixed multiple of the other (double one, the other doubles). They vary inversely when their product stays fixed (double one, the other halves). This lesson writes both relationships as formulas, finds the constant from data, draws the two graphs, and shows where each appears in programs.

Direct variation

yy varies directly with xx (or "yy is proportional to xx") when

y=k⋅xk is a fixed number, the constant of variationy = k \cdot x \qquad k \text{ is a fixed number, the constant of variation}

Equivalently, the ratio yx\frac{y}{x} is the same for every pair: yx=k\frac{y}{x} = k. That makes every pair of values a proportion.

Example. A video streams at 5 MB per minute. Data used dd varies directly with time tt: d=5td = 5t. Ten minutes use 50 MB, twenty minutes 100 MB.

Properties:

  • If xx is multiplied by some number, yy is multiplied by the same number.
  • x=0x = 0 gives y=0y = 0: the graph is a straight line through the origin.
  • kk is the slope of that line.

Inverse variation

yy varies inversely with xx when

y=kxor equivalentlyx⋅y=ky = \frac{k}{x} \qquad \text{or equivalently} \quad x \cdot y = k

The product stays the same.

Example. A 600 km trip. Travel time tt varies inversely with speed vv: t=600vt = \frac{600}{v}. At 60 km/h it takes 10 h, at 120 km/h 5 h, at 100 km/h 6 h. Every pair multiplies to 600.

Properties:

  • If xx is multiplied by some number, yy is divided by it.
  • xx can never be 0, and yy never reaches 0; the graph is a curve (a hyperbola) that hugs both axes.

Finding k from data

Given a table, test both: if yx\frac{y}{x} is constant, it is direct; if x⋅yx \cdot y is constant, it is inverse.

python · try it yourself
from fractions import Fraction as F

tables = {
    "A": [(2, 7), (4, 14), (10, 35)],
    "B": [(2, 30), (3, 20), (12, 5)],
    "C": [(1, 3), (2, 5), (3, 7)],
}
for name, pairs in tables.items():
    ratios = {F(y, x) for x, y in pairs}
    products = {x * y for x, y in pairs}
    if len(ratios) == 1:
        print(name, "direct,  k =", ratios.pop())
    elif len(products) == 1:
        print(name, "inverse, k =", products.pop())
    else:
        print(name, "neither (ratios", sorted(ratios), ")")
A direct,  k = 7/2
B inverse, k = 60
C neither (ratios [Fraction(7, 3), Fraction(5, 2), Fraction(3, 1)] )

Table C is y=2x+1y = 2x + 1: a straight line, but it does not pass through the origin, so it is not direct variation. You will study lines like that in The Coordinate Plane and in Algebra.

The two graphs

python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0.5, 10, 200)
plt.figure(figsize=(6, 4))
line_x = np.array([0, 10])
plt.plot(line_x, 2 * line_x, label="direct: y = 2x")
plt.plot(x, 12 / x, label="inverse: y = 12/x")
plt.xlim(0, 10)
plt.ylim(0, 20)
plt.xlabel("x")
plt.ylabel("y")
plt.grid(alpha=0.3)
plt.legend()
plt.title("Direct vs inverse variation")

for xv in [1, 2, 3, 4, 6]:
    print(f"x = {xv}: direct y = {2 * xv:2}, inverse y = {12 / xv:4.1f}")
x = 1: direct y =  2, inverse y = 12.0
x = 2: direct y =  4, inverse y =  6.0
x = 3: direct y =  6, inverse y =  4.0
x = 4: direct y =  8, inverse y =  3.0
x = 6: direct y = 12, inverse y =  2.0

The table shows the pattern: from x=2x = 2 to x=4x = 4 the direct value doubles and the inverse value halves. On the graph, the straight line climbs steadily from the origin; the curve falls fast at first and then flattens out, never touching the axes.

Variation with powers

The same idea works with powers of xx:

Relationship Formula Double xx and yy…
direct y=kxy = kx doubles (×2\times 2)
direct with the square y=kx2y = kx^2 quadruples (×4\times 4)
inverse y=kxy = \frac{k}{x} halves (÷2\div 2)
inverse square y=kx2y = \frac{k}{x^2} quarters (÷4\div 4)

The area of a circle varies directly with the square of its radius (A=πr2A = \pi r^2). The brightness of a light, the loudness of a sound and gravity all follow an inverse-square law: twice as far away, a quarter as strong.

In software

  • Direct: cost scales with usage (k=price per GBk = \text{price per GB}), render time with pixel count, file size with recording length. Doubling a texture's width and height quadruples its memory (direct with the square).
  • Inverse: frame time=1/frame rate\text{frame time} = 1 / \text{frame rate}; time to finish a parallel job≈work/number of workers\text{time to finish a parallel job} \approx \text{work} / \text{number of workers} (ideal case); bits per symbol vs symbols per second at a fixed bandwidth.
  • Inverse square in games: sound attenuation and light falloff often use intensity=k/distance2\text{intensity} = k / \text{distance}^2 (clamped near 0 so it does not blow up).
python · try it yourself
def falloff(distance, k=100.0, min_d=1.0):
    d = max(distance, min_d)          # avoid dividing by ~0
    return k / d**2

for d in [0.2, 1, 2, 4, 8]:
    print(f"distance {d:>3}: intensity {falloff(d):7.3f}")
distance 0.2: intensity 100.000
distance   1: intensity 100.000
distance   2: intensity  25.000
distance   4: intensity   6.250
distance   8: intensity   1.562

Each doubling of distance divides the intensity by 4. (The last value is 1.5625, shown with three decimals.)

Exercises

Exercise 1: Direct

yy varies directly with xx, and y=18y = 18 when x=4x = 4. Find kk and yy when x=10x = 10.

Answer

k=4.5k = 4.5 (92\frac{9}{2}), y=45y = 45

Solution
k=y/x=18/4=4.5y=4.5×10=45\begin{aligned} k &= y / x = 18 / 4 = 4.5 \\ y &= 4.5 \times 10 = 45 \end{aligned}

Exercise 2: Inverse

8 workers can paint a fence in 6 hours. Assuming time varies inversely with the number of workers, how long would 12 workers take?

Answer

4 hours

Solution
k=workers×hours=8×6=48hours=48/12=4\begin{aligned} k &= \text{workers} \times \text{hours} = 8 \times 6 = 48 \\ \text{hours} &= 48 / 12 = 4 \end{aligned}

Exercise 3: Which kind?

Classify: (a) the cost of nn concert tickets at 35 each; (b) the number of equal slices when a cake is cut into pieces of width ww; (c) a taxi fare of 3.00 plus 2.00 per km.

Answer

(a) direct, (b) inverse, (c) neither.

Solution

(a) cost=35n\text{cost} = 35n, a fixed multiple: direct with k=35k = 35. (b) slices×width=cake length\text{slices} \times \text{width} = \text{cake length}, a fixed product: inverse. (c) fare=3+2d\text{fare} = 3 + 2d; at d=0d = 0 the fare is 3, not 0, so it is a line that misses the origin: neither.

Exercise 4: Texture memory

A 512×512512 \times 512 texture uses 1 MiB. Memory varies directly with the number of pixels. Write Python that prints the memory of square textures with sides 256, 1024, 2048 and 4096, and say how memory changes when the side doubles.

Answer

0.25, 4, 16 and 64 MiB; doubling the side multiplies memory by 4.

Solution

Pixels=side2\text{Pixels} = \text{side}^2, so memory=k×side2\text{memory} = k \times \text{side}^2 with k=1/5122k = 1 / 512^2 MiB per pixel.

python · try it yourself
k = 1 / 512**2
for side in [256, 1024, 2048, 4096]:
    print(side, k * side**2, "MiB")
256 0.25 MiB
1024 4.0 MiB
2048 16.0 MiB
4096 64.0 MiB

Test yourself

yy varies inversely with xx. If xx triples, yy…

  1. triples
  2. is divided by 3
  3. stays the same
  4. is multiplied by 9

Which table shows direct variation?

  1. (1, 4), (2, 6), (3, 8)
  2. (2, 10), (5, 4), (10, 2)
  3. (3, 12), (5, 20), (8, 32)
  4. (1, 1), (2, 4), (3, 9)

Sound intensity follows an inverse-square law. Moving 3 times farther away makes it…

  1. 13\frac{1}{3} as strong
  2. 16\frac{1}{6} as strong
  3. 19\frac{1}{9} as strong
  4. 3 times stronger