<P> Given two vectors a and b separated by angle θ (see image right), they form a triangle with a third side c = a − b . The dot product of this with itself is: </P> <Dl> <Dd> c ⋅ c = (a − b) ⋅ (a − b) = a ⋅ a − a ⋅ b − b ⋅ a + b ⋅ b = a 2 − a ⋅ b − a ⋅ b + b 2 = a 2 − 2 a ⋅ b + b 2 c 2 = a 2 + b 2 − 2 a b cos ⁡ θ (\ displaystyle (\ begin (aligned) \ mathbf (c) \ cdot \ mathbf (c) & = (\ mathbf (a) - \ mathbf (b)) \ cdot (\ mathbf (a) - \ mathbf (b)) \ \ & = \ mathbf (a) \ cdot \ mathbf (a) - \ mathbf (a) \ cdot \ mathbf (b) - \ mathbf (b) \ cdot \ mathbf (a) + \ mathbf (b) \ cdot \ mathbf (b) \ \ & = a ^ (2) - \ mathbf (a) \ cdot \ mathbf (b) - \ mathbf (a) \ cdot \ mathbf (b) + b ^ (2) \ \ & = a ^ (2) - 2 \ mathbf (a) \ cdot \ mathbf (b) + b ^ (2) \ \ c ^ (2) & = a ^ (2) + b ^ (2) - 2ab \ cos \ theta \ \ \ end (aligned))) </Dd> </Dl> <Dd> c ⋅ c = (a − b) ⋅ (a − b) = a ⋅ a − a ⋅ b − b ⋅ a + b ⋅ b = a 2 − a ⋅ b − a ⋅ b + b 2 = a 2 − 2 a ⋅ b + b 2 c 2 = a 2 + b 2 − 2 a b cos ⁡ θ (\ displaystyle (\ begin (aligned) \ mathbf (c) \ cdot \ mathbf (c) & = (\ mathbf (a) - \ mathbf (b)) \ cdot (\ mathbf (a) - \ mathbf (b)) \ \ & = \ mathbf (a) \ cdot \ mathbf (a) - \ mathbf (a) \ cdot \ mathbf (b) - \ mathbf (b) \ cdot \ mathbf (a) + \ mathbf (b) \ cdot \ mathbf (b) \ \ & = a ^ (2) - \ mathbf (a) \ cdot \ mathbf (b) - \ mathbf (a) \ cdot \ mathbf (b) + b ^ (2) \ \ & = a ^ (2) - 2 \ mathbf (a) \ cdot \ mathbf (b) + b ^ (2) \ \ c ^ (2) & = a ^ (2) + b ^ (2) - 2ab \ cos \ theta \ \ \ end (aligned))) </Dd> <P> which is the law of cosines . </P>

The square of vector a is equal to