Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

You set the following exercise to your calculus class:

Q1. Differentiate $y(x) = x^x$.

A student submits the following solution:

Let $g(a)=a^x$ and $f(x)=x$. Then $y(x) = g(f(x))$, so by the chain rule, $y'(x) = f'(x) g'(f(x)) = 1 \cdot x \cdot (x^{x-1}) = x^x$.

How would you explain to the student why their solution is incorrect?

To be clear, I know why this is wrong but am interested in good ways to explain it to undergraduate or high school students.

In this question someone has problems differentiating $x^x$, but they didn't take the approach of my hypothetical student.

share|cite|improve this question
You might try convincing them of the difference between free and bound variables in general, and show how this is a specific example of confusing the free and bound variables of the chain rule. – Loki Clock Jun 24 '13 at 19:58

10 Answers 10

Try going through the incorrect argument with $g(a) = \dfrac ax$.

Then we have $g(f(x)) = 1$ but $f'(x)\cdot g'(f(x)) = \dfrac 1x$.

At this point most students will try to explain why your argument is different from theirs, and why their argument works but yours doesn't. If not you can give them a little encouragement to find the hole in your version of the argument.

That way the student will do all the work for you, which is a good way of learning.

share|cite|improve this answer
(+1) I really like this answer, because it allows the insight to come from the student themselves, instead of being forced top-down by the teacher. As such it increases the chance that the student will really learn from their mistake. – Lord_Farin May 24 '13 at 11:58
@Lord_Farin: Thanks for the edit. Teaching is just like research, it's best if you can persuade students to do your job for you. – Tim May 24 '13 at 12:18
This is a really good example, thanks Tim. – m_t_ May 25 '13 at 13:11

My attempt would proceed along the following lines.

You defined $g(a) = a^x$; since the $x$ does not occur as an argument to the function, it is taken to be constant. This is not consistent with differentiating our expression with respect to $x$.

Therefore, the function $g$ should actually admit $x$ as a parameter as well: $g(a,x) = a^x$.

At which point we run into the difficulty of the chain rule for partial differentiation being unavailable (despite this approach giving a very clean, universal solution to differentiating expressions with multiple occurrences of the relevant variable).

I can imagine two reasonable courses of action from here:

  • Indicate the "standard" high school solution via $x^x = \exp(x\log x)$;
  • Introduce the more complicated chain rule, illustrating it e.g. by deriving the product rule.
share|cite|improve this answer
I'm a calculus student that was actually more confused after reading the OP's question - this is the solution that clarified things for me best. – XenElement May 24 '13 at 19:05

First of all, the student introduces the function $g$ that is dependent on $a$ and $x$. But he overlooks the $x$ dependence in his solution. But if he had done it correctly it could have worked:

$$g:\mathbb{R}^2 \to \mathbb{R}:(a,x)\to a^x$$

Then $h(x)=g(f(x),x)$ and

$$h'(x)=\frac{\partial g}{\partial a}\!\! \left(f(x),x\right)\frac{df}{dx}+\frac{\partial g}{\partial x}\!\! \left(f(x),x\right)\frac{dx}{dx}\\ = x x^{x-1}+x^x \ln x = x^x(1+\ln x) \; .$$

Of course, this is an explanation he might only get completely if he is familiar with partial derivatives.

share|cite|improve this answer
I highly doubt a high school calculus student would use half of those symbols. – John May 24 '13 at 15:14
As a high school calculus student, I can confirm that I do not. – XenElement May 24 '13 at 19:05
@John: What makes you think so? Do you mean that high school students don't know how functions can be defined? Or what the natural logarithm is? – Matěj G. May 24 '13 at 19:08
Of course they know the natural logarithm. High school calculus does not introduce the g:\mathbb{R}^2 \to \mathbb{R}:(a,x)\to a^x notation. And probably also won't see partial derivatives. – John May 24 '13 at 20:14
I did see those things in high school. But I was in a very strong mathematical programm. I understand that it's very different from country to country and as you'll note, I added a comment at the end of my explanation to reflect the fact the student might not know the notations. But, I do not think it is beyond the capabilities of a high school student to understand this explanation. Some tweaking has to be done, but partial derivatives for instance are just ordinary derivatives where the irrelevant variables have been fixed. – Raskolnikov May 25 '13 at 6:44

