{
  "id": "magnitude",
  "version": "512bf0023f81",
  "status": "published",
  "name": "Vector Magnitude Calculator",
  "question": "What is the vector’s magnitude?",
  "summary": "Finds the magnitude (length) of a vector from its components or from a start and an end point, in 2D, 3D or up to 10 dimensions, with the exact root, the unit vector and the direction angle.",
  "category": "math",
  "subcategory": "linear-algebra",
  "url": "https://www.acalculator.org/math/magnitude-calculator",
  "markdown": "https://www.acalculator.org/math/magnitude-calculator.md",
  "kind": "function",
  "method": "‖v‖ = √(v₁² + v₂² + … + vₙ²); from P to Q, v = Q − P. Unit vector v ÷ ‖v‖; in 2D the angle is atan2(y, x).",
  "assumptions": [
    "Euclidean length: the square root of the sum of the squared components.",
    "From two points, v = Q − P (end minus start), coordinate by coordinate.",
    "Up to 10 components. The exact root form is shown when ‖v‖² = p/q has p × q at most 10¹²."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "mode": {
        "title": "I know",
        "description": "The vector’s components, or the point where it starts and the point where it ends.",
        "type": "string",
        "enum": [
          "components",
          "points"
        ]
      },
      "v": {
        "title": "Components of v",
        "description": "The vector’s components, such as 3, 4 or −2, 9, 5.",
        "type": "array",
        "items": {
          "type": "number"
        }
      },
      "p": {
        "title": "Start point P",
        "description": "The coordinates of the start (tail) of the vector.",
        "type": "array",
        "items": {
          "type": "number"
        }
      },
      "q": {
        "title": "End point Q",
        "description": "The coordinates of the end (head) of the vector, as many as P.",
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    }
  },
  "outputs": {
    "magnitude": {
      "label": "Magnitude ‖v‖",
      "description": "The length of the vector: the square root of the sum of its squared components.",
      "format": "number"
    },
    "exact": {
      "label": "Exact magnitude",
      "description": "The magnitude as a simplified square root, such as √110 or 3√2, from the components as typed.",
      "format": "text"
    },
    "squared": {
      "label": "Magnitude squared ‖v‖²",
      "description": "The sum of the squared components.",
      "format": "number"
    },
    "vector": {
      "label": "Vector v",
      "description": "The vector’s components; from two points, Q − P.",
      "format": "text"
    },
    "unit": {
      "label": "Unit vector v ÷ ‖v‖",
      "description": "The vector of length 1 in the same direction: each component divided by the magnitude, to 6 significant digits.",
      "format": "text"
    },
    "angle": {
      "label": "Direction angle",
      "description": "For a 2D vector: the angle from the positive x axis, counterclockwise, from 0° up to 360°.",
      "format": "number"
    },
    "dimension": {
      "label": "Components",
      "description": "How many components the vector has.",
      "format": "integer"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "mode": "components",
      "v": [
        3,
        4
      ],
      "p": [
        1,
        2
      ],
      "q": [
        4,
        6
      ]
    },
    "outputs": {
      "magnitude": 5,
      "exact": "5",
      "squared": 25,
      "vector": "⟨3, 4⟩",
      "unit": "⟨0.6, 0.8⟩",
      "angle": 53.13010235415595,
      "dimension": 2
    },
    "text": "The magnitude of ⟨3, 4⟩ is 5."
  },
  "examples": [
    {
      "given": {
        "mode": "components",
        "v": [
          -2,
          9,
          5
        ]
      },
      "expect": {
        "magnitude": 10.488088481701515,
        "exact": "√110",
        "squared": 110,
        "dimension": 3
      },
      "source": "OpenStax, Calculus Volume 3, §2.2 Vectors in Three Dimensions (‖v‖ = √(x² + y² + z²); Example 2.19: ⟨−2, 9, 5⟩ has magnitude √110 and ⟨1, −1, 0⟩ has magnitude √2), https://openstax.org/books/calculus-volume-3/pages/2-2-vectors-in-three-dimensions (retrieved 2026-10-02); Python 3: math.hypot(-2, 9, 5)"
    },
    {
      "given": {
        "mode": "components",
        "v": [
          1,
          2
        ]
      },
      "expect": {
        "magnitude": 2.23606797749979,
        "exact": "√5",
        "unit": "⟨0.447214, 0.894427⟩",
        "angle": 63.43494882292201
      },
      "source": "OpenStax, Calculus Volume 3, §2.1 Vectors in the Plane (‖v‖ = √(x² + y²); unit vector v ÷ ‖v‖; Example 2.7: ⟨1, 2⟩ has magnitude √5), https://openstax.org/books/calculus-volume-3/pages/2-1-vectors-in-the-plane (retrieved 2026-10-02); Python 3: math.degrees(math.atan2(2, 1)) = 63.43494882292201"
    },
    {
      "given": {
        "mode": "components",
        "v": [
          3,
          4
        ]
      },
      "expect": {
        "magnitude": 5,
        "exact": "5",
        "squared": 25,
        "unit": "⟨0.6, 0.8⟩",
        "angle": 53.13010235415598
      },
      "source": "hand calculation in content.mdx: √(9 + 16) = 5; OpenStax, Calculus Volume 3, §2.1 Vectors in the Plane (‖v‖ = √(x² + y²); unit vector v ÷ ‖v‖; Example 2.7: ⟨1, 2⟩ has magnitude √5), https://openstax.org/books/calculus-volume-3/pages/2-1-vectors-in-the-plane (retrieved 2026-10-02)"
    },
    {
      "given": {
        "mode": "points",
        "p": [
          1,
          2
        ],
        "q": [
          4,
          6
        ]
      },
      "expect": {
        "magnitude": 5,
        "vector": "⟨3, 4⟩"
      },
      "source": "hand calculation in content.mdx: Q − P = ⟨3, 4⟩, √(9 + 16) = 5; OpenStax, Calculus Volume 3, §2.1 Vectors in the Plane (‖v‖ = √(x² + y²); unit vector v ÷ ‖v‖; Example 2.7: ⟨1, 2⟩ has magnitude √5), https://openstax.org/books/calculus-volume-3/pages/2-1-vectors-in-the-plane (retrieved 2026-10-02)"
    },
    {
      "given": {
        "mode": "components",
        "v": [
          1,
          -1,
          0
        ]
      },
      "expect": {
        "magnitude": 1.4142135623730951,
        "exact": "√2"
      },
      "source": "OpenStax, Calculus Volume 3, §2.2 Vectors in Three Dimensions (‖v‖ = √(x² + y² + z²); Example 2.19: ⟨−2, 9, 5⟩ has magnitude √110 and ⟨1, −1, 0⟩ has magnitude √2), https://openstax.org/books/calculus-volume-3/pages/2-2-vectors-in-three-dimensions (retrieved 2026-10-02)"
    },
    {
      "given": {
        "mode": "components",
        "v": [
          0.5,
          0.5
        ]
      },
      "expect": {
        "exact": "(1/2)√2",
        "magnitude": 0.7071067811865476
      },
      "source": "hand calculation in content.mdx: √(1/4 + 1/4) = √(1/2) = √2 ÷ 2; OpenStax, Calculus Volume 3, §2.1 Vectors in the Plane (‖v‖ = √(x² + y²); unit vector v ÷ ‖v‖; Example 2.7: ⟨1, 2⟩ has magnitude √5), https://openstax.org/books/calculus-volume-3/pages/2-1-vectors-in-the-plane (retrieved 2026-10-02)"
    }
  ],
  "sources": [
    "OpenStax, Calculus Volume 3, §2.1 Vectors in the Plane (‖v‖ = √(x² + y²); unit vector v ÷ ‖v‖; Example 2.7: ⟨1, 2⟩ has magnitude √5 and unit vector ⟨1/√5, 2/√5⟩). https://openstax.org/books/calculus-volume-3/pages/2-1-vectors-in-the-plane (retrieved 2026-10-02)",
    "OpenStax, Calculus Volume 3, §2.2 Vectors in Three Dimensions (‖v‖ = √(x² + y² + z²); Example 2.19: ⟨−2, 9, 5⟩ has magnitude √110 and ⟨1, −1, 0⟩ has magnitude √2). https://openstax.org/books/calculus-volume-3/pages/2-2-vectors-in-three-dimensions (retrieved 2026-10-02)"
  ],
  "related": [
    "cross-product",
    "dot-product",
    "orthogonal-projection",
    "distance-formula"
  ],
  "changelog": []
}
