Dot product of two vectors

Two vectors point in their own directions, but there is one number that tells you exactly how much they agree — the dot product. Multiply their lengths, multiply by the cosine of the angle between them, and you get a single scalar: positive when the vectors lean the same way, negative when they lean apart, and zero exactly when they are perpendicular. That one idea does three jobs in the Class 12 syllabus at once: it hands you the angle between any two vectors, it gives an instant perpendicularity test, and — because a vector dotted with itself is just its squared length — it turns finding magnitudes into arithmetic. This article rebuilds the definition from its geometric picture, derives the component formula every problem actually uses, and works through the two standard question types: finding an angle, and finding an unknown component that makes two vectors perpendicular.

The core insight

The dot product a⃗⋅b⃗=∣a⃗∣∣b⃗∣cos⁡θ\vec a\cdot\vec b=|\vec a||\vec b|\cos\theta compresses the angle between two vectors into a single scalar, so a⃗⋅b⃗=0\vec a\cdot\vec b=0 tests perpendicularity and a⃗⋅a⃗=∣a⃗∣2\vec a\cdot\vec a=|\vec a|^2 gives magnitude, while in components it is simply a1b1+a2b2+a3b3a_1b_1+a_2b_2+a_3b_3.

The core idea

Definition. For two nonzero vectors a⃗\vec a and b⃗\vec b with angle θ\theta between them (0≤θ≤π0\le\theta\le\pi), the dot product (also called the scalar product) is

a⃗⋅b⃗=∣a⃗∣ ∣b⃗∣cos⁡θ.\vec a\cdot\vec b = |\vec a|\,|\vec b|\cos\theta.

where: ∣a⃗∣|\vec a| and ∣b⃗∣|\vec b| are the magnitudes of the two vectors and θ\theta is the angle between them when both are drawn from the same starting point. If either vector is 0⃗\vec 0, the dot product is defined to be 00, and θ\theta has no meaning in that case. Notice the result is a plain number — a scalar — never a vector; that is the whole point of the name.

Sign tells the story. Since ∣a⃗∣,∣b⃗∣>0|\vec a|,|\vec b|>0, the sign of a⃗⋅b⃗\vec a\cdot\vec b is exactly the sign of cos⁡θ\cos\theta: positive for an acute angle, negative for an obtuse one, and zero at a right angle. So a single number, computed without ever drawing a diagram, tells you the qualitative shape of the angle between two vectors.

Component form. If a⃗=a1i^+a2j^+a3k^\vec a=a_1\hat i+a_2\hat j+a_3\hat k and b⃗=b1i^+b2j^+b3k^\vec b=b_1\hat i+b_2\hat j+b_3\hat k, the dot product reduces to

a⃗⋅b⃗=a1b1+a2b2+a3b3.\vec a\cdot\vec b = a_1b_1+a_2b_2+a_3b_3.

where: a1,a2,a3a_1,a_2,a_3 and b1,b2,b3b_1,b_2,b_3 are the i^,j^,k^\hat i,\hat j,\hat k components of a⃗\vec a and b⃗\vec b. This is the formula almost every exam question ultimately uses — multiply matching components and add.

Key properties, all provable directly from the definition:

a⃗⋅b⃗=b⃗⋅a⃗\vec a\cdot\vec b = \vec b\cdot\vec a
a⃗⋅(b⃗+c⃗)=a⃗⋅b⃗+a⃗⋅c⃗\vec a\cdot(\vec b+\vec c) = \vec a\cdot\vec b+\vec a\cdot\vec c
a⃗⋅a⃗=∣a⃗∣2  ⟹  ∣a⃗∣=a⃗⋅a⃗\vec a\cdot\vec a = |\vec a|^2 \implies |\vec a|=\sqrt{\vec a\cdot\vec a}
a⃗⊥b⃗  ⟺  a⃗⋅b⃗=0(a⃗,b⃗ nonzero).\vec a\perp\vec b \iff \vec a\cdot\vec b = 0 \quad (\vec a,\vec b\ \text{nonzero}).

Finding the angle. Rearranging the definition,

cos⁡θ=a⃗⋅b⃗∣a⃗∣ ∣b⃗∣,θ=cos⁡−1 ⁣(a⃗⋅b⃗∣a⃗∣ ∣b⃗∣).\cos\theta = \frac{\vec a\cdot\vec b}{|\vec a|\,|\vec b|}, \qquad \theta = \cos^{-1}\!\left(\frac{\vec a\cdot\vec b}{|\vec a|\,|\vec b|}\right).

where: the right-hand side uses only quantities you can compute from components — the dot product and the two magnitudes — so no picture is ever required to find θ\theta exactly.

