# Chain rule problem

1. Sep 17, 2011

### SUDOnym

I always get muddled when I'm dealing with chain rule of any degree of complexity and also when dealing with powers of trig. functions - this problem contains both:

find $$\frac{\partial n}{\partial A}$$ and $$\frac{\partial n}{\partial D}$$ of the following function:

$$n=\frac{\sin(\frac{A+D}{2})}{\sin(\frac{A}{2})}$$

also find $$|\frac{\partial n}{\partial D}|^{2}$$ $$|\frac{\partial n}{\partial A}|^{2}$$

My Attempt:

$$n=\frac{\sin(\frac{A+D}{2})}{\sin(\frac{A}{2})}$$
$$\implies n=\sin(\frac{A+D}{2})[\sin(\frac{A}{2})]^{-1}$$
$$\implies\frac{\partial n}{\partial A}=\frac{1}{2}\cos(\frac{A+D}{2})[\sin(\frac{A}{2})]^{-1}+\sin(\frac{A+D}{2})(-1)[\sin(\frac{A}{2})]^{-2}(\frac{1}{2})\cos(\frac{A}{2})$$

$$=\frac{1}{2}\frac{\cos(\frac{A+D}{2})}{\sin(\frac{A}{2})}-\frac{1}{2}\frac{\sin(\frac{A+D}{2})\cos(\frac{A}{2})}{[\sin(\frac{A}{2})]^{2}}$$

$$=\frac{1}{2\sin(\frac{A}{2})}[\cos(\frac{A+D}{2})-\sin(\frac{A+D}{2})\arctan(\frac{A}{2})]$$

$$\implies|\frac{\partial n}{\partial A}|^{2}=\frac{1}{4\sin^{2}(\frac{A}{2})}[\cos^{2}(\frac{A+D}{2})+\sin^{2}(\frac{A+D}{2})\arctan^{2}(\frac{A}{2})-2\cos(\frac{A+D}{2})\sin(\frac{A+D}{2})\arctan(\frac{A}{2})]$$

*Correction that last arctan term should read $$\arctan(\frac{A}{2})$$

