Yesterday a student in my calculus class attempted something like this:

Problem statement: Find the derivative of $3^{(5x+1)}$ with respect to $x$.

Proposed solution:

  • Let the inner function be given by $g(x)=3,$ and the outer by $f(z)=z^{(5x+1)}$, so that $$f(g(x))=3^{(5x+1)}.$$
  • $f'(z)=(5x+1)\cdot z^{(5x)}$ and $g'(x)=0$, so by the chain rule, $$\frac{d\left(3^{(5x+1)}\right)}{dx} = f'(g(x))g'(x)=0.$$

I had difficulties explaining what's wrong with this, and basically just told the student "the" right way to do it. Although I now have a rough idea of what's wrong, I'd like to hear from others:

  1. Have you seen similar attempts?
  2. How would you explain to a beginning calculus student what's wrong with this specific solution?
  • 6
    $\begingroup$ Nitpick: You mean differentiate, not derive (derive means deduce, or to to reach a conclusion using logical reasoning). $\endgroup$ – Andreas Rejbrand Mar 21 '19 at 22:24
  • 4
    $\begingroup$ @MichaelBächtold While this would be true to the etymology of the words, I would caution than (at least) in British mathematical English derive from $f(x)$ wrt $x$ would be ungrammatical and not generally even understood. I would always write differentiate or find the derivative of. $\endgroup$ – dbmag9 Mar 22 '19 at 9:33
  • 1
    $\begingroup$ @dbmag9 I was sort of kidding. I'm not a native english speaker, but I'm aware that no mathematician would say "derive from". On the other hand: mathematicians seem to forget the etymology of words and write a lot of stuff which is ungrammatical in every language. Like calling $f$ a function of $x$ (when it's not) or saying stuff like "Consider the function $f(x)=x^2$" when they're actually considering an equation. $\endgroup$ – Michael Bächtold Mar 22 '19 at 12:30
  • 3
    $\begingroup$ @MichaelBächtold: Indeed, I agree about that. I am known to be a bit pedantic, but I actually always write "consider the function $f$ defined by $f(x) = x^2$". Sometimes I even write "consider the function $f: \mathbb{R} \to \mathbb{R}$ defined by $f(x) = x^2$ for every $x \in \mathbb{R}$". Since my main area of interest in mathematics is university-level mathematical education, I care a lot about language. $\endgroup$ – Andreas Rejbrand Mar 22 '19 at 12:42
  • 2
    $\begingroup$ see math.stackexchange.com/questions/401122/… and the answers there for a similar issue $\endgroup$ – Matthew Towers Mar 22 '19 at 12:48

$$ \frac{d (3^{5x+1})}{dx} = f'(g(x))g'(x)= \frac{d \left(3^{5x+1}\right)}{d(3)} \times \frac{d (3)}{dx}. $$

However $\dfrac{d (3^{5x+1})}{d(3)}$ is undefined.

  • 2
    $\begingroup$ Hence by definition, any substitution 𝑔(𝑥)=constant will blow up and fail for the same reason. (and that's before we get to the other issue with the substitution which the other answers point out: namely that we didn't really do a substitution, because there are still dangling references to x, as well as z) $\endgroup$ – smci Mar 23 '19 at 15:05
  • 5
    $\begingroup$ This is not a valid explanation. Surely, the the chain rule notation works when $u=g(x)$ is a constant! $\endgroup$ – user52817 Mar 23 '19 at 16:01
  • 2
    $\begingroup$ @MichaelBächtold: It's ironic that you picked the totally wrong explanation on Math Educators SE. If you read a proper rigorous statement of the chain rule, it can be applied only under certain conditions, one of which is that the 'component' derivatives exist... $\endgroup$ – user21820 Mar 24 '19 at 7:50
  • 2
    $\begingroup$ @user21820 You just wrote 1/0 in a mathematical argument and the world didn't implode. But more seriously: Taemyr wrote $d(3^{5x+1})/d3$ in order to point out to the student that it was undefined. I don't understand all the fuzz you are trying to make. $\endgroup$ – Michael Bächtold Mar 26 '19 at 8:29
  • 2
    $\begingroup$ @Michael. User21820 is completely correct. This answer is wrong. I'm sorry to inform you that I'm worried that you are teaching students maths. $\endgroup$ – user7171 Mar 31 '19 at 7:35

The root of the difficulty is that $x$ appears free in $f(z)$, but we are trying to "capture" it with $g(x)$, which is illegal. When we substitute $g(x)$ into $f(g(x))$, we have a variable clash: $$ f(g(\color{red} x)) = 3^{5\color{blue}x + 1} $$

The red (first) $x$ is a different variable from the blue (second) $x$. This is clearer if we rename the bound variable: $$ f(g(\color{red} y)) = 3^{5\color{blue}x + 1} $$

The original expression had $x$ bound to the $\mathrm d x$, so by unbinding it, we have changed the meaning of the expression: $$ \frac{\mathrm d}{\mathrm d \color{blue} x} f(g(\color{red}y)) \ne \frac{\mathrm d}{\mathrm d \color{red}y} f(g(\color{red}y)) $$

(Incidentally, this is one reason I dislike the notation $f'(x)$, because it hides the variable of differentiation. Students must still be taught it, unfortunately, because Leibniz's notation is verbose in some contexts, but it should only be used as shorthand. Students should understand that it is a shorthand, and that there is still a variable of differentiation, even if it is not shown.)

  • 2
    $\begingroup$ I like this answer, and agree with it in essence. But to make it precise one needs to be a bit more careful. For instance: the variabel $x$ is not really bound in the equation $h(x)=3^{5x+1}$. It would be bound if we wrote $\forall x\in \mathbb{R}\colon h(x)=3^{5x+1}$, and then one might argue that variable capture happens in the composition. Alternatively we use mathematicians lambda calculus notation $h=(x\mapsto 3^{5x+1})$ and declare that $x$ is bound therein. Also: the matter of whether $dx$ binds $x$ is not so simple as you might think and (cont.) $\endgroup$ – Michael Bächtold Mar 22 '19 at 8:36
  • 2
    $\begingroup$ (cont.) I don't quite understand what you don't like about $f'$, since in fact it needs to hide the name of the variable, since it is bound in $f$. $\endgroup$ – Michael Bächtold Mar 22 '19 at 8:38
  • 1
    $\begingroup$ @Michael In common usage, $h(x) = 3^{5x+1}$ really does mean $h = (x\mapsto 3^{5x+1})$ most of the time, doesn’t it? It’s just the same widespread abuse of notation as writing “the function $h(x)$” when you really mean “the function $h$”, only milder. (Alternatively, you could say that it’s a different widespread abuse of notation, omitting universal quantification over apparently-unbound variables.) $\endgroup$ – Alex Shpilkin Mar 22 '19 at 13:42
  • $\begingroup$ @AlexShpilkin I guess you are right. Still, I wouldn't explicitly encourage people to think that $\exp(x)=e^x$ literally means the same as $\exp=(x\mapsto e^x)$, unless we also want them to conclude that $\exp(0)=1$ means the same as $\exp=(0\mapsto 1)$. $\endgroup$ – Michael Bächtold Mar 22 '19 at 16:34
  • $\begingroup$ @MichaelBächtold: I have no objection to $f'$, and in principle it ought to be OK to write $f'(x)$ if you can write $f'$. But $f'(x)$ is prone to the kind of error that your student made, unless you are also proposing to spend the extra class time to explain the difference between $f$ and $f(x)$ (because by default, your students will have no idea there is a difference). I would not recommend that at the introductory calculus level, however. It will likely shed more heat than light, and possibly leave your students more confused than they were to begin with. $\endgroup$ – Kevin Mar 22 '19 at 16:43

f is not a function of (only) z - f here is a function of x as well as z. I think this explanation is intelligible to a calc 1 student, and gets at the heart of the matter.

  • 2
    $\begingroup$ Hmm, so the student should reply: as soon as $f(x)$ contains parameters other than $x$ I am not allowed to apply the chain rule? $\endgroup$ – Michael Bächtold Mar 21 '19 at 16:37
  • 2
    $\begingroup$ @MichaelBächtold: The student should know that if f(x) contains variables other than x then the chain rule doesn't apply. (This might be an opportunity to mention that there is a variant of the chain rule to be learned later for covering such situations.) I decline to get into a pedantic discussion of the distinction between f and f(z). $\endgroup$ – Henry Towsner Mar 21 '19 at 18:14
  • 1
    $\begingroup$ I'm quite sure you use the chain rule to derive things that contain more than just $x$ in your calculus class, like $\sqrt{x^2+k}$. You might say: that's ok if we treat $k$ as a constant and not as a variable. But then student might then ask: why am I not allowed to treat $x$ as a constant in the definition of $f$? (And a mathematician might add: what's the difference between a variable and a constant?). Apologies if my pedantry offends you. $\endgroup$ – Michael Bächtold Mar 21 '19 at 18:49
  • 5
    $\begingroup$ @MichaelBächtold: In general, the difference between a variable and a constant is contextual and tricky to make precise, but for purposes of the chain rule in this case, x is a variable because we're taking the derivative with respect to it. I find that students don't usually have difficulty with this point (for instance, one could imagine students getting confused about the difference between the derivative of f(x)=c and f(x)=x, but that's not a particularly common issue), because it's a clean syntactic rule and it's backed up by the notion (x and z are conventionally variables, k isn't). $\endgroup$ – Henry Towsner Mar 21 '19 at 19:28
  • 1
    $\begingroup$ @MichaelBächtold: Another way to think of it: In the student's proposed solution, $x$ is a free variable within $f$, but the expression was originally $h(x) = 3^{5x+1}$, i.e. $x$ was originally a bound variable. You can't transform a bound variable into a free variable. $\endgroup$ – Kevin Mar 21 '19 at 20:59

This is a VERY VERY typical problem. In fact, it's a problem even for $\frac{d}{dx}3^x$, much less your example.

The way I try to deal with this is one of two ways.

  1. What has to happen first? To evaluate $3^{5x+1}$, you have to evaluate $5x+1$ first. So that is the inside function in the chain rule, just like in $\sin(x^2)$ you have $x^2$ to evaluate first, so it is the inside function.

  2. You could rethink how we notate or talk about exponential functions. In particular, Excel has $e^x$ written as exp(x) (I think as an option). So one can ask what the "input" is here.

However, on the plus side the student does seem to have the chain rule down; it's just the exponential notation that is causing trouble. So there is definitely hope here. And again, you should not be surprised at encountering this, so it is worth your time to come up with several possible responses for it in the long run. Good luck!


This idea is fine, and you can use the multivariable chain rule to do it this way.

Say we want to differentiate $h(x) = f(x)^{g(x)}$ with respect to $x$. Notice that we can write $h$ as the composite of $p: \mathbb{R} \to \mathbb{R}^2$ defined by $p(t) = (f(t),g(t))$ with the function $E: \mathbb{R}^2 \to \mathbb{R}$ defined by $E(u,v) = u^v$.

By the multivariable chain rule,

$$ \begin{align} Dh\big|_{x} &= DE\big|_{p(x)} \circ Dp\big|_{x}\\ &= \left.\begin{bmatrix} \frac{\partial E}{\partial u} & \frac{\partial E}{\partial v} \end{bmatrix} \right|_{(u,v) = (f(x),g(x))} \circ \left.\begin{bmatrix} \frac{\partial f}{\partial t} \\ \frac{\partial g}{\partial t}\end{bmatrix}\right|_{t = x}\\ &= \left.\begin{bmatrix} vu^{v-1} & \ln(u) u^v \end{bmatrix} \right|_{(u,v) = (f(x),g(x))} \circ \left.\begin{bmatrix} f'(t) \\ g'(t)\end{bmatrix}\right|_{t = x}\\ &= \begin{bmatrix} g(x)(f(x))^{g(x)-1} & \ln(f(x)) (f(x))^{g(x)} \end{bmatrix} \circ \begin{bmatrix} f'(x) \\ g'(x)\end{bmatrix}\\ &=f'(x)g(x)(f(x))^{g(x)-1}+g'(x)\ln(x)f(x)^{g(x)} \end{align} $$

Applying this to the problem in question, we see that $f'(x) =0$, so the first term disappears.

So, in a sense, the student was trying to apply the multivariable chain rule (using the two variables $z$ and $x$), but didn't know how to do that yet. So you could tell them it is a good approach, but they will learn how to properly execute that approach in calc 3.


The other answers have completely missed the mistake. $ \def\rr{\mathbb{R}} $

Your student's error has nothing to do with exponentiatiation. Consider the following based on exactly the same error:

$\color{red}{\text{Let (???)}}$ $f(y) = x$ and $g(x) = 1$.

Then $1 = \frac{dx}{dx} = (f∘g)'(x) = f'(g(x))·g'(x) = f'(1)·0 = 0$.

The error lies in the very first line! It is extremely obvious once you actually attempt to make it rigorous. Recall that to define a function you must provide a domain as well as a rule that specifies the output for each input in the domain. And of course the rule has to be meaningful in the context where you want to define the function. So see what you get:

$\color{red}{\text{Let (???)}}$ $f : \rr→\rr$ such that $f(y) = x$ for each $y∈\rr$.

Let $g : \rr→\rr$ such that $g(x) = 1$ for every $x∈\rr$.

The definition of $g$ is fine. The definition of $f$ is not fine! What on earth is $x$? The rule has to specify the output for each input $y∈\rr$, so where did $x$ pop up from?

As explained above, the error has nothing to do with differentiation. Rather, it is in the illegal definition of the function!

  • 1
    $\begingroup$ Congratulations on being a logician! $\endgroup$ – Michael Bächtold Mar 24 '19 at 10:14
  • 1
    $\begingroup$ If it makes you feel better: I admit to my mistakes. (Even if I don't know which ones you mean.) And what I wrote was true sarcasm. $\endgroup$ – Michael Bächtold Mar 24 '19 at 10:42
  • 1
    $\begingroup$ I upvoted your answer, because it contributes something mathematically to the discussion, even if it completely lacks any tact. I would be curious to know in what sense you think my answer "completely misses the mark": it points out the same error as yours while being slightly more generous to the student (assuming that they were actually defining a function of two variables, rather than just writing something completely meaningless as you suppose). It then shows how the mistake (under this assumption) can be corrected through correct use of the multivariable chain rule. $\endgroup$ – Steven Gubkin Mar 24 '19 at 14:24
  • 2
    $\begingroup$ (cont.) without going into free/bound variables, $\alpha$-conversion and variable capture. That's what Kevin did. Not that I find it wrong to go into this stuff, but I don't think it's so useful for calculus students coming from engineering. Instead, telling them that $3^{5x+1}$ is not a function of $3$ and hence I cannot write $d3^{5x+1}/d3$ seems closer to what they'll need. It's a pity that a hundred years since Frege, logicians have not been able to properly formalise the surrounding notions of variables, constants, and functions of things. $\endgroup$ – Michael Bächtold Mar 24 '19 at 20:45
  • 2
    $\begingroup$ @MichaelBächtold: I'll respond in chat. This is getting way too long for a comment thread. $\endgroup$ – user21820 Mar 25 '19 at 8:13

I had a similar problem with a student last week and could not succinctly explain why she could not select $e$ as the 'inner' function here: $$f(x) = e^{8x +4}$$

The best explanation I have seen thus far, Paul's Notes, explains it in this way:

Recall that the 'outside' function is the last operation that we would perform in an evaluation. In this case if we were to evaluate this function the last operation would be the exponential. Therefore, the outside function is the exponential function and the inside function is its exponent.

  • $\begingroup$ Because 'e' is a constant? How would you explain it if instead of e, the base were '2'? $\endgroup$ – JTP - Apologise to Monica Mar 22 '19 at 15:27
  • $\begingroup$ Yes this is because 'e' is a constant. Therefore, the explanation would also work when the base is '2'. $\endgroup$ – Bionic Buffulo Mar 25 '19 at 12:09
  • $\begingroup$ Agreed, that was what I was trying to suggest. The f(x) you shared has no ‘inner function’ . $\endgroup$ – JTP - Apologise to Monica Mar 25 '19 at 12:21

Applying the naive approach of a non-mathematician, to me the expression $z^{(5x+1)}$ points to a bivariate function,

$$f(z,x) = z^{(5x+1)}$$

(because "I see two variables in here"), and with $g(x) = 3$ we have defined

$$f(g(x), x) = 3^{(5x+1)}$$


$$\frac {df(g(x),x)}{dx} = \frac {\partial f(g(x),x)}{\partial g(x)}\cdot \frac {dg(x)}{dx} + \frac {\partial f(g(x),x)}{\partial x}\cdot \frac {dx}{dx}$$

$$=\frac {\partial f(g(x),x)}{\partial g(x)}\cdot 0 + \frac {\partial f(g(x),x)}{\partial x}\cdot 1 = \frac {\partial f(g(x),x)}{\partial x} $$

$$=\frac {\partial}{\partial x} \left(3^{(5x+1)}\right) $$

This appears to be correct, although not useful, since we ended up back in the beginning. Am I doing something wrong here?

  • $\begingroup$ It's unclear whether you know exactly what you're doing. You can't just say "I see two variables in here"! Given any real $x$, the function $f:\mathbb{R}→\mathbb{R}$ defined via $f(y) = x·y$ for $y∈\mathbb{R}$ is a one-input function, not a bivariate function. Yes, the expression "$z^{5x+1}$" has two variables, so it is meaningful only in a context where both $x,z$ are defined (e.g. $x,z∈\mathbb{R}$ and $z>0$), but that is precisely the true error in the asker's question (see my answer); it did not define $x$, and once you define $x$ you can't reuse it in defining $g$. $\endgroup$ – user21820 Mar 27 '19 at 7:49
  • $\begingroup$ Also, it is actually incorrect to write "$\frac{∂f(g(x),x)}{∂g(x)}$". What you want is $\left. \frac{∂f(t,x)}{∂t} \right|_{t:=g(x)}$. To prove that it is incorrect, consider that if you had wanted $\frac{d(f(g(x),g(x)))}{dx}$ instead your 'proof' would have included the term "$\frac{∂f(g(x),g(x))}{∂g(x)}$", which makes the mistake obvious. $\endgroup$ – user21820 Mar 27 '19 at 7:53
  • $\begingroup$ @user21820 On your first comment, let $x \in \mathbb{R},\; z>0$ and define the bivariate function $f(z,x) = z^{(5x+1)}$. Further, define $z\equiv g(x)$ and also define $g(x) =3$ with $x$ defined as previously. Is there any problem with these definitions? This is not what the OP's student did of course, my answer was a reflection on why $f(z) = z^{5x+1}$ is not a correct expression, and that the moment you write $z^{5x+1}$ treating $z$ as a variable, what you can have is a bivariate function since $x$ is already defined (even if implicitly) as a variable. $\endgroup$ – Alecos Papadopoulos Mar 27 '19 at 9:34
  • $\begingroup$ @user21820 Regarding your second comment, I was under the impression that in the left-hand side expression we include a variable of a function only once inside the parenthesis, since the $()$ in $f()$ just lists the variables of the function. When do we want or need to write something like $f(y,y)$, what purpose does it serve? $\endgroup$ – Alecos Papadopoulos Mar 27 '19 at 9:49
  • $\begingroup$ You didn't understand my first comment; please read the second sentence again, which is a counter-example to your "I see two variables" thinking. You also don't seem to understand rigorous notation in your last comment. You say "the () in f() just lists the variables of the function", but you didn't even do that; you wrote "$f(g(x),x)$"! Furthermore, you suggest (falsely) that there is no purpose in writing something like "$f(y,y)$". No, it is not only legitimate but also very useful to be able to evaluate a two-input function along its 'diagonal'. $\endgroup$ – user21820 Mar 27 '19 at 11:25

Some users have expressed doubt at the validity of the accepted answer, so let me make it rigorous. To do that, we first need to make sense of the notation $\frac{dy}{dx}$. (Which is not a trivial task.)

We start by changing perspective: instead of thinking of variables $x$ and $y$ as numbers, we think of them as smooth real valued functions on some manifold $M$. So $x\colon M\to \mathbb{R}$ and $y\colon M\to \mathbb{R}$. You might rightly ask: why would we do that and which manifold $M$ are you talking about? The answer to the first question is: because I'd like to talk about the differentials $dy$, $dx$ and say everyday stuff like "$y$ is a constant" or "$y$ is a function of $x$". All of that is impossible inside first order logic + ZFC if we simply interpret $x$ and $y$ as elements of $\mathbb{R}$. Concerning the second question: think of $M$ as the physical state space underlying the problem we are trying to model and $x$ and $y$ as observables. If that sounds too unfamiliar: it's similar to how people in probability theory assume an underlying space of outcomes $\Omega$, in order to talk about random variables. (Which are the things we really care about and historically came before $\Omega$, just like $dx,dy$ historically came before manifolds, but I'm drifting of.)

So, having fixed the background manifold $M$, whenever you hear me say variable, what I mean is a thing of type $M\to \mathbb{R}$.

Definition. Given two variables $x$ and $y$, call $y$ a function of $x$ if $dx$ is not zero almost everywhere and there exists a variable $q\colon M \to \mathbb{R}$ such that $$ dy = q \cdot dx. $$

Intuitively, the equation $ dy = q \cdot dx $ says that the change of $y$ is determined by the change of $x$, i.e. that $y$ depends on $x$.

It's not hard to show that $q$ is uniquely determined by $x$ and $y$, hence we decide to denote it with $\frac{dy}{dx}$ and call it the derivative of $y$ wrt. $x$. It was originally called the differential coefficient, cause that's what it is.

According to this definition, $3^{5x+1}$ is a function of $x$ (assuming $x$ is a true variabel, i.e. $dx\neq 0$), but it's also a function of $5x+1$. On the other hand, $3^{5x+1}$ is not a function of $3$ since $d3=0$ (what we call a constant). In particular $\frac{d3^{5x+1}}{d3}$ is undefined, as user21820 has been pointing out emphatically.

We can now state the chain rule in Leibniz form

Theorem. If $z$ is a function of $y$ and $y$ is a function of $x$, then $z$ is also a function $x$ and their differential coefficients satisfy $$ \frac{dz}{dx}=\frac{dz}{dy}\cdot \frac{dy}{dx} $$

The proof of this is trivial.

From this perspective, what the student in my question was trying to do, was to let $z=3^{5x+1}$ and $y=3$. But the theorem does not apply, since $3^{5x+1}$ is not a function $3$. The same point of view can be used in the example discussed here, where a student attempted to differentiate $x^x$ by taking $x$ as inner function. Although that's allowed it just leads to $$ \frac{dx^x}{dx}=\frac{dx^x}{dx}\cdot \frac{dx}{dx} $$ which is of not much use.

This is not to say that I don't appreciate the other answers (also users 21820). Taemyr's is just one of the three perspectives that haven been proposed. It might seem like it needs a lot of background to make it rigorous. But consider that mathematicians understood this stuff for at least 200 years without requiring manifolds to formalize it. And consider that the other approaches also require quite some background to make them rigorous (like quantifiers, variable bindings, the idea of dummy/bound variables etc. or derivatives of functions of multiple variables). Each has it advantages and disadvantages and none seems more right than the others, methinks.

  • 1
    $\begingroup$ It seems you are finally agreeing with me that the accepted answer is not completely correct, because it literally wrote an equation involving what your answer states to be ill-defined. That from the beginning was my objection to it (see my first comment). I did not say that anything else was amiss with that answer, except that it fails to pinpoint the original student's error (regarding functions, not differentials). $\endgroup$ – user21820 Mar 25 '19 at 18:34
  • $\begingroup$ @user21820 You have a strange sense of humor. But thanks for making me laugh. Unfortunately you also made me give up my last hope of leading an honest conversation with you. $\endgroup$ – Michael Bächtold Mar 26 '19 at 8:33
  • 1
    $\begingroup$ It's your choice, but you've been repeatedly misinterpreting whatever I say, and then blame me for it instead of considering that perhaps you are the one who is wrong. Your last comment insinuates that I am dishonest. That's false. $\endgroup$ – user21820 Mar 26 '19 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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