# Differention of vectors in the scalar/dot product definition

1. Jun 18, 2010

### AlmostSwedish

1. The problem statement, all variables and given/known data

Ok, so I need to differentiate the following

theta = arccos(((r1-r2).(r3-r2))/(||r1-r2||*||r3-r2||))

With regards to r1, r2 and r3
r1, r2 and r3 are three dimensional vectors. "." is the scalar/dot product and * is ordinary multiplication.

2. Relevant equations

Definition of scalar product: a.b = ||a||*||b||*cos(theta)
Where theta is the angle between the vectors

3. The attempt at a solution

So I figured the chain rule be a good first attemt. The formula looks like this:

theta = f(R) = g(h(R)/k(R))

where I used simply used R instead of r1,r2,r3.
The derivatives then look like

f ' = g'(R)*(h'*k - h*k')

I know that g' = -1/sqrt(1-(h(R)/k(R))2)
The problem is that I'm unsure of how do differentiate the expressions for h and k. The approach I used was as to look at them as function of ordinary variables.
Differentiate with regards to r1:

h' = r0.(r3-r2)
where r0 = (1,1,1) and is the differentiation of r1 with regard to itself (Is this correct?)

In the same way; k' = ||r3-r2||

The expressions for the derivatives with regard to r3 are the same, just replace r1 with r3 (and vice versa)

For the differentiation with regards to r2:

h' = - r0.(r3-r2) - r0.(r1-r2)

k' = - ||r3-r2|| - ||r1-r2||

So naturally, my question is if this is correct (and I assume it is not, for I have never done anything like this before)? If not, where did I go wrong?

Last edited: Jun 18, 2010
2. Jun 18, 2010

### Staff: Mentor

What derivative are you trying to find? I'm going to guess that you want
$$\frac{d \theta}{dt}$$

3. Jun 18, 2010

### AlmostSwedish

No the derivatives I'm tying to find are:

$$\frac{d \theta}{dr1}$$

$$\frac{d \theta}{dr2}$$

$$\frac{d \theta}{dr3}$$

I'm sorry I didn't make myself clear in the original post. I used the " ' " just for convinience.

4. Jun 18, 2010

### Staff: Mentor

These are all partial deriviatives.

You could make life a little simpler by rewriting you equation as
cos(theta) = ((r1-r2).(r3-r2))/(||r1-r2||*||r3-r2||)

Now take the partial of both sides with respect to r_1. You'll need to know how to differentiate a dot product, and you should rewrite the norms as square roots of dot products; || r || = sqrt(r . r).

Then take the partial of both sides with respect to r_2.
take the partial of both sides with respect to r_3.

5. Jun 18, 2010

### AlmostSwedish

I don't really see why I would want move the cosine to the left side since I want an expression for the derivatives of just theta anyway.

The main problem that I've had is that I don't know how to differentiate a dot product, so if you could just show a quick example I would be most grateful.

6. Jun 19, 2010

### lanedance

diferentiating a dot product
$$\frac{d}{dt} r_1(t) \bullet r_2(t) =\frac{d r_1(t)}{dt} \bullet r_2(t)+r_1(t) \bullet \frac{dr_2(t)}{dt}$$

7. Jun 19, 2010

### lanedance

the fact that you have unit vectors in your dot product could also be useful...

8. Jun 19, 2010

### Staff: Mentor

$$\frac{\partial (cos(\theta))}{\partial r_1} = -sin(\theta)\frac{\partial \theta}{\partial r_1}$$

And after you have taken the same partial of the right side of your equation (which will be much easier to do with the arccos gone), then divide both sides of the equation by $-sin(\theta)$.