{
  "id": "equation-of-a-circle",
  "version": "35ccb25731d9",
  "status": "published",
  "name": "Equation of a Circle Calculator",
  "question": "What is the equation of a circle?",
  "summary": "Writes the standard and general form of a circle’s equation from its center and radius, a center and a point, the ends of a diameter, or the general form, with the center and radius.",
  "category": "math",
  "subcategory": "geometry",
  "url": "https://www.acalculator.org/math/equation-of-a-circle-calculator",
  "markdown": "https://www.acalculator.org/math/equation-of-a-circle-calculator.md",
  "kind": "function",
  "method": "Standard form (x − h)² + (y − k)² = r². General form x² + y² + Dx + Ey + F = 0 with D = −2h, E = −2k, F = h² + k² − r²; back by completing the square, h = −D ÷ 2, k = −E ÷ 2, r² = h² + k² − F.",
  "assumptions": [
    "Typed decimals are read exactly, so the center, r², D, E and F are exact and rounded once to 10 significant figures.",
    "The radius is exact when r² is a perfect square of a fraction; otherwise it is the double-precision √(r²).",
    "A general form with r² ≤ 0 is a point or has no points, so it gives no answer."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "from": {
        "title": "I know",
        "description": "What you know about the circle.",
        "type": "string",
        "enum": [
          "center",
          "point",
          "diameter",
          "general"
        ]
      },
      "h": {
        "title": "Center x (h)",
        "description": "The x coordinate of the center.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "k": {
        "title": "Center y (k)",
        "description": "The y coordinate of the center.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "r": {
        "title": "Radius (r)",
        "description": "The distance from the center to the circle.",
        "type": "number",
        "exclusiveMinimum": 0,
        "maximum": 1000000000000
      },
      "px": {
        "title": "Point x",
        "description": "The x coordinate of a point on the circle.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "py": {
        "title": "Point y",
        "description": "The y coordinate of a point on the circle.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "x1": {
        "title": "First end x",
        "description": "The x coordinate of one end of a diameter.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "y1": {
        "title": "First end y",
        "description": "The y coordinate of one end of a diameter.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "x2": {
        "title": "Second end x",
        "description": "The x coordinate of the other end of the diameter.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "y2": {
        "title": "Second end y",
        "description": "The y coordinate of the other end of the diameter.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "d": {
        "title": "D (x coefficient)",
        "description": "D in x² + y² + Dx + Ey + F = 0.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "e": {
        "title": "E (y coefficient)",
        "description": "E in x² + y² + Dx + Ey + F = 0.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      },
      "f": {
        "title": "F (constant)",
        "description": "F in x² + y² + Dx + Ey + F = 0.",
        "type": "number",
        "minimum": -1000000000000,
        "maximum": 1000000000000
      }
    }
  },
  "outputs": {
    "standard": {
      "label": "Standard form",
      "description": "The equation (x − h)² + (y − k)² = r².",
      "format": "text"
    },
    "general": {
      "label": "General form",
      "description": "The equation x² + y² + Dx + Ey + F = 0.",
      "format": "text"
    },
    "center": {
      "label": "Center (h, k)",
      "description": "The center of the circle.",
      "format": "text"
    },
    "radius": {
      "label": "Radius r",
      "description": "The radius of the circle.",
      "format": "number"
    },
    "rsq": {
      "label": "r²",
      "description": "The radius squared, the right side of the standard form.",
      "format": "number"
    },
    "diameter": {
      "label": "Diameter",
      "description": "Twice the radius.",
      "format": "number"
    },
    "circumference": {
      "label": "Circumference",
      "description": "The distance around the circle, 2πr.",
      "format": "number"
    },
    "area": {
      "label": "Area",
      "description": "The space inside the circle, πr².",
      "format": "number"
    },
    "steps": {
      "label": "Working",
      "description": "How the center and r² were found.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "from": "center",
      "h": -1,
      "k": 3,
      "r": 2,
      "px": 1,
      "py": 3,
      "x1": -3,
      "y1": 3,
      "x2": 1,
      "y2": 3,
      "d": -4,
      "e": -6,
      "f": 4
    },
    "outputs": {
      "standard": "(x + 1)² + (y − 3)² = 4",
      "general": "x² + y² + 2x − 6y + 6 = 0",
      "center": "(−1, 3)",
      "radius": 2,
      "rsq": 4,
      "diameter": 4,
      "circumference": 12.566370614359172,
      "area": 12.566370614359172,
      "steps": "r² = 2² = 4; standard form (x + 1)² + (y − 3)² = 4; expand: D = −2h = 2, E = −2k = −6, F = h² + k² − r² = 6; r = √4 = 2"
    },
    "text": "The equation of the circle is (x + 1)² + (y − 3)² = 4."
  },
  "examples": [
    {
      "given": {
        "from": "center",
        "h": -1,
        "k": 3,
        "r": 2
      },
      "expect": {
        "standard": "(x + 1)² + (y − 3)² = 4",
        "general": "x² + y² + 2x − 6y + 6 = 0",
        "radius": 2
      },
      "source": "OpenStax, Intermediate Algebra 2e, §11.1 Distance and Midpoint Formulas; Circles (standard form (x − h)² + (y − k)² = r², general form x² + y² + ax + by + c = 0; Examples 11.5, 11.6, 11.7 and 11.10), https://openstax.org/books/intermediate-algebra-2e/pages/11-1-distance-and-midpoint-formulas-circles (retrieved 2026-10-05) (Example 11.6); hand calculation in content.mdx for the general form"
    },
    {
      "given": {
        "from": "center",
        "h": 0,
        "k": 0,
        "r": 3
      },
      "expect": {
        "standard": "x² + y² = 9",
        "general": "x² + y² − 9 = 0",
        "area": 28.274333882308138
      },
      "source": "OpenStax, Intermediate Algebra 2e, §11.1 Distance and Midpoint Formulas; Circles (standard form (x − h)² + (y − k)² = r², general form x² + y² + ax + by + c = 0; Examples 11.5, 11.6, 11.7 and 11.10), https://openstax.org/books/intermediate-algebra-2e/pages/11-1-distance-and-midpoint-formulas-circles (retrieved 2026-10-05) (Example 11.5)"
    },
    {
      "given": {
        "from": "point",
        "h": 2,
        "k": 4,
        "px": -2,
        "py": 1
      },
      "expect": {
        "standard": "(x − 2)² + (y − 4)² = 25",
        "radius": 5,
        "general": "x² + y² − 4x − 8y − 5 = 0"
      },
      "source": "OpenStax, Intermediate Algebra 2e, §11.1 Distance and Midpoint Formulas; Circles (standard form (x − h)² + (y − k)² = r², general form x² + y² + ax + by + c = 0; Examples 11.5, 11.6, 11.7 and 11.10), https://openstax.org/books/intermediate-algebra-2e/pages/11-1-distance-and-midpoint-formulas-circles (retrieved 2026-10-05) (Example 11.7)"
    },
    {
      "given": {
        "from": "general",
        "d": -4,
        "e": -6,
        "f": 4
      },
      "expect": {
        "standard": "(x − 2)² + (y − 3)² = 9",
        "center": "(2, 3)",
        "radius": 3
      },
      "source": "OpenStax, Intermediate Algebra 2e, §11.1 Distance and Midpoint Formulas; Circles (standard form (x − h)² + (y − k)² = r², general form x² + y² + ax + by + c = 0; Examples 11.5, 11.6, 11.7 and 11.10), https://openstax.org/books/intermediate-algebra-2e/pages/11-1-distance-and-midpoint-formulas-circles (retrieved 2026-10-05) (Example 11.10)"
    },
    {
      "given": {
        "from": "diameter",
        "x1": 0,
        "y1": 0,
        "x2": 2,
        "y2": 2
      },
      "expect": {
        "standard": "(x − 1)² + (y − 1)² = 2",
        "radius": 1.4142135623730951,
        "general": "x² + y² − 2x − 2y = 0"
      },
      "source": "hand calculation in content.mdx: center (1, 1), r² = 1² + 1² = 2"
    }
  ],
  "sources": [
    "OpenStax, Intermediate Algebra 2e, §11.1 Distance and Midpoint Formulas; Circles (standard and general form; Examples 11.5, 11.6, 11.7 and 11.10), CC BY 4.0. https://openstax.org/books/intermediate-algebra-2e/pages/11-1-distance-and-midpoint-formulas-circles (retrieved 2026-10-05)"
  ],
  "related": [
    "circle",
    "distance-formula",
    "midpoint",
    "area-of-a-circle"
  ],
  "changelog": []
}