I would try to explain that the notation $h'$ doesn't just mean the derivative of $h$ but the derivative of $h$ with respect to some particular variable, the variable being determined by the context. In the student's answer, $y'$ is $dy/dx$, but $g'$ is $dg/da$, when what's needed is $dg/dx$.

share|cite|improve this answer

Well, an important first step is to convince them that their argument is, in fact, wrong. A simple appeal to the geometric meaning of the derivative can be very useful in this regard. Not only does this provide a very clear and easy to understand demonstration of the incorrectness of their result but it also encourages them to think about the derivative in more than one way. All too often students at this level think purely algebraically, without serious geometric consideration.

So start with a simple plot of the graph of $x^x$, which any reasonable mathematical software should be able to provide:

enter image description here

Now, the graph lies completely above the $x$-axis, so the function value is always positive. The slope of the graph is clearly negative, however, just to the right of the $y$-axis. Thus, there is no way that this function can be its own derivative.

share|cite|improve this answer
I like graphical explanations, but this doesn't explain why the calculation they did was wrong, it explains how they could know that there was some reason why it was. The calculation is more important than the answer. – Sharkos May 24 '13 at 16:27
@Sharkos You are simply wrong. I've gone through this exact type of scenario many times and I've seen the look of understanding germinate as a student realizes that there is definitively an error in their argument. If you find yourself teaching mathematics some day, I promise you will need to encourage your students to think about things from multiple angles. The connection between geometry and symbols is mathematics. – Mark McClure May 24 '13 at 16:36
I think your edit clarified the matter somewhat. I agree that being able to see the error is important, but I stand by my two observations that (i) your answer doesn't achieve the goal of seeing what it was that they did wrong (ii) in mathematical contexts it's more important to get the methods correct than the symbolic answer, more so in pedagogical contexts. I'm not sure which of these two observations is "simply wrong", but I didn't dispute any of the other things you say in your comment (indeed I agree with them all). – Sharkos May 24 '13 at 17:43
@Sharkos Thank you for your response. By "wrong" I was referring to "the calculation is more important than the answer." First, there is no "answer"; explanation is the whole point. Second, "calculation" seems to trivialize the geometric viewpoint. My entire point is that the interface between geometry and calculation is probably the most important thing that should be emphasized at this level. – Mark McClure May 24 '13 at 18:01
@Sharkos One other thing - I apologize if I seemed irritated, but that is, in part, because I can't imagine that your objections, while relevant, are worth a downvote. The main point to the question is, how do we respond to such a student? As I've been teaching such students since 1989, I know for a fact that this answer is a solid response. – Mark McClure May 24 '13 at 18:09

The $g(a) = a^x$ is invalid, because the argument is $a$ and $x$ appears as a free variable. If a function's body has a free variable, that has to be defined somewhere as a constant or a globally understood parameter.

A function cannot have a free variable that refers to the argument of another function.

The correct version of $g$ is $g(a) = a^a$.

The function $g$ raises the argument to itself; it does not raise its argument to $x$. $x$ is a dummy variable in the definition of $f(x)$, which is another function. And what if the dummy variable in $f(x)$ is some thing else, like $f(b) = b$?

Think about how this would work in some functional programming language in computing:

function f(x)
   return x

function g(a)
   return pow(a, x)

Look, g is referring to x, but the only x that we see is local in another function's scope! There is no visible binding for x in the scope of g's body, so it is a free variable. Moreover, we can edit f into:

function f(b)
   return b

without changing the meaning of the program. So now there isn't an x anywhere.

In mathematics, functions can often be regarded as macros! But they are not blind, textual macros; they are hygienic macros. Substitution in math formulas is on structure not text, and it obeys scoping rules by maintaining lexical transparency.

For instance consider this following student reasoning error. Let $f(x) = x\times x$ and let $g(y) = y + y$. Therefore, since manipulation of mathematic formulas is just dumb textual substitution like preprocessor macros in the C language, $f(g(3)) = 3 + 3 * 3 + 3$, and so the value is $f(g(3)) = 3 + 9 + 3 = 15$. And in general $f(g(z)) = z^2 + 2z$. What is wrong?

