Calc Vector (dot product)

• iclutcha
In summary: Thanks for the help everyone!In summary, when calculating the cosine of an angle, you need to take into account the vector dot product of the vectors being compared. If the vectors have a direction in common (i.e. they are both pointing in the same direction), then the cosine of the angle is simply the dot product of the vectors. However, if the vectors do not have a direction in common, then the cosine of the angle is calculated by taking the cosine of the angle between the vector pointing in the same direction as the first vector and the vector pointing in the opposite direction as the first vector.

Homework Statement

The cosine of the angle between vector a and vector b is 4/21. Find p.

vector a = 6i + 3j - 2k
vector b = -2i + pj - 4k

Homework Equations

(Vector a) . (Vector b) = abcos(theta)
(Vector a) . (Vector b) = axbx + ayby + azbz
mag(a) = root(ax^2 + ay^2 + az^2)

The Attempt at a Solution

mag(a) = root(36 + 9 + 4) = 7
mag(b) = root(4 + p^2 + 16) = root(p^2 + 20)

(Vector a) . (Vector b) = -12 + 3p + 8 = 3p - 4

(Vector a) . (Vector b) = abcos(theta)
3p - 4 = 7[root(p^2 + 20)](4/21)
3p - 4 = [4/3][root(p^2 + 20)]

Square both sides

9p^2 - 24p + 16 = 16/9p^2 + 320/p

Collect like terms, and set equation to 0

(65/9)p^2 - 24p - 176/9

p = 4
p = -44/65

Thanks for the help ;)

Last edited:
iclutcha said:

Homework Statement

The cosine of the angle between vector a and vector b is 4/21. Find p.

vector a = 6i + 3j - 2k
vector b = -2i + pj - 4k

Homework Equations

(Vector a) . (Vector b) = abcos(theta)
(Vector a) . (Vector b) = axbx + ayby + azbz
mag(a) = root(ax^2 + ay^2 + az^2)

The Attempt at a Solution

mag(a) = root(36 + 9 + 4) = 7
mag(b) = root(4 + p^2 + 16) = root(p^2 + 20)

(Vector a) . (Vector b) = -12 + 3p + 8 = 3p - 4

(Vector a) . (Vector b) = abcos(theta)
3p - 4 = 7[root(p^2 + 20)](4/21)

kinda confused here... i did some attempts and i always end up with a quadratic, if someone could just give me some insight, it would be greatly appreciated. Thanks :)

What you have done so far looks OK. Why are you surprised to obtain a quadratic? There are two angles such that cos(theta) = 4/17, so you should expect that there will be two valid solutions.

jbunniii said:
What you have done so far looks OK. Why are you surprised to obtain a quadratic? There are two angles such that cos(theta) = 4/17, so you should expect that there will be two valid solutions.

Well its not so much the quadratic that troubles me, as the solution. When i solve it i get a number with decimals, and it is not near the final answer which the book gives. (4)

If someone could finish off my solution that would be great, as when i did it, it was incorrect.

Show your work so we can see where you went wrong.

Cyosis said:
Show your work so we can see where you went wrong.

I just tried it again, edited the first post, no quadratic but i could have done something wrong.

There will be a quadratic. You have a p on one side and a sqrt(p) on the other side. To solve it you raise both sides to the power two. As a result you will have a p^2 on one side and a p on the other. If you don't show us your work we can't tell you where you go wrong.

Cyosis said:
There will be a quadratic. You have a p on one side and a sqrt(p) on the other side. To solve it you raise both sides to the power two. As a result you will have a p^2 on one side and a p on the other. If you don't show us your work we can't tell you where you go wrong.

I showed my work in the first post

Seems I am going blind, sorry. I'll check it out.

Edit: You edited didn't you!

You're squaring incorrectly, $(3p - 4)^2=9p^2-24p+16$.

Cyosis said:
You're squaring incorrectly, $(3p - 4)^2=9p^2-24p+16$.

heh, yeah i did square it wrong that time... but on my paper i did it just like that, but after i use the quadratic formula on the final outcome, its still wrong... maybe you have better luck?

Well I have calculated it and i get p=-44/65 and p=4. It is not me who needs to practice this though so regardless whether I do it correctly or not we still need to see where you went wrong! It is a bit of a messy calculation but still.

Cyosis said:
Well I have calculated it and i get p=-44/65 and p=4. It is not me who needs to practice this though so regardless whether I do it correctly or not we still need to see where you went wrong! It is a bit of a messy calculation but still.

EDIT: nvm i got it, dumb mistake.

Last edited:

1. What is the definition of the dot product?

The dot product, also known as the scalar product, is a mathematical operation that takes two vectors as input and produces a scalar as output. It is defined as the product of the magnitudes of the two vectors and the cosine of the angle between them.

2. How is the dot product calculated?

The dot product can be calculated by multiplying the corresponding components of two vectors and then summing all the products. For example, if vector A = [a1, a2, a3] and vector B = [b1, b2, b3], then the dot product of A and B can be calculated as (a1 * b1) + (a2 * b2) + (a3 * b3).

3. What is the significance of the dot product in vector operations?

The dot product has several important applications in vector operations. It is used to calculate the angle between two vectors, determine if two vectors are orthogonal (perpendicular), and project one vector onto another. It is also used in physics and engineering to calculate work, energy, and power.

4. Can the dot product be negative?

Yes, the dot product can be negative. This occurs when the angle between two vectors is greater than 90 degrees. In this case, the cosine of the angle is negative, resulting in a negative dot product. A positive dot product indicates that the angle between two vectors is acute (less than 90 degrees).

5. How is the dot product used in machine learning?

In machine learning, the dot product is used in the calculation of the similarity between two vectors. It is also used in algorithms such as linear regression and logistic regression to find the best fit line or curve for a given dataset. The dot product is also used in neural networks as part of the activation function to map inputs to outputs.