{
  "id": "direct-variation",
  "version": "3f715c4e6847",
  "status": "published",
  "name": "Direct Variation Calculator",
  "question": "What is the direct variation equation?",
  "summary": "Finds the constant of variation k in y = kx or y = kxⁿ from one pair of values, writes the equation, and gives y at a new x or x at a new y, in exact fractions.",
  "category": "math",
  "subcategory": "algebra",
  "url": "https://www.acalculator.org/math/direct-variation-calculator",
  "markdown": "https://www.acalculator.org/math/direct-variation-calculator.md",
  "kind": "function",
  "method": "y = kxⁿ: k = y₁ ÷ x₁ⁿ; then y₂ = k × x₂ⁿ, or x₂ = (y₂ ÷ k)^(1/n), ± for even n.",
  "assumptions": [
    "The known x and y are not 0, so k is not 0. Values are read as the exact decimals typed.",
    "n is a whole number from 1 to 10; an even n gives two values of x, ±."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "n": {
        "title": "Power n",
        "description": "y varies directly with the nth power of x: 1 for y = kx, 2 for y = kx², and so on to 10.",
        "type": "integer",
        "minimum": 1,
        "maximum": 10
      },
      "x1": {
        "title": "Known x",
        "description": "The x of a known pair.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "y1": {
        "title": "Known y",
        "description": "The y that goes with the known x.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "find": {
        "title": "Find",
        "description": "Find y at a new x, or x at a new y.",
        "type": "string",
        "enum": [
          "y",
          "x"
        ]
      },
      "x2": {
        "title": "New x",
        "description": "The x at which to find y.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "y2": {
        "title": "New y",
        "description": "The y at which to find x.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      }
    }
  },
  "outputs": {
    "answer": {
      "label": "Answer",
      "description": "The new y, or the new x.",
      "format": "text"
    },
    "k": {
      "label": "Constant of variation k",
      "description": "k = y ÷ xⁿ from the known pair.",
      "format": "text"
    },
    "equation": {
      "label": "Equation",
      "description": "The direct variation equation y = kxⁿ.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "n": 1,
      "x1": 4,
      "y1": 12,
      "find": "y",
      "x2": 10,
      "y2": 30
    },
    "outputs": {
      "answer": "y = 30",
      "k": "3",
      "equation": "y = 3x"
    },
    "text": "With y = 3x, y = 30."
  },
  "examples": [
    {
      "given": {
        "n": 1,
        "x1": 4,
        "y1": 12,
        "find": "y",
        "x2": 10
      },
      "expect": {
        "answer": "y = 30",
        "k": "3",
        "equation": "y = 3x"
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §5.8 Modeling Using Variation (y = kxⁿ, k = y ÷ xⁿ), https://openstax.org/books/algebra-and-trigonometry-2e/pages/5-8-modeling-using-variation; hand calculation in content.mdx: k = 12 ÷ 4 = 3, y = 3 × 10 = 30"
    },
    {
      "given": {
        "n": 3,
        "x1": 2,
        "y1": 25,
        "find": "y",
        "x2": 6
      },
      "expect": {
        "answer": "y = 675",
        "k": "25/8 (3.125)",
        "equation": "y = (25/8)x³"
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §5.8 Modeling Using Variation, Example 1 (y varies with x³; y = 25 at x = 2 gives k = 25/8 and y = 675 at x = 6), https://openstax.org/books/algebra-and-trigonometry-2e/pages/5-8-modeling-using-variation"
    },
    {
      "given": {
        "n": 3,
        "x1": 2,
        "y1": 25,
        "find": "x",
        "y2": 675
      },
      "expect": {
        "answer": "x = 6"
      },
      "source": "hand calculation in content.mdx: x³ = 675 ÷ (25/8) = 216, x = 6 (OpenStax Example 1 in reverse)"
    },
    {
      "given": {
        "n": 2,
        "x1": 3,
        "y1": 18,
        "find": "x",
        "y2": 50
      },
      "expect": {
        "answer": "x = ±5",
        "equation": "y = 2x²"
      },
      "source": "hand calculation in content.mdx: k = 18 ÷ 9 = 2, x² = 50 ÷ 2 = 25, x = ±5"
    },
    {
      "given": {
        "n": 1,
        "x1": 0.3,
        "y1": 0.1,
        "find": "x",
        "y2": 2
      },
      "expect": {
        "answer": "x = 6",
        "k": "1/3 (0.3333333333)",
        "equation": "y = (1/3)x"
      },
      "source": "hand calculation in content.mdx: k = 0.1 ÷ 0.3 = 1/3 exactly, x = 2 ÷ (1/3) = 6"
    },
    {
      "given": {
        "n": 2,
        "x1": 1,
        "y1": 1,
        "find": "x",
        "y2": 2
      },
      "expect": {
        "answer": "x = ±1.414213562"
      },
      "source": "hand calculation in content.mdx: x² = 2, x = ±√2 = ±1.414213562"
    }
  ],
  "sources": [
    "OpenStax, Algebra and Trigonometry 2e, §5.8 Modeling Using Variation (direct variation y = kxⁿ, k the constant of variation; Example 1: y varies with x³, y = 25 when x = 2, so k = 25/8 and y = 675 when x = 6). https://openstax.org/books/algebra-and-trigonometry-2e/pages/5-8-modeling-using-variation (retrieved 2026-10-05)"
  ],
  "related": [
    "proportion",
    "ratio",
    "slope",
    "unit-rate"
  ],
  "changelog": []
}
