# Homework Help: Partial derivative of angle with regards to vector

1. Jul 25, 2010

### AlmostSwedish

1. The problem statement, all variables and given/known data
Find the partial derivative with regards to vector r1 for the expression:

theta = acos $$\frac{((r1-r2).(r3-r2))}{||r1-r2||*||r3-r2||}$$

where "." is the dot product

r1,r2 and r3 are positions in 3D-space. The expression above comes from the definition of the dot product

2. Relevant equations

r0 = the vector (1,1,1)
r32 = r3-r2
r12 = r1-r2

3. The attempt at a solution
The expression can be rewritten by taking the cosinus of both sides.

Differentiating the left side gives -sin(theta) * $$\frac{d theta}{d r1}$$

The right side can be written as f(r) = h(r)/k(r), and which gives the derivative of the form
(h' *k + h *k')/k^2 // Note that I use ' instead of d( )/d r1

h' becomes r0.r32
k' becomes ( || r32|| * (r0.r12) )/||r12||

This gives the right hand side of the equation according to

f ' (r) = $$\frac{(r0.r32)*||r12||*||r32||* - \frac{(r12.r32)*||r32||*(r0.r12)}{||r12||}}{(||r12||*||r32||)^2}$$

Thus the original equation becomes

-sin(theta) * d theta/d r1 = f ' (r)

d theta/d r1 = f ' (r)/-sin(theta)

Or alternatively

$$\frac{d theta}{d r1}$$ = f ' (r)/sqrt(1-f(r)^2)
if we use the derivative of arcos directly. They give the same value.

I've checked my expression for f ' (r) using numerical methods, and it is correct. However, the numerical methods give a different answer than the analytical expression for my final expression of $$\frac{d theta}{d r1}$$

Can someone help me figure out what's wrong with my solution?

Last edited: Jul 25, 2010
2. Jul 25, 2010

### Dick

The derivative of a quantity like theta with respect to a vector r1 isn't a simple scalar. It depends on the direction r1 moves. Write r1(t)=(r1+t*n) where n is the direction r1 is moving and take the derivative with respect to t. Now you have a well defined derivative and the result will, of course, depend on n.

3. Jul 26, 2010

### AlmostSwedish

That makes a lot of sense, though I'm starting to suspect that I missinterpreted the problem to begin with.
Thanks a lot!

Last edited: Jul 26, 2010
4. Jul 26, 2010

### AlmostSwedish

Quick question, if I take the derivative with respect to an element of r1, e.g x1, instead of r1, do I still have to rewrite the expression?

5. Jul 26, 2010

### Dick

That should be ok. Putting r1=(x1,y1) you should able to find expressions for dtheta/dx1 and dtheta/dy1. They are ordinary partial derivatives.

6. Jul 26, 2010

### AlmostSwedish

Thanks man. If I knew were you live I'd send you a box of cookies.