v⃗

Vector Calculator

Work with 2D or 3D vectors: magnitude and unit vector, sum and difference, dot product and the angle between two vectors, cross product, and scalar and vector projections, with every step written out.

Math & AlgebraRuns in your browser

Result…

Two or three components, like 3, 4 or (3, 4, 5) or ⟨1, −2, 0⟩.

The same number of components as A.

 

…

How it's calculated

|A| = √(x² + y² + z²); unit vector = A ÷ |A|
A·B = x₁x₂ + y₁y₂ + z₁z₂ = |A| |B| cos θ
A × B = (y₁z₂ − z₁y₂, z₁x₂ − x₁z₂, x₁y₂ − y₁x₂)
Scalar projection = A·B ÷ |B|; vector projection = (A·B ÷ |B|²) B

Vectors are typed as their components, 2 for a flat (2D) vector or 3 for a 3D one, with or without brackets. Sums and differences go component by component. The dot product is a single number that is zero exactly when the vectors are at right angles; dividing it by both lengths gives the cosine of the angle between them (the angle itself is found with atan2 of the cross and dot products, which stays accurate for nearly parallel vectors). The cross product exists in 3D; for 2D vectors it is taken with z = 0, so it points out of the plane and its length is the parallelogram's area. The projection of A onto B is the shadow A casts along B. Results are shown to 7 significant figures.

Your numbers, step by step

    About the Vector calculator

    This vector calculator works with 2D and 3D vectors typed as plain components, such as 3, 4, 5 or (3, 4, 5). Choose one operation. It can find a vector's magnitude, unit vector and direction angles, add or subtract two vectors, take the dot product and the angle between them, take the cross product with the parallelogram and triangle areas it gives, or project one vector onto another. Physics students use it for forces, velocities and work done. Maths students use it to check linear algebra and mechanics exercises, and programmers use it to test game and graphics calculations. Every result comes with the component-by-component working, and it tells you when two vectors are perpendicular or parallel. For larger arrays of numbers, the matrix calculator handles determinants, inverses and products.

    How to use it

    1. Pick the operation under “Calculate”, for example “Dot product and angle” or “Cross product A × B”.
    2. Type “Vector A” as 2 or 3 numbers separated by commas or spaces. Brackets are optional.
    3. Type “Vector B” with the same number of components. The magnitude option only needs A.
    4. Read the main result, then the magnitudes, angle, unit vector or projections listed below it, and follow the steps to see each multiplication.

    Worked example

    Take A = (2, −1, 3) and B = (4, 0, −2). The dot product is 2 × 4 + (−1) × 0 + 3 × (−2) = 2. The magnitudes are |A| = 3.741657 and |B| = 4.472136, so the angle between them is 83.13543°. The cross product is A × B = (2, 16, 4), with length 16.61325: that is the area of the parallelogram the two vectors span, and the triangle on them has half of it, 8.306624.

    Updated

    Questions people ask

    How do you find the magnitude of a vector?

    Square each component, add them and take the square root: |A| = √(x² + y² + z²). The vector (3, 4) has magnitude √(9 + 16) = 5.

    How do I calculate the angle between two vectors?

    Divide the dot product by both magnitudes to get the cosine of the angle: cos θ = A·B ÷ (|A| × |B|), then take the inverse cosine. A dot product of 0 means the vectors are at 90°.

    What is the difference between the dot product and the cross product?

    The dot product gives a single number that measures how much two vectors point the same way. The cross product gives a new vector at right angles to both, whose length is the area of the parallelogram they make. It exists only in 3D.

    Can I take the cross product of 2D vectors?

    The calculator treats them as 3D vectors with z = 0. The result then points straight out of the plane, (0, 0, x₁y₂ − y₁x₂), and its length is the area spanned by the two flat vectors.

    What is a vector projection?

    It is the part of A that lies along B: (A·B ÷ |B|²) × B. The scalar projection A·B ÷ |B| is its signed length, negative when A points partly away from B.

    Why does the order matter for A × B but not for A·B?

    The dot product is symmetric, so A·B = B·A. The cross product follows the right-hand rule, so swapping the vectors flips its direction: B × A = −(A × B).

    More in Math & Algebra