Projection, as a bonus. Rearranging once more, ∣a⃗∣cos⁡θ=a⃗⋅b⃗∣b⃗∣|\vec a|\cos\theta = \dfrac{\vec a\cdot\vec b}{|\vec b|} is the length of a⃗\vec a's "shadow" cast along the direction of b⃗\vec b. It is not a separate rule — it falls straight out of the definition — and it is the idea the next syllabus topic (projection of a vector on a line) builds on.

Scope note. CBSE Class 12 restricts dot-product applications to angle-finding, perpendicularity, and this projection idea. The scalar triple product (dot product combined with a cross product across three vectors) is outside the current syllabus.

Figure
Two vectors from a common origin with the angle theta between them and the dot product formula labelled
Dot product: a times b times cosine of the angle between them b a theta a dot b = magnitude of a times magnitude of b times cos theta
Derivation AComponent formula for the dot product

The goal is to show that the geometric definition a⃗⋅b⃗=∣a⃗∣∣b⃗∣cos⁡θ\vec a\cdot\vec b=|\vec a||\vec b|\cos\theta, which needs an angle you rarely know directly, is exactly equal to a1b1+a2b2+a3b3a_1b_1+a_2b_2+a_3b_3, a formula that needs nothing but the components you are handed — and to see why the unit vectors i^,j^,k^\hat i,\hat j,\hat k behave the way the shortcut requires.

Step 1. Apply the geometric definition to the unit vectors themselves. i^,j^,k^\hat i,\hat j,\hat k each have magnitude 11, and any vector makes a zero angle with itself, so i^⋅i^=(1)(1)cos⁡0∘=1\hat i\cdot\hat i=(1)(1)\cos 0^\circ=1, and likewise j^⋅j^=k^⋅k^=1\hat j\cdot\hat j=\hat k\cdot\hat k=1.

Step 2. Any two different unit vectors among i^,j^,k^\hat i,\hat j,\hat k are perpendicular by construction of the coordinate axes, so the angle between them is 90∘90^\circ and cos⁡90∘=0\cos 90^\circ=0. Hence i^⋅j^=j^⋅k^=k^⋅i^=0\hat i\cdot\hat j=\hat j\cdot\hat k=\hat k\cdot\hat i=0, and by the commutative property this covers all six ordered pairs.

Step 3. Write a⃗=a1i^+a2j^+a3k^\vec a=a_1\hat i+a_2\hat j+a_3\hat k and b⃗=b1i^+b2j^+b3k^\vec b=b_1\hat i+b_2\hat j+b_3\hat k, and expand a⃗⋅b⃗\vec a\cdot\vec b using the distributive property term by term. This gives nine products: a1b1(i^⋅i^)+a1b2(i^⋅j^)+a1b3(i^⋅k^)+a2b1(j^⋅i^)+a2b2(j^⋅j^)+a2b3(j^⋅k^)+a3b1(k^⋅i^)+a3b2(k^⋅j^)+a3b3(k^⋅k^)a_1b_1(\hat i\cdot\hat i)+a_1b_2(\hat i\cdot\hat j)+a_1b_3(\hat i\cdot\hat k)+a_2b_1(\hat j\cdot\hat i)+a_2b_2(\hat j\cdot\hat j)+a_2b_3(\hat j\cdot\hat k)+a_3b_1(\hat k\cdot\hat i)+a_3b_2(\hat k\cdot\hat j)+a_3b_3(\hat k\cdot\hat k).

Step 4. Substitute Steps 1 and 2 into that expansion. Every mixed term (i^⋅j^\hat i\cdot\hat j and its five relatives) is multiplied by 00 and vanishes; every matching term (i^⋅i^\hat i\cdot\hat i and its two relatives) is multiplied by 11 and survives. What remains is exactly

a⃗⋅b⃗=a1b1+a2b2+a3b3.\vec a\cdot\vec b = a_1b_1+a_2b_2+a_3b_3.

Step 5. Read the result. The geometric definition and the component formula are the same quantity viewed two ways; the component version is what you compute in practice, and the geometric version is what tells you why the sign and the zero case mean perpendicularity.

Worked example

Find a⃗⋅b⃗\vec a\cdot\vec b and the angle between a⃗=2i^−j^+2k^\vec a = 2\hat i - \hat j + 2\hat k and b⃗=i^+2j^−2k^\vec b = \hat i + 2\hat j - 2\hat k.

Step 1. Compute the dot product from components: a⃗⋅b⃗=(2)(1)+(−1)(2)+(2)(−2)=2−2−4=−4\vec a\cdot\vec b = (2)(1)+(-1)(2)+(2)(-2) = 2-2-4 = -4.