Since substitution in math formulas follows structure, $f(g(z))$ cannot be $z^2 + 2z$. $f$ multiplies whatever object comes out of $g$ without breaking apart its syntax, and so the necessary parentheses have to be shown when it is all put together: $f(g(z)) = (z + z)(z + z) = 4z^2$.

The rule of lexical transparency is this: that when we substitute a formula $\alpha$ as a replacement for some symbol in another formula $\beta$, all of the symbols in $\beta$, all of the symbols in $\alpha$ continue to have exactly the same meaning. Even if $\beta$ has symbols which have the same names, those symbols do not capture any of the references in $\alpha$.

To prevent confusion, if such a situation arises where there is a confusion between symbols in an inserted formula and in the target of insertion, we should perform a variable renaming.

share|cite|improve this answer
Thanks! I would definitely try this on a student who knew some programming. – m_t_ May 25 '13 at 13:10

I think the easiest way is to show why $g'(a) = x * a^{x-1}$ is incorrect

Its common for students to think that this can be done because of the similar differentiation rule.


$y = x^n$

$y' = n * x^{n-1}$

The key is to understand that the function g in NOT in the form of $y = x^n$

See here for the neatest three line proof of the power rule I've ever seen

share|cite|improve this answer
+1 for the link to the neatest three line proof... – Gottfried Helms Jun 11 '13 at 8:42

You already have several good answers to your question, but here's a related incorrect solution.

We know these derivatives:

  1. $(x^n)' = n\cdot x^{n-1}$
  2. $(a^x)' = a^x \ln a$

Misunderstanding the problem then leads to two incorrect answers:

  1. $(x^x)' = x\cdot x^{x-1} = x^x$
  2. $(x^x)' = x^x\ln x$

The correct answer, of course, is $(x^x)'= x^x(1 + \ln x)$. Whaddya know? Two wrongs don't make a right, but in this case the sum of two wrongs does make a right.

share|cite|improve this answer
This proof is not wrong, just incomplete. to complete the proof, you need the multivariable chain rule which would imply that $\frac{df(x,x)}{dx}=\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y}_{x=y}$. One can also prove the product rule from this (assuming that such a proof would not be circular). – Baby Dragon Jun 27 '13 at 3:57
@BabyDragon. I know, but would it be reasonable to assume that a high school student would know what the multivariable chain rule is? When I use this example in intro calc, I usually mention that later on my students will realize that this is a correct way to get the answer, but that it takes machinery that we haven't developed yet. – Rick Decker Jun 27 '13 at 20:07
That's fair enough. – Baby Dragon Jun 27 '13 at 20:10

whenever there is a function in which the variable is in the power of the function then we use the transformation to the exponential basis i.e : a^x = e^(x*lna) here a is also a F(x) =x;


x^x= e^(x*lnx) now take the derivative of RHS it is:


so, d(e^(xlnx))/dx=e^(xlnx).d(xlnx)/dx; eq -------(A)

since, d(xlnx)/dx = x.(1/x)+lnx.(1); by parts eq----------(B) and x^x= e^(x*lnx)

so eq(A) becomes, d(x^x)/dx= x^x* (1+lnx); from eqA and eqB ..... answer

share|cite|improve this answer

First, ask them whether $a^x \circ y^2$ is $y^{2x}$ or $a^{y^2}$. Now, ask them to find $(\frac{d}{dx} a^x) \circ y$. Is this $ln(y)y^x$ or $ln(a)a^x$? In contrast, take $\frac{d}{da} a^x$. In each of these derivatives, one of $\{a, x\}$ is treated as a constant.

Take a right triangle, and extrude it to a triangular prism. The change in the hypotenuse with respect to a base is a constant. The change along the core of the prism is 0 for any point along the hypotenuse. Let $f(a,x)=x.$ What's the change along the a-axis? The x-axis? These are not equivalent to the change in height as one moves from one corner to the other of the extruded hypotenuse - compare $f(a,x)=a^2x$ and its derivatives in $a$ and $x$ to $f(x,x)=x^3$, and its derivative with respect to $x$.

When the chain rule says $(f\circ g(x))'=f'(g(x))g'(x),$ what is the variable of differentiation and what are the variables of composition? Recalling the derivatives of $a^x$, how does one infer the variables of composition from the variable of differentiation?

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.