# OK mathematicians, how do I do this?

**URL:** <https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289>\
**Category:** Factual Questions\
**Created:** [June 3, 2006, 3:11pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289 "2006-06-03T15:11:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 3, 2006, 3:11pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/1 "2006-06-03T15:11:22Z")

</div>

Simplicity in itself. The scalar product of two vectors is the product of their magnitudes multiplied by the cosine of the angle between them. So how do I compute the product of:

**A** = i + 2j + 3k and **B** = 2i - 3j + 4k ?

Mathcad gives **A** · **B** as 8 making the angle 66.6[sup]o[/sup]

What I seem to have either forgotten or never learned is how to find the angle between two vectors that are given in this form.

---

<div class="post-metadata">

**Author:** ![iwakura43](https://avatars.discourse-cdn.com/v4/letter/i/9de0a6/32.png) [@iwakura43](https://boards.straightdope.com/u/iwakura43)\
**Post date:** [June 3, 2006, 3:32pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/2 "2006-06-03T15:32:13Z")

</div>

> [@David Simmons](#):
>
> The scalar product of two vectors is the product of their magnitudes multiplied by the cosine of the angle between them. So how do I compute the product of:
> 
> **A** = i + 2j + 3k and **B** = 2i - 3j + 4k ?

Right. Written as a formula, that gives us:

A·B = |A||B| cos theta

A·B / (|A||B|) = cos theta

A·B = (1)(2) = (2)(-3) + (3)(4) = 8  
|A| = sqrt(1^2 + 2^2 + 3^2) = sqrt(14)  
|B| = sqrt(2^2 + (-3)^2 + 4^2) = sqrt(29)

8/(sqrt 14\*sqrt 29) = .3971 = cos theta  
arccos(.3971) = 66.6 degrees, agreeing with Mathcad

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 3, 2006, 3:47pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/3 "2006-06-03T15:47:32Z")

</div>

> [@iwakura43](#):
>
> Right. Written as a formula, that gives us:
> 
> A·B = |A||B| cos theta
> 
> A·B / (|A||B|) = cos theta
> 
> A·B = (1)(2) = (2)(-3) + (3)(4) = 8  
> |A| = sqrt(1^2 + 2^2 + 3^2) = sqrt(14)  
> |B| = sqrt(2^2 + (-3)^2 + 4^2) = sqrt(29)
> 
> 8/(sqrt 14\*sqrt 29) = .3971 = cos theta  
> arccos(.3971) = 66.6 degrees, agreeing with Mathcad

I assume that you meant this - A·B = (1)(2) = (2)(-3) + (3)(4) = 8 - t really be this - A·B = (1)(2) **+** (2)(-3) + (3)(4) = 8

So that means that the dot product is merely the sum of the product of the individual terms of the two vectors.

Hmmm. How did I manage to either miss or forget that?

I have to confess that if **A** = a[sub]1[/sub]i + a[sub]2[/sub]j + a[sub]3[/sub]k and **B** = b[sub]1[/sub]i + b[sub]2[/sub]j + b[sub]3[/sub]k then the fact that:

| **A** || **B** |cosß = a[sub]1[/sub]b[sub]1[/sub] + a[sub]2[/sub]b[sub]2[/sub] + a[sub]3[/sub]b[sub]3[/sub] isn’t immediately obvious.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [June 3, 2006, 4:08pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/4 "2006-06-03T16:08:10Z")

</div>

> [@David Simmons](#):
>
> | **A** || **B** |cosß = a[sub]1[/sub]b[sub]1[/sub] + a[sub]2[/sub]b[sub]2[/sub] + a[sub]3[/sub]b[sub]3[/sub] isn’t immediately obvious.

Maybe the Wikipedia entry on the [dot product](http://en.wikipedia.org/wiki/Dot_product) will help.

---

<div class="post-metadata">

**Author:** ![Mathochist](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mathochist](https://boards.straightdope.com/u/Mathochist)\
**Post date:** [June 3, 2006, 4:13pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/5 "2006-06-03T16:13:44Z")

</div>

> [@David Simmons](#):
>
> I have to confess that if **A** = a[sub]1[/sub]i + a[sub]2[/sub]j + a[sub]3[/sub]k and **B** = b[sub]1[/sub]i + b[sub]2[/sub]j + b[sub]3[/sub]k then the fact that:
> 
> | **A** || **B** |cosß = a[sub]1[/sub]b[sub]1[/sub] + a[sub]2[/sub]b[sub]2[/sub] + a[sub]3[/sub]b[sub]3[/sub] isn’t immediately obvious.

You cited that in your original post.

> [@](#):
>
> The scalar product of two vectors is the product of their magnitudes multiplied by the cosine of the angle between them.

Now, if you mean to add the question of why that statement is true: no, it’s not immediately obvious. It generally takes a calculation, like involving the law of cosines.

Let p, q, and r be points in space (n-dimensional, if you want). Let **v** go directly from p to r, **u** go from q to p, and **w** go from q to r. Now by properties of inner products,

| **v** |[sup]2[/sup] =  
**v** · **v** =  
(- **u** + **w** )·(- **u** + **w** ) =  
**u** · **u** - **u** · **w** - **w** · **u** + **w** · **w**  
| **u** |[sup]2[/sup] + | **w** |[sup]2[/sup] - 2 **u** · **w**

While by the law of cosines,

| **v** |[sup]2[/sup] =  
| **u** |[sup]2[/sup] + | **w** |[sup]2[/sup] - 2| **u** || **w** |cos(?)

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 3, 2006, 4:16pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/6 "2006-06-03T16:16:23Z")

</div>

> [@Thudlow Boink](#):
>
> Maybe the Wikipedia entry on the [dot product](http://en.wikipedia.org/wiki/Dot_product) will help.

:smack: While you were posting I went back to my text _Mathematics Of Modern Physics and Engineering_, Sokolnikoff and Redheffer, and found the answer in a part I skimmed over because “I already **know** that.”

The answer isn’t immediately obvious but it’s pretty simple. Considering what the dot product is and taking account of the various dot products of the unit vectors i, j, and k, the answer falls out directly in a few easy steps.

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 3, 2006, 4:33pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/7 "2006-06-03T16:33:39Z")

</div>

> [@David Simmons](#):
>
> :smack: While you were posting I went back to my text _Mathematics Of Modern Physics and Engineering_, Sokolnikoff and Redheffer, and found the answer in a part I skimmed over because “I already **know** that.”
> 
> The answer isn’t immediately obvious but it’s pretty simple. Considering what the dot product is and taking account of the various dot products of the unit vectors i, j, and k, the answer falls out directly in a few easy steps.

Oh hell. Just for completeness and to make sure I don’t forget again (I don’t really have all that much time in which to forget, now that I think of it) here’s the text’s development.

(a[sub]1[/sub]i + a[sub]2[/sub]j + a[sub]3[/sub]k)·(b[sub]1[/sub]i + b[sub]2[/sub]j + b[sub]3[/sub]k) =

a[sub]1[/sub]b[sub]1[/sub]i·i + a[sub]1[/sub]b[sub]2[/sub]i·j + a[sub]1[/sub]b[sub]3[/sub]i·k +a[sub]2[/sub]b[sub]1[/sub]j·i + a[sub]2[/sub]b[sub]2[/sub]j·j + a[sub]2[/sub]b[sub]3[/sub]j\*k + a[sub]3[/sub]b[sub]1[/sub]k·i + a[sub]3[/sub]b[sub]2[/sub]k·j + a[sub]3[/sub]b[sub]3[/sub]k·k

i·i = j·j = k·k = 1 and all the other dot products of these vectors are 0 leaving only:

a[sub]1[/sub]b[sub]1[/sub] +a[sub]2[/sub]b[sub]2[/sub] + a[sub]3[/sub]b[sub]3[/sub]

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [June 3, 2006, 5:10pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/8 "2006-06-03T17:10:36Z")

</div>

For what it’s worth, most of the books I’ve seen define **a** · **b** as [symbol]S[/symbol][sub]i[/sub]a[sub]i[/sub]b[sub]i[/sub].

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 3, 2006, 9:28pm UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/9 "2006-06-03T21:28:10Z")

</div>

> [@ultrafilter](#):
>
> For what it’s worth, most of the books I’ve seen define **a** · **b** as [symbol]S[/symbol][sub]i[/sub]a[sub]i[/sub]b[sub]i[/sub].

That’s probably good for mathematicians. For physicists the other definition might be more illuminating.

For example the work done is force X distance or FS. If the object is constraned to a particular path and the force is at an angle to the path then the work is FScosß which is **F** · **S**.

---

<div class="post-metadata">

**Author:** ![Mathochist](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mathochist](https://boards.straightdope.com/u/Mathochist)\
**Post date:** [June 4, 2006, 3:35am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/10 "2006-06-04T03:35:18Z")

</div>

> [@David Simmons](#):
>
> That’s probably good for mathematicians. For physicists the other definition might be more illuminating.

Not really. In fact, in special relativity, the dot product is changed by changing its formula. Then the angle is defined as that which makes the cosine relation hold.

Btw, **ultrafilter** while such forms _can_ be diagonalized, I don’t think most books assume that from the get-go.

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 4, 2006, 4:27am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/11 "2006-06-04T04:27:02Z")

</div>

> [@Mathochist](#):
>
> Not really. In fact, in special relativity, the dot product is changed by changing its formula. Then the angle is defined as that which makes the cosine relation hold.
> 
> Btw, **ultrafilter** while such forms _can_ be diagonalized, I don’t think most books assume that from the get-go.

That’s somewhat beyond my depth, but special relativity, I think, depends a lot more on mathematical insight than on physical.

---

<div class="post-metadata">

**Author:** ![Mathochist](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Mathochist](https://boards.straightdope.com/u/Mathochist)\
**Post date:** [June 4, 2006, 4:29am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/12 "2006-06-04T04:29:08Z")

</div>

> [@David Simmons](#):
>
> That’s somewhat beyond my depth, but special relativity, I think, depends a lot more on mathematical insight than on physical.

The calculations yes. The motivations, no.

Besides which, you can’t get very far at all these days as a physicist without it.

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 4, 2006, 4:46am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/13 "2006-06-04T04:46:49Z")

</div>

> [@Mathochist](#):
>
> The calculations yes. The motivations, no.
> 
> Besides which, you can’t get very far at all these days as a physicist without it.

Absolutely. For many years now, if you can’t do the mathematics at virtually a PhD math level you won’t go far in physics.

I was speaking more of the insight into what is going on in special and general relativity than the motivation for it. It’s hard to visualize such things and it’s necessary, I think, to rely on what the mathematics is telling you than in having a physical picture. And with quantum mechanics that seems to be absolutely true.

---

<div class="post-metadata">

**Author:** ![Measure\_for\_Measure](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/measure_for_measure/32/557_2.png) [@Measure\_for\_Measure](https://boards.straightdope.com/u/Measure_for_Measure)\
**Post date:** [June 4, 2006, 5:09am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/14 "2006-06-04T05:09:51Z")

</div>

I too would appreciate some math help.

Two vector equations. Solve for the scalar.

**h’a** = 1  
**Vh** - theta\ ***a** = 0

h and a are vectors. V is a matrix. theta is a scalar.

Ok. I’ve gotten as far as this:

**h** = theta\ ***V** [sup]-1[/sup] **a**

Apparently the following is true. But I don’t know how to follows from the first 2 equations:

theta = 1 / **a’V** [sup]-1[/sup] **a**

Any ideas?

---

<div class="post-metadata">

**Author:** ![Hypnagogic\_Jerk](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/hypnagogic_jerk/32/4252_2.png) [@Hypnagogic\_Jerk](https://boards.straightdope.com/u/Hypnagogic_Jerk)\
**Post date:** [June 4, 2006, 6:44am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/15 "2006-06-04T06:44:58Z")

</div>

Well, starting from  
**h** [sup]T[/sup] **a** = 1  
**Vh** - theta_ **a** = **0** ,  
what you can do is multiply the second equation by **h** [sup]T[/sup] from the left, getting  
 **h** [sup]T[/sup] **Vh** - theta_ **h** [sup]T[/sup] **a** = **h** [sup]T[/sup] **0**  
=\> **h** [sup]T[/sup] **Vh** - theta\*1 = 0  
=\> theta = **h** [sup]T[/sup] **Vh** ,  
which is not the suggested answer but I don’t find anything wrong with my derivation. Maybe I misinterpreted your equations (the apostrophe stands for transposition, right?), or maybe you made a mistake while writing them.

I also see that you invert matrix **V** in your derivation; are you sure that it is invertible in the first place?

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 4, 2006, 7:14am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/16 "2006-06-04T07:14:48Z")

</div>

> [@Measure for Measure](#):
>
> I too would appreciate some math help.
> 
> Two vector equations. Solve for the scalar.
> 
> **h’a** = 1  
> **Vh** - theta\ ***a** = 0
> 
> h and a are vectors. V is a matrix. theta is a scalar.
> 
> Ok. I’ve gotten as far as this:
> 
> **h** = theta\ ***V** [sup]-1[/sup] **a**
> 
> Apparently the following is true. But I don’t know how to follows from the first 2 equations:
> 
> theta = 1 / **a’V** [sup]-1[/sup] **a**  
> Any ideas?

you first equation solves as h[sup]T[/sup] = a[sup]-1[/sup]

set a[sup]-1[/sup] = b then h = b[sup]T[/sup]

taking your equation h = theta\*V[sup]-1[/sup]a and eliminate h between the two equations.

b[sup]T[/sup] = theta\*V[sup]-1[/sup]a

move the transpose of b to the right hand side and replace b[sup]-1[/sup] by a.

1 = theata\*a[sup]T[/sup]V[sup]-1[/sup]a

restoring your bolding and solving for theta

theta = 1/ **a** [sup]T[/sup] **V** [sup]-1[/sup] **a**

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 4, 2006, 7:43am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/17 "2006-06-04T07:43:38Z")

</div>

On looking over my last post, I think that the next to last step is invalid so I think the solution I gave isn’t correct. I need more time, more time.

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 4, 2006, 8:01am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/18 "2006-06-04T08:01:59Z")

</div>

The first step is wrong too.

---

<div class="post-metadata">

**Author:** ![Measure\_for\_Measure](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/measure_for_measure/32/557_2.png) [@Measure\_for\_Measure](https://boards.straightdope.com/u/Measure_for_Measure)\
**Post date:** [June 4, 2006, 8:13am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/19 "2006-06-04T08:13:34Z")

</div>

Thanks to severus and David Simmons for helping me out. I think I’ve got it now.

**David** :  
a is a vector, not a square matrix so it can’t be inverted AFAIK. (Crosspost!)

**severus**  
Yeah, V is “assumed nonsingular”. I forgot to mention that it was symmetric. I had no idea that the inverse of a symmetric matrix was also symmetric. (This would follow from the theorem that the inverse of the transpose is the transpose of the inverse or (A’)[sup]-1[/sup] = (A[sup]-1[/sup])’ )

With your prodding, I think I got it.

theta = h’Vh  
theta\ ***a** = **Vh**

_V[sup]-1[/sup] **theta** a_\* = h

Take transpose of both sides, recall that (AB)’ = B’A’, then postmultiply by a:

theta\* **a’(V[sup]-1[/sup])'a** = \*\*h’a \*\* = 1

Remove transpose from V[sup]-1[/sup], by noting that V is symmetric:

theta= 1 / **a’(V[sup]-1[/sup])a**

Thanks again for your help gang!

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [June 4, 2006, 8:52am UTC](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289/20 "2006-06-04T08:52:45Z")

</div>

Oh my God, it’s unbelievably simple.

h and a must be the column vectors

```auto

|h1|
| |
|h2|
| |
|he| 
and
|a1|
| |
|a2|
| |
|a3|

so h[sup]T[/sup]a = h1a1 + h2a2 + h3a3 which is the same as a[sup]T[/sup]h.

```

in that case all we need do is multply both sides of h = theta\*V[sup]-1[/sup]a by a[sup]T[/sup]

a[sup]T[/sup]h = theta\*a[sup]T[/sup]V[sup]-1[/sup]h

which is

1 = theta\*a[sup]T[/sup]V[sup]-1[/sup]h

[Next page](https://boards.straightdope.com/t/ok-mathematicians-how-do-i-do-this/359289.md?page=2)