Step 2. Compute the magnitudes: ∣a⃗∣=22+(−1)2+22=9=3|\vec a| = \sqrt{2^2+(-1)^2+2^2} = \sqrt{9} = 3 and ∣b⃗∣=12+22+(−2)2=9=3|\vec b| = \sqrt{1^2+2^2+(-2)^2} = \sqrt{9} = 3.

Step 3. Form the cosine: cos⁡θ=−43×3=−49\cos\theta = \dfrac{-4}{3\times 3} = -\dfrac{4}{9}. The negative sign already tells you θ\theta is obtuse, before you even take the inverse cosine.

Step 4. State the angle: θ=cos⁡−1 ⁣(−49)\theta = \cos^{-1}\!\left(-\dfrac{4}{9}\right).

The dot product is −4-4, and the angle between a⃗\vec a and b⃗\vec b is θ=cos⁡−1 ⁣(−49)\theta=\cos^{-1}\!\left(-\tfrac{4}{9}\right), an obtuse angle.

Competitive stretch

Find λ\lambda so that a⃗=3i^+λj^−k^\vec a = 3\hat i + \lambda\hat j - \hat k is perpendicular to b⃗=2i^−4j^+5k^\vec b = 2\hat i - 4\hat j + 5\hat k.

Step 1. Write the dot product in terms of λ\lambda: a⃗⋅b⃗=(3)(2)+(λ)(−4)+(−1)(5)=6−4λ−5=1−4λ\vec a\cdot\vec b = (3)(2)+(\lambda)(-4)+(-1)(5) = 6-4\lambda-5 = 1-4\lambda.

Step 2. Perpendicularity means the dot product is zero, so solve 1−4λ=01-4\lambda=0, giving λ=14\lambda=\dfrac14.

Step 3. Verify by substitution: with λ=14\lambda=\tfrac14, a⃗⋅b⃗=6−4(14)−5=6−1−5=0\vec a\cdot\vec b = 6-4(\tfrac14)-5 = 6-1-5=0, confirming perpendicularity.

λ=14\lambda=\dfrac14 makes a⃗\vec a and b⃗\vec b perpendicular.

Common traps

  • Treating the dot product as if it returns a vector — writing something like "a⃗⋅b⃗=5i^\vec a\cdot\vec b=5\hat i" is a type error; the result is always a scalar.
  • Using cos⁡θ=a⃗⋅b⃗∣a⃗∣∣b⃗∣\cos\theta=\dfrac{\vec a\cdot\vec b}{|\vec a||\vec b|} without checking both vectors are nonzero — the angle is undefined if either vector is 0⃗\vec 0.
  • Concluding "perpendicular" from a⃗⋅b⃗=0\vec a\cdot\vec b=0 without checking both vectors are nonzero — a zero vector makes the dot product zero trivially, with no meaningful angle involved.
  • Making sign errors while expanding a1b1+a2b2+a3b3a_1b_1+a_2b_2+a_3b_3 with negative components — work each product out term by term rather than combining mentally.

Ask the tutor: Want to practice spotting acute versus obtuse angles from the sign of a dot product, or work through a few more perpendicularity problems with the AI tutor?

Why does a dotted with a give the square of the magnitude?

Put b⃗=a⃗\vec b=\vec a in the definition: the angle between a vector and itself is 00, and cos⁡0∘=1\cos 0^\circ=1, so a⃗⋅a⃗=∣a⃗∣∣a⃗∣cos⁡0∘=∣a⃗∣2\vec a\cdot\vec a=|\vec a||\vec a|\cos 0^\circ=|\vec a|^2. In components this matches a12+a22+a32a_1^2+a_2^2+a_3^2, which is exactly the squared-magnitude formula you already know from the distance formula, just written with dot-product notation.

If the dot product is negative, does that mean the vectors point in opposite directions?

Not necessarily — it means the angle between them is obtuse, somewhere between 90∘90^\circ and 180∘180^\circ, not that they are exactly opposite. Exactly opposite vectors (θ=180∘\theta=180^\circ) do give a negative dot product, specifically −∣a⃗∣∣b⃗∣-|\vec a||\vec b|, but so does any obtuse angle. Read a negative dot product as "leaning apart," and only conclude "exactly opposite" if you separately confirm θ=180∘\theta=180^\circ.

Do I need to memorize the angle formula separately from the definition?

No — it is the same equation rearranged. Start from a⃗⋅b⃗=∣a⃗∣∣b⃗∣cos⁡θ\vec a\cdot\vec b=|\vec a||\vec b|\cos\theta, divide both sides by ∣a⃗∣∣b⃗∣|\vec a||\vec b|, and take cos⁡−1\cos^{-1} of both sides to isolate θ\theta. If you know the definition and are comfortable rearranging one equation, you already know the angle formula; there is nothing new to remember.

Before this

Where this leads