calculator.onl
Categories50

Vector dot and cross product calculator

Calculate a dot product, cross product, angle and projection for two vectors in two or three dimensions.

A worked example

Keep vector a horizontal and raise the tip of b. Watch the enclosed area and the dot product.

A·B32Angle12.9332 °‖A×B‖7.3485‖A‖3.7417‖B‖8.775
2D / 3D: 2D / 3D

First vector’s component along the x axis. Aₓ: -1000000…1000000

First vector’s component along the y axis. Aᵧ: -1000000…1000000

First vector’s component along the z axis. A_z: -1000000…1000000

Second vector’s component along the x axis. Bₓ: -1000000…1000000

Second vector’s component along the y axis. Bᵧ: -1000000…1000000

Second vector’s component along the z axis. B_z: -1000000…1000000

Updates as you type

Use a dot or comma for decimals. No thousands separators.

YOUR RESULT

A·B

32

Calculated from your inputs

Angle12.9332 °
‖A×B‖7.3485
compB(A)3.6467
‖A‖3.7417
‖B‖8.775
The numbers, at a glance

Calculations run in your browser.
UNDERSTAND THE RESULT

A little context. A clearer answer.

↑ Back to calculator

When this calculator is useful

The dot product sums matching component products. The cross product follows the right-hand rule. Use atan2 of cross-product magnitude and dot product for the angle. Project A onto B using (A·B)B/|B|²; the scalar projection keeps its sign. For a related calculation, try Matrix calculator.

What to enter

InputWhat it meansExample value
2D / 3D2D / 3D: 2D / 3D3D
AₓFirst vector’s component along the x axis. Aₓ: -1000000…1000000 1
AᵧFirst vector’s component along the y axis. Aᵧ: -1000000…1000000 2
A_zFirst vector’s component along the z axis. A_z: -1000000…1000000 3
BₓSecond vector’s component along the x axis. Bₓ: -1000000…1000000 4
BᵧSecond vector’s component along the y axis. Bᵧ: -1000000…1000000 5
B_zSecond vector’s component along the z axis. B_z: -1000000…1000000 6

How the calculation works

  1. Change the inputs to explore your own scenario. 2D / 3D: 2D / 3D; Aₓ: -1000000…1000000 ; Aᵧ: -1000000…1000000 ; A_z: -1000000…1000000 ; Bₓ: -1000000…1000000 ; Bᵧ: -1000000…1000000 ; B_z: -1000000…1000000 .
  2. A·B=Σaᵢbᵢ; A×B=(a₂b₃−a₃b₂,a₃b₁−a₁b₃,a₁b₂−a₂b₁); projB(A)=(A·B)B/|B|²
  3. Real Cartesian vectors with a common orthonormal basis. In 2D, z is zero; the cross product is reported in 3D. An angle involving a zero vector and projection onto a zero vector are undefined. The plot shows the XY projection.
The formulaA·B=Σaᵢbᵢ; A×B=(a₂b₃−a₃b₂,a₃b₁−a₁b₃,a₁b₂−a₂b₁); projB(A)=(A·B)B/|B|²

A worked example

A=(1,2,3), B=(4,5,6): A·B=32; A×B=(−3,6,−3); angle≈12.933154°; projB(A)=(128,160,192)/77.

Example you can load

What to enter
Result for this example · A·B32

This is a fixed example; changing the form above does not change these numbers.

Assumptions & limits

Real Cartesian vectors with a common orthonormal basis. In 2D, z is zero; the cross product is reported in 3D. An angle involving a zero vector and projection onto a zero vector are undefined. The plot shows the XY projection.

Frequently asked questions

What does a negative dot product mean?

For nonzero vectors it means the angle is greater than 90 degrees.

Why does a 2D cross product have three components?

The two vectors are embedded in the XY plane with zero z components. Their cross product points along the z axis.

Why is an angle unavailable for a zero vector?

A zero vector has no direction. Its dot and cross products remain defined, but an angle with it does not.