Civil Engineering (CE) Exam  >  Civil Engineering (CE) Notes  >  Engineering Mechanics  >  Dot Product of Vectors

Dot Product of Vectors | Engineering Mechanics - Civil Engineering (CE) PDF Download

Introduction

The dot product is a value expressing the angular relationship between two vectors.  In this article we will learn how this value is calculated, its mathematical significance, and several ways in which this function is useful in 3D applications.

Calculating the Dot Product

A dot product is a scalar value that is the result of an operation of two vectors with the same number of components.  Given two vectors A and B each with n components, the dot product is calculated as:

A · B = A1B1 + ... + AnBn

The dot product is thus the sum of the products of each component of the two vectors.  For example if A and B were 3D vectors:

A · B = A.x * B.x + A.y * B.y + A.z * B.z

A generic C++ function to implement a dot product on two floating point vectors of any dimensions might look something like this:

float dot_product(float *a,float *b,int size)
{    float dp = 0.0f;
    for (inti=0;i<size;i++)
        dp += a[i] * b[i];
    return dp;}

This sample code is provided solely for the purpose of showing a generic function to clarify how the dot product is calculated;  DirectX provides several implementations of this function for you, as you will see , though if you did need to write your own function (for example if using C++ without the D3DX libraries) you would likely just write separate functions to handle the vector types commonly used (2D,3D,4D) as inline code.

Dot Product of Vectors | Engineering Mechanics - Civil Engineering (CE)

So what does it mean?

Earlier we said that the dot product represents an angular relationship between two vectors, and left it at that.  Now we'll take a closer look at what this value represents.

Dot Product of Vectors | Engineering Mechanics - Civil Engineering (CE)

Let's say we have two vectors, A and B, as shown to the left.  The values |A| and |B| represent the lengths of vectors A and B, respectively, and Θ is the angle between the two vectors.  The dot product of vectors A and B will have the following relationship to these values:

A · B = |A| * |B| * cos(Θ)

That is to say, the dot product of two vectors will be equal to the cosine of the angle between the vectors, times the lengths of each of the vectors.

Angular Domain of Dot Product:

Given the characteristics of the cosine function, we can deduce three possible conditions:

  1. If A and B are perpendicular (at 90 degrees to each other), the result of the dot product will be zero, because cos(Θ) will be zero.
  2. If the angle between A and B are less than 90 degrees, the dot product will be positive (greater than zero), as cos(Θ) will be positive, and the vector lengths are always positive values.
  3. If the angle between A and B are greater than 90 degrees, the dot product will be negative (less than zero), as cos(Θ) will be negative, and the vector lengths are always positive values.

Angle from Dot Product of Unit Vectors

The above characteristics are true for any vectors with non-zero length.  In addition, there is a special case when both vectors are unit vectors, that is, vectors with a length of one (1.0).  In this case, the lengths of the vectors does not contribute to the equation, simplifying to:

A · B = |A| * |B| * cos(Θ)
A · B = 1 * 1 * cos(Θ)
A · B = cos(Θ)

In this case, the dot product is equal to the cosine of the angle between the vectors.  Thus the angle between unit vectors can be calculated as:

Θ = acos(A · B)

Angle from Dot Product of Non-Unit Vectors

Angles between non-unit vectors (vectors with lengths not equal to 1.0) can be calculated either by first normalizing the vectors, or by dividing the dot product of the non-unit vectors by the length of each vector.

Dot Product of Vector with Itself

Taking the dot product of a vector against itself (i.e. A · A) results in a value equal to the square of the vector's length.  This is a familiar portion of the distance equation, d=sqrt(x*x+y*y+z*z).

Projection of Vector onto another Vector

If one were to take the dot product of a unit vector A and a second vector B of any non-zero length, the result is the length of vector B projected in the direction of vector A (see illustration to left).  This is used in a number of ways, such as collision response and conversion of vectors from one coordinate system to another (this forms the basis of matrix transformations).

Dot Product of Vectors | Engineering Mechanics - Civil Engineering (CE)

The document Dot Product of Vectors | Engineering Mechanics - Civil Engineering (CE) is a part of the Civil Engineering (CE) Course Engineering Mechanics.
All you need of Civil Engineering (CE) at this link: Civil Engineering (CE)
24 videos|59 docs|53 tests

Top Courses for Civil Engineering (CE)

FAQs on Dot Product of Vectors - Engineering Mechanics - Civil Engineering (CE)

1. What is the definition of the dot product of vectors?
Ans. The dot product, also known as the scalar product, is a mathematical operation that takes two vectors and produces a scalar. It is calculated by multiplying the corresponding components of the vectors and summing them up.
2. How is the dot product of vectors calculated?
Ans. To calculate the dot product of two vectors, you multiply the corresponding components of the vectors and sum them up. For example, if vector A = (a₁, a₂, a₃) and vector B = (b₁, b₂, b₃), then the dot product (A · B) is calculated as (a₁ * b₁) + (a₂ * b₂) + (a₃ * b₃).
3. What is the significance of the dot product of vectors?
Ans. The dot product has several important applications in mathematics and physics. It is used to find the angle between two vectors, determine if two vectors are orthogonal or parallel, calculate the projection of a vector onto another vector, and solve geometric problems involving vectors.
4. Can the dot product of vectors be negative?
Ans. Yes, the dot product of vectors can be negative. The sign of the dot product depends on the angle between the vectors. If the angle is acute (less than 90 degrees), the dot product is positive. If the angle is obtuse (greater than 90 degrees), the dot product is negative. If the vectors are perpendicular (angle of 90 degrees), the dot product is zero.
5. How is the dot product related to vector lengths and angles?
Ans. The dot product is related to vector lengths and angles through the formula: A · B = |A| |B| cos(θ), where |A| and |B| are the magnitudes of the vectors A and B, and θ is the angle between them. This formula allows us to calculate the dot product using the lengths of the vectors and the angle between them, or to find the angle between two vectors using the dot product and their lengths.
24 videos|59 docs|53 tests
Download as PDF
Explore Courses for Civil Engineering (CE) exam

Top Courses for Civil Engineering (CE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

ppt

,

Dot Product of Vectors | Engineering Mechanics - Civil Engineering (CE)

,

Free

,

mock tests for examination

,

Important questions

,

Dot Product of Vectors | Engineering Mechanics - Civil Engineering (CE)

,

video lectures

,

Semester Notes

,

Sample Paper

,

shortcuts and tricks

,

pdf

,

Exam

,

Summary

,

past year papers

,

Dot Product of Vectors | Engineering Mechanics - Civil Engineering (CE)

,

practice quizzes

,

Viva Questions

,

MCQs

,

Objective type Questions

,

Previous Year Questions with Solutions

,

Extra Questions

,

study material

;