{
  "id": "center-of-mass",
  "version": "7b5202428d37",
  "status": "published",
  "name": "Center of Mass Calculator",
  "question": "Where is the center of mass?",
  "summary": "Finds the center of mass of up to 20 point masses on a line or in a plane: x = Σmx ÷ Σm and y = Σmy ÷ Σm, with the total mass.",
  "category": "physics",
  "subcategory": "mechanics",
  "url": "https://www.acalculator.org/physics/center-of-mass-calculator",
  "markdown": "https://www.acalculator.org/physics/center-of-mass-calculator.md",
  "kind": "function",
  "method": "x_cm = Σ mⱼ xⱼ ÷ Σ mⱼ; y_cm = Σ mⱼ yⱼ ÷ Σ mⱼ.",
  "assumptions": [
    "Each mass is a point (or the center of mass of a body) at the position typed.",
    "All masses use one unit and all positions one length unit; the center comes out in that length unit."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "items": {
        "title": "Masses and positions",
        "description": "One row per mass, with its position. Use the same mass unit and the same length unit in every row.",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "m": {
              "title": "Mass",
              "description": "The mass, in any unit, the same in every row.",
              "type": "number",
              "minimum": 0,
              "maximum": 1e+30
            },
            "x": {
              "title": "x",
              "description": "The x position of the mass, in any length unit, the same in every row.",
              "type": "number",
              "minimum": -1000000000000000,
              "maximum": 1000000000000000
            },
            "y": {
              "title": "y",
              "description": "The y position of the mass (0 for masses on a line).",
              "type": "number",
              "minimum": -1000000000000000,
              "maximum": 1000000000000000
            }
          }
        }
      }
    }
  },
  "outputs": {
    "center": {
      "label": "Center of mass",
      "description": "The point (x, y) where the masses balance, to 6 significant figures.",
      "format": "text"
    },
    "x": {
      "label": "x of the center",
      "description": "Σ m·x ÷ Σ m.",
      "format": "number"
    },
    "y": {
      "label": "y of the center",
      "description": "Σ m·y ÷ Σ m.",
      "format": "number"
    },
    "total": {
      "label": "Total mass",
      "description": "All the masses added up, Σ m.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "items": [
        {
          "mass": 2,
          "x": 0,
          "y": 0
        },
        {
          "mass": 3,
          "x": 4,
          "y": 0
        },
        {
          "mass": 5,
          "x": 2,
          "y": 3
        }
      ]
    },
    "outputs": {
      "center": "(2.2, 1.5)",
      "x": 2.2,
      "y": 1.5,
      "total": 10
    },
    "text": "The center of mass is at (2.2, 1.5)."
  },
  "examples": [
    {
      "given": {
        "items": [
          {
            "mass": 2,
            "x": 0,
            "y": 0
          },
          {
            "mass": 3,
            "x": 4,
            "y": 0
          },
          {
            "mass": 5,
            "x": 2,
            "y": 3
          }
        ]
      },
      "expect": {
        "x": 2.2,
        "y": 1.5,
        "total": 10,
        "center": "(2.2, 1.5)"
      },
      "source": "OpenStax, University Physics Volume 1, §9.6 Center of Mass (r_CM = Σ mⱼ rⱼ ÷ M), https://openstax.org/books/university-physics-volume-1/pages/9-6-center-of-mass; hand calculation in content.mdx: x = (2·0 + 3·4 + 5·2) ÷ 10 = 2.2, y = (5·3) ÷ 10 = 1.5"
    },
    {
      "given": {
        "items": [
          {
            "mass": 1,
            "x": 0
          },
          {
            "mass": 1,
            "x": 1
          },
          {
            "mass": 1,
            "x": 2
          }
        ]
      },
      "expect": {
        "x": 1,
        "y": 0,
        "center": "(1, 0)"
      },
      "source": "OpenStax, University Physics Volume 1, §9.6 Center of Mass (r_CM = Σ mⱼ rⱼ ÷ M), https://openstax.org/books/university-physics-volume-1/pages/9-6-center-of-mass; hand calculation in content.mdx: x = (0 + 1 + 2) ÷ 3 = 1"
    },
    {
      "given": {
        "items": [
          {
            "mass": 5.972e+24,
            "x": 0
          },
          {
            "mass": 7.346e+22,
            "x": 384400
          }
        ]
      },
      "expect": {
        "x": 4670.947123957482
      },
      "source": "OpenStax, University Physics Volume 1, §9.6 Center of Mass (r_CM = Σ mⱼ rⱼ ÷ M), https://openstax.org/books/university-physics-volume-1/pages/9-6-center-of-mass; NASA Earth and Moon fact sheets (masses, 384,400 km), https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html; hand calculation in content.mdx: 7.346e22 × 384,400 ÷ (5.972e24 + 7.346e22) = 4,670.95 km"
    },
    {
      "given": {
        "items": [
          {
            "mass": 3,
            "x": -2,
            "y": 1
          },
          {
            "mass": 1,
            "x": 2,
            "y": -3
          }
        ]
      },
      "expect": {
        "x": -1,
        "y": 0,
        "center": "(−1, 0)"
      },
      "source": "OpenStax, University Physics Volume 1, §9.6 Center of Mass (r_CM = Σ mⱼ rⱼ ÷ M), https://openstax.org/books/university-physics-volume-1/pages/9-6-center-of-mass; hand calculation in content.mdx: x = (3·(−2) + 1·2) ÷ 4 = −1, y = (3·1 + 1·(−3)) ÷ 4 = 0"
    }
  ],
  "sources": [
    "OpenStax, University Physics Volume 1, §9.6 Center of Mass (r_CM = (1/M) Σ mⱼ rⱼ). https://openstax.org/books/university-physics-volume-1/pages/9-6-center-of-mass (retrieved 2026-10-03)",
    "NASA, Earth Fact Sheet (mass 5.9722 × 10²⁴ kg) and Moon Fact Sheet (mass 0.07346 × 10²⁴ kg, mean distance 384,400 km). https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html (retrieved 2026-10-03)"
  ],
  "related": [
    "moment-of-inertia",
    "torque",
    "weighted-average"
  ],
  "changelog": []
}