At this point I tried to simplify the trig. a bit.... (but a don't think I did a great job!):

$$=\frac{1}{4\sin^{2}(\frac{A}{2})}[\frac{1}{2}\cos(A+D)+1]+[\frac{1}{2}(-\cos(A+D)+1)]\arctan^{2}(\frac{A}{2})-\sin(A+D)\arctan(\frac{A}{2})$$

Main issues I have with the above are: I am never any good with chain rule and also re. the trig. I keep getting confused as to whether for example the function:
$$\sin^{x}(A)$$
is in all cases completely equivalent to:
$$[\sin(A)]^{x}$$

ie. are there some cases where they are not equivalent? - this confusion may or may not have caused errors in my attempt above...

OK, now $$\frac{\partial n}{\partial D}$$ is a little easier:

$$\frac{\partial n}{\partial D}=\frac{1}{2}\cos(\frac{A+D}{2})[\sin(\frac{A}{2})]^{-1}$$

$$\implies|\frac{\partial n}{\partial D}|^{2}=\frac{1}{4}\cos^{2}(\frac{A+D}{2})[\sin(\frac{A}{2})]^{-2}$$

All advice and corrections are greatly appreciated.

Last edited: Sep 18, 2011
2. Sep 17, 2011

### Fellowroot

Your original function is pretty complex.

$$n=\frac{\sin(\frac{A+D}{2})}{\sin(\frac{A}{2})}$$

I will show you how to find find

$$\frac{\partial n}{\partial A}$$ of $$n=sin(\frac{A+D}{2})$$

after seeing this then you can apply it to the problem as a whole using quotient rule.

$$\frac{\partial n}{\partial A}$$=[cos(0.5A+0.5D)](0.5)

Think, this is a partial derivative with respect to A, this means that A is the only variable and that everything else including D will be held constant.

Chain rule goes like this: derivative of the outside, inside stays the same then derivative of the inside, repeat until you don't have anymore insides.

The outside was sin() and the inside was (0.5A+0.5D) and the derivative of the inside as (0.5)

3. Sep 17, 2011

### ehild

I would apply the sum rule, and write n in terms of separate trigonometric functions of A/2 and D/2.

And sin^n(A) means [sin(A)]^n.

ehild

4. Sep 18, 2011

### SUDOnym

... so going by the above comments, I think I used the chain rule correctly (@ehilld I find chain rule easier than sum rule mostly!) - can anyone suggest tips on if there is a way I can simplify the trig. a little?

5. Sep 18, 2011

### ehild

Apply the sum rule. Really.

You can find that sin(a+b) =sin(a)cos(b)+cos(a)sin(b)

The function n=sin((A+B)/2)/sin(A/2) simplifies to

$n=\frac{\sin(A/2) \cos(B/2) + \cos(A/2) \sin(B/2)}{\sin(A/2)}=\cos(B/2)+\sin(B/2) \cot(A/2)$.

When squaring, you can remove the half-angles by using the identities

sin2(A/2)=0.5(1-cos(A)),
cos2(A/2)=0.5(1+cos(A)), which you have tried, but did something wrong. cos^2((A+D)/2)+sin^2((A+D)/2)=1 instead that complicated something you wrote.

By the way, you replaced cos(A/2)/sin(A/2) with arctan(A/2), which is wrong. It is cotangent, cot(A/2).

ehild

6. Sep 18, 2011

### SUDOnym

@ehild

OK, so from my original formula:

$$n=\frac{\sin(\frac{A+D}{2})}{\sin(\frac{A}{2})}$$

$$\implies n=\cos(\frac{D}{2})+\cot(\frac{A}{2})\sin(\frac{D}{2})$$

$$\implies\frac{\partial n}{\partial A}=[-\frac{1}{\sin^{2}(\frac{A}{2})}](\frac{1}{2})\sin(\frac{D}{2})=-\frac{1}{2}\frac{\sin(\frac{D}{2})}{\sin^{2}(\frac{A}{2})}$$

$$\implies|\frac{\partial n}{\partial A}|^{2}=\frac{1}{4}[\frac{\sin(\frac{D}{2})}{\sin^{2}(\frac{A}{2})}]^{2}$$

and for:

$$\frac{\partial n}{\partial D}$$

$$\frac{\partial n}{\partial D}=-(\frac{1}{2})\sin(\frac{D}{2})+(\frac{1}{2})\cot(\frac{A}{2})\cos(\frac{D}{2})$$

$$=-(\frac{1}{2})\sin(\frac{D}{2})+(\frac{1}{2})\frac{\cos(\frac{D}{2})}{\tan(\frac{A}{2})}$$

$$\implies|\frac{\partial n}{\partial D}|^{2}=(\frac{1}{4})\sin^{2}(\frac{D}{2})-(\frac{1}{2})\frac{\sin(\frac{D}{2})\cos(\frac{D}{2})}{\tan(\frac{A}{2})}+(\frac{1}{4})\frac{\cos^{2}(\frac{D}{2})}{\tan^{2}(\frac{A}{2})}$$

$$=(\frac{1}{4})(\frac{1}{2})(1-\cos(D))-(\frac{1}{2})(\frac{1}{2})\frac{\sin(D)}{\tan(\frac{A}{2})}+[\frac{\cos(\frac{D}{2})}{\tan(\frac{A}{2})}]^{2}(\frac{1}{4})$$

$$=\frac{1}{4}((\frac{1}{2})(1-\cos(D))-\frac{\sin(D)}{\tan(\frac{A}{2})}+[\frac{\cos(\frac{D}{2})}{\tan(\frac{A}{2})}]^{2})$$

Can you please confirm that this is correct? (although I still used the chain rule... I don't think that sum rule would have made life much easier, but stand to be corrected there...)

please note, this formula for n is for finding refractive index of material using a prism where A and D are two angles.... the reason I want square of partial derivatives is so that I can then use them in the error propogation formula along with my error in A and D in order to find error in n. So, I suppose it is not essential that I reduce the trig. to the most simple form possible so long as the final formula is in some way tractable - that said, dealing with trig. has been a weakness of mine for a very long time and so I am eager to improve in this area.

7. Sep 18, 2011

### ehild

The derivative with respect to D is simpler in the original form,
$$\frac{\partial n}{\partial D}=\frac{1}{2}\frac{\cos(\frac{A+D}{2})}{sin(\frac{A}{2})}$$. The derivative with respect to A is
$$\frac{\partial n}{\partial A}=-\frac{1}{2}\frac{\sin(\frac{D}{2})}{\sin^{2}(\frac {A}{2})}$$
You need not do the squares. When evaluating the squares of the derivatives, the simplest way is to evaluate the derivatives and then square them (the numbers, not the formulae).

ehild