Vector Calculator
Give the vector calculator two vectors and it returns the dot product, the cross product's determinant expansion, the angle and the projection, exact where the components are whole numbers.
Cross product
- The determinant Unit vectors on the first row, a on the second, b on the third, in that order. Expanding along the first row gives the three components.
- |i j k; 1 2 3; 4 5 6|
- i component Cover the i column; the 2x2 determinant left over is a_y b_z - a_z b_y.
- (2)(6) - (3)(5) = 12 - 15 = -3
- j component The minus sign is the cofactor sign of the middle position. Dropping it is the most common error in a hand-worked cross product.
- -[(1)(6) - (3)(4)] = -(6 - 12) = 6
- k component
- (1)(5) - (2)(4) = 5 - 8 = -3
- a × b Perpendicular to both a and b, with its direction given by the right-hand rule: fingers along a, curl toward b, and the thumb points along a × b.
- (-3, 6, -3)
- |a × b|, area of the parallelogram |a × b| = |a||b|sin θ, which is the area of the parallelogram with sides a and b. That is why parallel vectors give zero: the parallelogram is flat.
- 3√6 ≈ 7.348469
- Area of the triangle Half the parallelogram: the triangle with a and b as two of its sides.
- 3√6/2 ≈ 3.674235
- Check: perpendicular to both Both are zero, as they must be. If a hand-worked answer fails this check, a sign is wrong, usually in the j component.
- (a × b) ⋅ a = 0, (a × b) ⋅ b = 0
- b × a The cross product is anticommutative: swapping the order reverses the direction and keeps the length. Order matters here in a way it never does for the dot product.
- (3, -6, 3)
- a and b
- a = (1, 2, 3), b = (4, 5, 6)
- How a and b relate Orthogonal means the dot product is zero; parallel means the cross product is zero. Those are the two tests, and both are exact for whole-number components.
- neither parallel nor orthogonal: 12.93315° apart
| Operation | Result |
|---|---|
| a ⋅ b | 32 |
| a × b | (-3, 6, -3) |
| a + b | (5, 7, 9) |
| a - b | (-3, -3, -3) |
| |a|, |b| | √14 ≈ 3.741657, √77 ≈ 8.774964 |
| Unit vector of a | (√14/14, √14/7, 3√14/14) |
| Angle between | 12.93315° |
| Projection of a onto b | (128/77, 160/77, 192/77) |
- Every component is a whole number, so lengths, unit vectors, cosines and projections are given exactly, as fractions and simplified square roots, with decimals alongside.
- The cross product is an operation on 3D vectors. For 2D input the vectors are placed in the xy-plane, and the cross product's z component is the signed area of their parallelogram.
How the Vector Calculator works
A vector here is a list of components: (1, 2, 3) means one unit along x, two along y and three along z. Every operation in this calculator is arithmetic on those components, and each one also has a geometric meaning. The arithmetic is how you compute; the geometry is how you check the answer makes sense.
Addition and subtraction work component by component. a + b is what you get by drawing b starting from the tip of a, and a - b is the arrow from the tip of b to the tip of a. That is why the distance between two points is the length of their difference.
The magnitude is the length: the square root of the sum of the squared components. For (1, 2, 3) that is √(1 + 4 + 9) = √14. Leave it as √14 if the question wants an exact answer. A root simplifies by pulling out square factors, so √72 = √(36 × 2) = 6√2. Dividing a vector by its magnitude gives the unit vector, which points the same way with length 1.
The dot product multiplies matching components and adds: (1, 2, 3) ⋅ (4, 5, 6) = 4 + 10 + 18 = 32. The result is a number, not a vector. Its geometric definition is a ⋅ b = |a||b|cos θ, where θ is the angle between the vectors, and the two definitions agreeing is the useful part. Rearranged, it gives the angle: cos θ = a ⋅ b / (|a||b|). It also gives the fastest perpendicularity test there is. If the dot product is zero, cos θ is zero and the vectors are at right angles. A positive dot product means the angle is acute; a negative one means it is obtuse.
The cross product is the one that needs care. It is defined for 3D vectors, and the result is another vector. The usual way to compute it is as a determinant, with the unit vectors i, j, k on the first row, a on the second and b on the third, expanded along the first row:
a × b = i(a_y b_z - a_z b_y) - j(a_x b_z - a_z b_x) + k(a_x b_y - a_y b_x)
The minus sign in front of the j term is the cofactor sign for that position, and leaving it out is the most common mistake in hand-worked cross products. For (1, 2, 3) × (4, 5, 6) the three components are 12 - 15 = -3, then -(6 - 12) = 6, then 5 - 8 = -3, so the answer is (-3, 6, -3).
The result is perpendicular to both a and b, and you can check this. Its dot product with each of them must be zero, and if it is not, a sign has gone wrong. Which of the two perpendicular directions it takes is set by the right-hand rule: point your fingers along a, curl them toward b, and your thumb points along a × b. That is why order matters. b × a is the same length pointing the opposite way. Its length is |a||b|sin θ, which is the area of the parallelogram with sides a and b, so half of it is the area of the triangle they make. If a and b are parallel the parallelogram is flat, the area is zero, and the cross product is the zero vector. That makes it the parallel test, the way the dot product is the perpendicular test.
The projection of a onto b is the part of a that points along b, its shadow on the line through b. The formula is (a ⋅ b / b ⋅ b) b. Dividing by b ⋅ b, rather than by |b|, is what keeps the answer correct whatever length b happens to be. Subtracting the projection from a leaves the part of a perpendicular to b, which is the first step of Gram-Schmidt orthogonalization.
When every component is a whole number up to 1,000, this calculator works exactly. Lengths come out as simplified roots, unit vectors and cosines as rationalized fractions like 3√14/14, and the textbook angles of 30°, 45°, 60° and 90° are recognized exactly, not as a decimal that is nearly 60. Decimal components get decimal answers to ten significant figures.
Vector Calculator FAQ
What is the cross product formula?
For a = (a_x, a_y, a_z) and b = (b_x, b_y, b_z), a × b = (a_y b_z - a_z b_y, a_z b_x - a_x b_z, a_x b_y - a_y b_x). It comes from expanding the determinant with i, j, k on the first row, a on the second and b on the third. The middle component carries a minus sign from the expansion, which is the one people drop.
What is the difference between the dot product and the cross product?
The dot product gives a number, |a||b|cos θ, and is zero when the vectors are perpendicular. The cross product gives a vector perpendicular to both, of length |a||b|sin θ, and is zero when they are parallel. The dot product works in any number of dimensions. The cross product is a 3D operation, and its order matters: b × a = -(a × b).
How do I find the angle between two vectors?
Divide the dot product by the product of the lengths to get cos θ, then take the arccosine. For (1, 2, 3) and (4, 5, 6): 32 / (√14 × √77) ≈ 0.9746, so θ ≈ 12.93°. The answer is always between 0° and 180°.
What does the magnitude of the cross product mean?
It is the area of the parallelogram with a and b as adjacent sides, |a||b|sin θ. Half of it is the area of the triangle they form, which is the standard way to find a triangle's area from three points in space.
How can I tell if two vectors are parallel or perpendicular?
Perpendicular: the dot product is zero. Parallel: the cross product is the zero vector, or in 2D, a_x b_y - a_y b_x = 0. With whole-number components both tests are exact, which is more reliable than checking whether an angle came out at exactly 90 or 0.