John B. answered 10/14/22
Honors Calculus Tutor with 5+ years of tutoring experience
Sine and cosines go all through the possible combinations of +sin, -sin, +cos, -cos when we keep differentiating or integrating. It can be difficult to define functions that switch between them properly.
However, by representing them as complex exponentials, it becomes much more obvious, and repeatedly differentiating is simpler.
For cosine,
cos(x) = ( e^(ix) + e^(-ix) ) / 2
And for sine:
sin(x) = ( e^(ix) - e^(-ix) ) / (2i)
Differentiating cosine k times:
d^k cos(x) / dx^k = ( i^k e^(ix) + (-i)^k e^(-ix) ) / 2
Differentiating sine:
sin(x) = ( e^(ix) - e^(-ix) ) / (2i)
d^k sin(x) / dx^k = ( (i^k) * e^(ix) - (-i)^k * e^(-ix) ) / (2i)
With the definition i^2=-1, i^3 = -i, i^4 = 1, 1/i = -i, these will work out into the sine and cosine functions that you need. But here is the general solution! ^u^