Vector Calculator

Dot and cross products, magnitudes, angles and projections in two or three dimensions — exact wherever exactness exists, and clearly marked where it does not.

These vectors are not in a plane, so they are not drawn. A fixed projection of three axes onto a page is read wrongly about as often as it is read rightly — the depth has to come from being able to rotate it. Everything below is exact regardless.

Results

exactly rational    irrational, given as an exact surd with its decimal underneath

a + b(5, 7, 9)
a − b(−3, −3, −3)
a · b32
a × b(−3, 6, −3)
|a| (and |a|² = 14)√14≈ 3.74166
|b| (and |b|² = 77)√77≈ 8.77496
Unit vector of a(√14/14, √14/7, 3√14/14)(≈ 0.26726, ≈ 0.53452, ≈ 0.80178)
Unit vector of b(4√77/77, 5√77/77, 6√77/77)(≈ 0.45584, ≈ 0.5698, ≈ 0.68376)
cos θ16√22/77≈ 0.97463185
Angle θ12.933154°0.22572613 rad
Scalar projection of a onto b32√77/77≈ 3.64674
Vector projection of a onto b(128/77, 160/77, 192/77)
Rejection (a minus that projection)(−51/77, −6/77, 39/77)
Area of the parallelogram3√6≈ 7.34847
Area of the triangle3√6/2≈ 3.67423

Working

  1. Dot producta · b = (1)(4) + (2)(5) + (3)(6) = 32. This is a sum of products of the components, so it is exact — no square roots are involved yet.
  2. Magnitudes|a|² = 14 and |b|² = 77, so |a| = √14 and |b| = √77. The squares are exact rationals; the magnitudes are their square roots, kept as surds.
  3. Anglecos θ = (a · b)/(|a||b|) = 16√22/77. The cosine is exact. The angle itself is not — it is an inverse cosine, which has no closed form here, so it is given as a decimal.

Three kinds of answer, told apart

Vector operations divide sharply into three kinds, and almost every calculator prints all three as decimals, which leaves you unable to tell which number in front of you is the answer and which is a rounding of it. Here the colour of the dot beside each row says which.

Kind Which operations How it is shown
Exactly rational Dot product, cross product, triple product, vector projection, rejection A fraction or a whole number, with nothing lost
Irrational, but exact as a surd Magnitude, unit vector, scalar projection, areas √14 or 3√6/2, with the decimal underneath
Genuinely transcendental The angle itself A decimal, labelled as such — though cos θ is exact

That last row is worth dwelling on. cos θ = (a·b)/(|a||b|) is a ratio of things we can hold exactly, so it comes out exactly — for (1, 2, 3) and (4, 5, 6) it is 16√22/77. The angle is the inverse cosine of that, which has no closed form, so it can only ever be a decimal. Reporting the cosine exactly and the angle approximately is not inconsistency; it is the truth about which of them is a nice number.

The projection, and why the vector one is tidier

Resolving a vector into a part along another vector and a part perpendicular to it is most of what vector questions are about, and it is the picture the tool draws. There are two quantities and they behave differently:

The leftover, a − projb a, is the rejection, and it is perpendicular to b — exactly, which you can check on the page by noticing its dot product with b is zero. Those two pieces add back to a, which is the whole content of “resolving into components”.

The cross product, and what it is for

The cross product of a and b is perpendicular to both, and its length is the area of the parallelogram they span. Both facts are checkable on the page: the dot product of a × b with either input is exactly zero, and the area row is |a × b|.

Two vectors in the plane are lifted to three dimensions with a zero third component, which makes their cross product point along z with length equal to a₁b₂ − a₂b₁. That is the standard convention and it is what makes the area of a 2D parallelogram come out right.

An identity worth knowing, and one this tool satisfies for every input: |a × b|² + (a·b)² = |a|²|b|². It says the cross product and the dot product between them account for everything, and it is the reason perpendicular vectors span the largest parallelogram for their lengths.

Three vectors: volume and coplanarity

The scalar triple product a·(b × c) is the signed volume of the box the three vectors span. Its absolute value is the volume; its sign tells you the handedness of the three, which is why the volume takes the modulus.

When it is zero, the three lie in one plane. This is an exact test here rather than a comparison against a small number — and that matters, because in floating point the triple product of three genuinely coplanar vectors comes out at about 10−16 rather than 0, leaving a tool to guess whether that counts. In exact fractions there is nothing to guess.

Four mistakes this will catch

  1. Treating the dot product as a vector. It is a number. The cross product is the one that gives a vector, and only in three dimensions.
  2. Forgetting that the cross product anticommutes. a × b = −(b × a). Order matters, and swapping the two reverses the direction of the result.
  3. Dividing by the magnitude squared when normalising. A unit vector is v/|v|, not v/|v|². The check is that the result has length one.
  4. Calling the zero vector perpendicular. Its dot product with everything is zero, but it has no direction, so there is no angle.

What it does not do

Questions

Why is the vector projection exact but the scalar projection a surd?

Because the square roots cancel in one and not the other. The scalar projection is (a·b)/|b|, and that |b| is a square root that generally does not simplify away. The vector projection multiplies that scalar by the unit vector of b, which contains a second copy of 1/|b| — and the two multiply to 1/(b·b), which is a plain rational. So the messier-looking operation gives the cleaner answer, which surprises almost everyone the first time.

Why does it say √14 rather than 3.742?

Because √14 is the answer and 3.742 is a rounding of it. Any course setting a magnitude that is not a whole number is asking for the surd form, and a marker will want to see it. The decimal is shown underneath so you have both, and the coloured dot next to each row tells you at a glance which quantities are exactly rational and which are irrational.

Why will it not draw my 3D vectors?

Because a fixed projection of three axes onto a flat page is read wrongly about as often as it is read rightly. The depth cue has to come from being able to rotate the view, and a static picture gives you no way to tell whether a vector is pointing towards you or away. Rather than draw something that cannot be trusted, the tool says so. Every number on the page is exact regardless of whether a picture is drawn.

Is the zero vector perpendicular to everything?

By the algebra, yes — its dot product with anything is zero. By any useful meaning of the word, no: perpendicular describes an angle, and the zero vector has no direction to measure an angle from. This tool reports it as neither parallel nor perpendicular and says why, because "perpendicular" would be a wrong answer to the question actually being asked.

Can I type vectors as 2i + 3j − k?

Yes. That form, the comma form, brackets of any shape and plain spaces are all read. A missing basis vector is taken as zero, so 3i + 2k is (3, 0, 2) and you do not have to type the middle component.

What does it mean when the triple product is zero?

The three vectors are coplanar — they all lie in one plane, so the box they would span is flat and has no volume. It is an exact test here rather than a comparison against a small threshold, which matters: in floating point the triple product of three genuinely coplanar vectors comes out around 10⁻¹⁶, and deciding whether that counts as zero is a guess. In exact fractions there is nothing to guess.