# General formula for derivative (nth formula)

1. Feb 11, 2012

### raining

Finding the General Formula for derivative (nth formula)

Given function = (x*cos(x)) or xcos(x).

Need to find the general formula for the derivative when n=n and test it for n=2 or 3.

I have taken the first five derivatives and observed a pattern, however, I'm not exactly getting the correct values for n=2 and n=3 when I plug it into my formula, which means my formula is wrong.

Need help..

First five derivatives:-

(f)'= cos(x) - x sin(x)

(f)''=-2 sin(x) - x cos(x)

(f)'''=-3 cos(x) + x sin(x)

(f)''''=4 sin(x) + x cos(x)

(f)'''''=5 cos(x) - x sin(x)

Last edited: Feb 11, 2012
2. Feb 11, 2012

### SammyS

Staff Emeritus
Re: Finding the General Formula for derivative (nth formula)

Hello raining. Welcome to PF !

First of all, can you describe the pattern in words?

Last edited: Feb 11, 2012
3. Feb 11, 2012

### tiny-tim

welcome to pf!

it's raining! welcome to pf!

looks ok

you can use the binomial thorem for nth derivatives of f(x)g(x) …

(fg)(n) = ∑ nCr f(r)g(n-r)

in this case, if f(x) = x, then f(1) = 1 and f(n) = 0 for n≥ 2

4. Feb 11, 2012

### raining

Basically, I need to find a general formula for the derivative such that (f)''=-2 sin(x) - x cos(x).

The pattern which I observed is that when n is an even number like 2 or 4, sin(x) is the first element of the derivative and the value of "n" is attached to it whereas when n is an odd number like 3 or 5, cos(x) is the first element and the value of "n" is attached to it.. Both of them interchange places depending upon whether n is even or odd. I simply don't know how can I generate a general formula which gives me these results for any value of n.

5. Feb 11, 2012

### raining

@ tiny-tim,

are u sure the general formula can be obtained by using the binomial theorem? I basically have to get the general formula on the basis of the five derivatives I have calculated. I have to use them as a basis for my general formula.

6. Feb 11, 2012

### HallsofIvy

Staff Emeritus
A couple of points from the derivatives you posted.
i) It looks like the coefficient (without sign) of the first term is 1, 2, 3, 4, ... n for the nth derivative.

ii) It also appears that the sign is going 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, ... Can you write that as a power of -1? Think in groups of 4. What if n= 4j, 4j+1, 4j+2, or 4j+ 3?

iii) The first term is alternating "cosine", "sine", "cosine", "sine", "cosine".... The second term is doing the same thing except that it starts with sine rather than cosine.

Perhaps it would be simplest to give one for formula for n odd and another for n even.

7. Feb 11, 2012

### tiny-tim

it's ok to treat even and odd cases separately

i just showed you the other way as a matter of interest, and also as an independent check on your result

8. Feb 11, 2012

### raining

Thanks again for your kind replies.

I'll treat them separately and then check my results. Will also follow the binomial theorem as a alternative way to check my results. Thanks tim.

But is there a possibility to give one general formula? I've been asked to give one formula so... :( I'll try and post my results..

9. Feb 11, 2012

### SammyS

Staff Emeritus
You can achieve the desired result in a number of ways. It depends on your preferences and, of course, depends upon your math background. You can use a piecewise defined formula, a formula using modular arithmetic or the mod() function, perhaps some combination of absolute values, maybe ceiling or floor functions ...

The following are some sequences using sine and cosine functions. You can "shift" them by replacing n with n±1 or n±2 ...

Look at the sequences:
{ sin(nπ/2) }

{ cos(nπ/2) }

{ sin(nπ/2) + cos(nπ/2) }​

10. Feb 11, 2012

### raining

As I'm a university freshman, so basically I'm unfortunately unfamiliar with modular arithmetic or the mod() function.

You can think of me as a rookie in Calculus.. so on the basis of that I should be solving this problem.

What are the options I have as a fresher?

Thanks alot to everyone for all their help so far. Appreciate it alot.

Basically, I need a very general formula that one would expect to use at high-school or university first-year level Calculus.

11. Feb 11, 2012

### SammyS

Staff Emeritus
Did you kook at those sequences?

What is $\displaystyle \sin\left(n(\frac{\pi}{2})\right)$ when n = 1, 2, 3, 4, 5, 6, ... ?

n | sin(n π/2) | cos(n π/2)
|               |
1 |     1       |      0
|               |
2 |     0       |     -1
|               |
3 |    -1       |      0
|               |
4 |     0       |      1
|               |
5 |     1       |      0
|               |
6 |     0       |     -1
|               |
7 |    -1       |      0
|               |
8 |     0       |      1
|               |
9 |     1       |      0
|               |

Last edited: Feb 11, 2012
12. Feb 11, 2012

### raining

Have sent u a PM Sammy.