Puzzled by WolframAlpha

1. Jul 12, 2010

PeterPumpkin

I wanted to differentiate (cos(x))^x
Applying the chain rule I got -x(sinx)(cosx)^(x-1)

But when I go to WolframAlpha, they show
d/dx(cos^x(x)) = cos^x(x) (log(cos(x))-x tan(x))

Why the extra term? Why doesn't the simple chain rule apply?

I have got strange results from WolframAlpha before
eg try typing (-1)^(1/3)
You don't get -1 as a root.

2. Jul 12, 2010

losiu99

As for the derivative: power rule $$(x^n)'=nx^{n-1}$$ applies for constant exponents only.
As for the root: there are 3 different complex numbers satisfying $$x^3=-1$$:
$$-1$$, $$(1/2)(1\pm i\sqrt{3})$$.

Last edited: Jul 12, 2010
3. Jul 12, 2010

arildno

Because you have differentiated wrongly.

Rewrite as follows:
$$\cos(x)^{x}=e^{x\ln(\cos(x))}$$
and differentiate properly.

4. Jul 12, 2010

PeterPumpkin

Thanks.

a) So, the chain rule eg putting u=cosx and y=u^x doesn't work in this case? Is that because the power is not a constant? Or is there some other reason?

b) Yes, appreciate the cube root of -1 has complex roots. What puzzled me is that -1 didn't show as a valid root. I wondered why it didn't show. www.wolframalpha.com/input/?i=cube+root+of+-1

5. Jul 12, 2010

Hurkyl

Staff Emeritus
You didn't ask "what are all of the cube roots of -1". You asked "what is the value of applying the cube root function to the number -1".

It's essentially the same idea as $\sqrt{4} = 2$.

Try "solve x^3 = -1" or "roots of x^3 + 1" or things like that.

6. Jul 15, 2010

Anonymous217

That faces the same problem as differentiating x^x without modifying the expression.

7. Jul 15, 2010

hunt_mat

Here is a simple method for dealing with such things.
$$y=\cos^{x}x$$
Take logs to get:
$$\log y=x\log\cos x$$
Now differentiate to arrive at:
$$\frac{1}{y}\frac{dy}{dx}=\log\cos x-\frac{x\sin x}{\cos x}$$
Multiple and re-arrange to get the solution, that I will leave to you.

Mat

8. Jul 17, 2010

HallsofIvy

It is not that the "chain rule doesn't work", it is that you have differentiated $u^x$ in correctly. If $y= u^x$ then $ln(y)= x ln(u)$ and then $(1/y) dy/dx= ln(u)+ (x/u) du/dx$ so that $du^x/dx= u^xln(u)+ u^{x-1}xdu/dx$.

9. Jul 18, 2010

HallsofIvy

What Wolframalpha is showing is the "principal root".