Practice / Calculus

Differentiation rules: chain, product, quotient

Ten single-variable derivatives that exercise the product, quotient and chain rules on the functions machine learning uses — exponentials, logs, sigmoid, tanh, softplus, nested trig, xˣ and an implicit curve — with worked solutions and the mistakes that drop the inner derivative or flip the quotient rule.

Before you start

Three rules and a short table of basic derivatives are enough to differentiate every function on this page. The work goes wrong in a few places that recur: an inner derivative left off, a quotient rule with its numerator reversed, a product rule that multiplies the two derivatives, a power rule used on a variable exponent. These ten problems run from single rules to nested ones, then to xxx^x and a curve given by an equation.

  • f′(x)f'(x) and ddx\tfrac{d}{dx} both mean the derivative with respect to xx. uu and vv stand for any differentiable functions of xx.
  • Product rule: (uv)′=u′v+uv′(uv)' = u'v + uv'.
  • Quotient rule: (u/v)′=(u′v−uv′)/v2(u/v)' = (u'v - uv')/v^2, where v≠0v \neq 0.
  • Chain rule: (f∘g)′=f′(g) g′(f\circ g)' = f'(g)\,g'.
  • Basic derivatives: (xn)′=nxn−1(x^n)' = nx^{n-1} for a constant nn; (ex)′=ex(e^x)' = e^x; (ln⁡x)′=1/x(\ln x)' = 1/x for x>0x > 0; (sin⁡x)′=cos⁡x(\sin x)' = \cos x; (cos⁡x)′=−sin⁡x(\cos x)' = -\sin x.
  • ln⁡\ln is the natural log; σ\sigma is the logistic sigmoid, σ(x)=1/(1+e−x)\sigma(x) = 1/(1+e^{-x}); tanh⁡x=(ex−e−x)/(ex+e−x)\tanh x = (e^x - e^{-x})/(e^x + e^{-x}). yy names the function of xx being differentiated when it is not given by an explicit formula (Problems 7 and 10).
  • Write the derivative of the outer function evaluated at the inner one, then multiply by the inner derivative — the factor the mistakes below drop.

Problems

  1. ·

    Differentiate x3exx^3e^x.

  2. ·

    Differentiate x1+x2\dfrac{x}{1+x^2}.

  3. ·

    Differentiate sin⁡(3x2)\sin(3x^2).

  4. ··

    Differentiate ln⁡(1+ex)\ln(1+e^x) (softplus) and simplify.

  5. ··

    Differentiate σ(x)=11+e−x\sigma(x) = \dfrac{1}{1+e^{-x}} and write the result in terms of σ(x)\sigma(x) alone.

  6. ··

    Differentiate tanh⁡x=ex−e−xex+e−x\tanh x = \dfrac{e^x - e^{-x}}{e^x + e^{-x}} and write the result in terms of tanh⁡x\tanh x. Then show tanh⁡x=2σ(2x)−1\tanh x = 2\sigma(2x) - 1.

  7. ··

    Differentiate xxx^x for x>0x > 0.

  8. ···

    Differentiate ln⁡ ⁣(ex1+ex)\ln\!\Big(\dfrac{e^x}{1+e^x}\Big) and simplify to a single sigmoid.

  9. ···

    Differentiate 1+sin⁡2(2x)\sqrt{1+\sin^2(2x)} and simplify with a double-angle identity.

  10. ···

    The curve x2+xy+y2=7x^2 + xy + y^2 = 7 defines yy as a function of xx near most of its points. Find dydx\dfrac{dy}{dx}.

Worked solutions

Problem 1

Differentiate x3exx^3e^x.

  1. u=x3u = x^3, v=exv = e^x; u′=3x2u' = 3x^2, v′=exv' = e^x.The function is a product of two factors whose derivatives are in the table, so the product rule applies.
  2. (x3ex)′=3x2⋅ex+x3⋅ex(x^3e^x)' = 3x^2 \cdot e^x + x^3 \cdot e^x.Product rule, u′v+uv′u'v + uv': each term differentiates one factor and leaves the other alone.
  3. ex(x3+3x2)e^x(x^3 + 3x^2)Both terms contain exe^x, so it factors out.

Problem 2

Differentiate x1+x2\dfrac{x}{1+x^2}.

  1. u=xu = x, v=1+x2v = 1 + x^2; u′=1u' = 1, v′=2xv' = 2x.The function is a quotient, so name the numerator and the denominator and differentiate each.
  2. (x1+x2)′=1⋅(1+x2)−x⋅2x(1+x2)2\Big(\dfrac{x}{1+x^2}\Big)' = \dfrac{1\cdot(1+x^2) - x\cdot 2x}{(1+x^2)^2}.Quotient rule: u′vu'v first, uv′uv' subtracted, over v2v^2.
  3. 1⋅(1+x2)−x⋅2x=1+x2−2x2=1−x21\cdot(1+x^2) - x\cdot 2x = 1 + x^2 - 2x^2 = 1 - x^2.Expand the numerator and collect the x2x^2 terms.
  4. 1−x2(1+x2)2\dfrac{1 - x^2}{(1+x^2)^2}Sanity check: the function rises to its maximum 12\tfrac12 at x=1x = 1 and falls after it, and the derivative is 00 at x=1x = 1, positive for ∣x∣<1|x| < 1 and negative for x>1x > 1.

Problem 3

Differentiate sin⁡(3x2)\sin(3x^2).

  1. Outer function sin⁡\sin, inner function g(x)=3x2g(x) = 3x^2.sin⁡\sin is applied to 3x23x^2, not to xx, so this is a composition and needs the chain rule.
  2. The derivative of sin⁡\sin, evaluated at the inner function: cos⁡(3x2)\cos(3x^2).(sin⁡t)′=cos⁡t(\sin t)' = \cos t, and the chain rule evaluates it at t=3x2t = 3x^2.
  3. The inner derivative: g′(x)=6xg'(x) = 6x.Power rule with the constant 3 carried along.
  4. 6xcos⁡(3x2)6x\cos(3x^2)Chain rule, f′(g) g′f'(g)\,g': the product of steps 2 and 3, with the factor 6x6x written first.

Problem 4

Differentiate ln⁡(1+ex)\ln(1+e^x) (softplus) and simplify.

  1. Outer function ln⁡\ln, inner function 1+ex1 + e^x.The log is applied to 1+ex1 + e^x, not to xx, so the chain rule applies.
  2. The derivative of ln⁡\ln, evaluated at the inner function: 11+ex\dfrac{1}{1+e^x}.(ln⁡t)′=1/t(\ln t)' = 1/t at t=1+ext = 1 + e^x, which is positive for every xx.
  3. The inner derivative: (1+ex)′=ex(1 + e^x)' = e^x.The constant 1 has derivative 0.
  4. ddxln⁡(1+ex)=ex1+ex\dfrac{d}{dx}\ln(1+e^x) = \dfrac{e^x}{1+e^x}.Chain rule: step 2 times step 3.
  5. ex1+ex=1e−x+1\dfrac{e^x}{1+e^x} = \dfrac{1}{e^{-x} + 1}.Divide top and bottom by exe^x, which is never 0, so that xx appears only as e−xe^{-x}, the form in the definition of σ\sigma.
  6. σ(x)\sigma(x)1/(1+e−x)1/(1 + e^{-x}) is the definition of σ(x)\sigma(x): softplus is an antiderivative of the sigmoid.

Problem 5

Differentiate σ(x)=11+e−x\sigma(x) = \dfrac{1}{1+e^{-x}} and write the result in terms of σ(x)\sigma(x) alone.

  1. σ=(1+e−x)−1\sigma = (1+e^{-x})^{-1}.Written as a power of an inner function, σ\sigma needs only the chain rule and the power rule, not the quotient rule.
  2. The derivative of t−1t^{-1}, evaluated at the inner function: −(1+e−x)−2-(1+e^{-x})^{-2}.(t−1)′=−t−2(t^{-1})' = -t^{-2}, at t=1+e−xt = 1 + e^{-x}.
  3. The inner derivative: (1+e−x)′=e−x⋅(−1)=−e−x(1 + e^{-x})' = e^{-x}\cdot(-1) = -e^{-x}.e−xe^{-x} is itself a composition: the derivative of ete^t at t=−xt = -x is e−xe^{-x}, and (−x)′=−1(-x)' = -1.
  4. σ′(x)=−(1+e−x)−2⋅(−e−x)=e−x(1+e−x)2\sigma'(x) = -(1+e^{-x})^{-2}\cdot(-e^{-x}) = \dfrac{e^{-x}}{(1+e^{-x})^2}.Chain rule: step 2 times step 3; the two minus signs cancel.
  5. e−x(1+e−x)2=σ(x)⋅σ(x) e−x\dfrac{e^{-x}}{(1+e^{-x})^2} = \sigma(x)\cdot\sigma(x)\,e^{-x}.Each factor 1/(1+e−x)1/(1+e^{-x}) is σ(x)\sigma(x), so the square in the denominator gives σ(x)2\sigma(x)^2.
  6. e−x=1σ(x)−1e^{-x} = \dfrac{1}{\sigma(x)} - 1.1/σ(x)=1+e−x1/\sigma(x) = 1 + e^{-x} by the definition of σ\sigma; subtract 1.
  7. σ(x)2(1σ(x)−1)=σ(x)−σ(x)2\sigma(x)^2\Big(\dfrac{1}{\sigma(x)} - 1\Big) = \sigma(x) - \sigma(x)^2.Substitute step 6 into step 5 and multiply out.
  8. σ′(x)=σ(x)(1−σ(x))\sigma'(x) = \sigma(x)\big(1-\sigma(x)\big)Factor out σ(x)\sigma(x). The derivative is largest, 14\tfrac14, where σ(x)=12\sigma(x) = \tfrac12, at x=0x = 0.

Problem 6

Differentiate tanh⁡x=ex−e−xex+e−x\tanh x = \dfrac{e^x - e^{-x}}{e^x + e^{-x}} and write the result in terms of tanh⁡x\tanh x. Then show tanh⁡x=2σ(2x)−1\tanh x = 2\sigma(2x) - 1.

  1. u=ex−e−xu = e^x - e^{-x}, v=ex+e−xv = e^x + e^{-x}; u′=ex+e−xu' = e^x + e^{-x}, v′=ex−e−xv' = e^x - e^{-x}.(e−x)′=−e−x(e^{-x})' = -e^{-x} (Problem 5, step 3), so differentiating flips the sign of each e−xe^{-x} term: u′=vu' = v and v′=uv' = u.
  2. ddxtanh⁡x=(ex+e−x)2−(ex−e−x)2(ex+e−x)2\dfrac{d}{dx}\tanh x = \dfrac{(e^x+e^{-x})^2 - (e^x-e^{-x})^2}{(e^x+e^{-x})^2}.Quotient rule: u′v=v2u'v = v^2 and uv′=u2uv' = u^2.
  3. v2−u2v2=1−(uv)2\dfrac{v^2 - u^2}{v^2} = 1 - \Big(\dfrac{u}{v}\Big)^2.Split the fraction into two terms; the first is 1.
  4. ddxtanh⁡x=1−tanh⁡2x\dfrac{d}{dx}\tanh x = 1 - \tanh^2 x.u/vu/v is tanh⁡x\tanh x by definition.
  5. 2σ(2x)−1=21+e−2x−1=2−(1+e−2x)1+e−2x=1−e−2x1+e−2x2\sigma(2x) - 1 = \dfrac{2}{1+e^{-2x}} - 1 = \dfrac{2 - (1+e^{-2x})}{1+e^{-2x}} = \dfrac{1 - e^{-2x}}{1+e^{-2x}}.The definition of σ\sigma at 2x2x, then put 1 over the same denominator.
  6. 1−e−2x1+e−2x=ex−e−xex+e−x\dfrac{1 - e^{-2x}}{1+e^{-2x}} = \dfrac{e^x - e^{-x}}{e^x + e^{-x}}.Multiply top and bottom by exe^x: ex⋅e−2x=e−xe^x \cdot e^{-2x} = e^{-x}.
  7. 1−tanh⁡2x1 - \tanh^2 x; and 2σ(2x)−1=21+e−2x−1=1−e−2x1+e−2x=tanh⁡x2\sigma(2x) - 1 = \dfrac{2}{1+e^{-2x}} - 1 = \dfrac{1 - e^{-2x}}{1+e^{-2x}} = \tanh xSteps 4 to 6. So tanh⁡\tanh is a sigmoid stretched to the range (−1,1)(-1, 1) and squeezed horizontally by 2.

Problem 7

Differentiate xxx^x for x>0x > 0.

  1. Let y=xxy = x^x. Then ln⁡y=xln⁡x\ln y = x\ln x.The exponent is the variable, so the power rule, which needs a constant exponent, does not apply; the log turns the exponent into a factor. x>0x > 0 makes y>0y > 0, so ln⁡y\ln y is defined.
  2. ddxln⁡y=1y⋅y′\dfrac{d}{dx}\ln y = \dfrac{1}{y}\cdot y'.yy is a function of xx, so this is a chain rule: the derivative of ln⁡\ln evaluated at yy is 1/y1/y, times the inner derivative y′y'.
  3. ddx(xln⁡x)=1⋅ln⁡x+x⋅1x=ln⁡x+1\dfrac{d}{dx}(x\ln x) = 1\cdot\ln x + x\cdot\dfrac{1}{x} = \ln x + 1.Product rule with u=xu = x and v=ln⁡xv = \ln x; (ln⁡x)′=1/x(\ln x)' = 1/x for x>0x > 0.
  4. y′y=ln⁡x+1\dfrac{y'}{y} = \ln x + 1, so y′=y(ln⁡x+1)y' = y(\ln x + 1).The two sides of step 1 are equal for every x>0x > 0, so their derivatives are equal; multiply by yy.
  5. xx(ln⁡x+1)x^x(\ln x + 1)Substitute y=xxy = x^x.
Another route: through the exponential
  1. xx=exln⁡xx^x = e^{x\ln x} for x>0x > 0.x=eln⁡xx = e^{\ln x}, and raising both sides to the power xx multiplies the exponent by xx.
  2. The derivative of ete^t, evaluated at the inner function: exln⁡xe^{x\ln x}.(et)′=et(e^t)' = e^t at t=xln⁡xt = x\ln x.
  3. The inner derivative: (xln⁡x)′=ln⁡x+1(x\ln x)' = \ln x + 1.Product rule, as in step 3 of the first route.
  4. xx(ln⁡x+1)x^x(\ln x + 1)Chain rule: step 2 times step 3, and exln⁡x=xxe^{x\ln x} = x^x.

Problem 8

Differentiate ln⁡ ⁣(ex1+ex)\ln\!\Big(\dfrac{e^x}{1+e^x}\Big) and simplify to a single sigmoid.

  1. ln⁡ex1+ex=ln⁡ex−ln⁡(1+ex)=x−ln⁡(1+ex)\ln\dfrac{e^x}{1+e^x} = \ln e^x - \ln(1+e^x) = x - \ln(1+e^x).Simplify before differentiating: the log of a quotient is a difference of logs, and ln⁡ex=x\ln e^x = x. That replaces a chain rule wrapped around a quotient rule with two terms whose derivatives are already known.
  2. ddx(x−ln⁡(1+ex))=1−σ(x)\dfrac{d}{dx}\big(x - \ln(1+e^x)\big) = 1 - \sigma(x).xx has derivative 1, and the derivative of ln⁡(1+ex)\ln(1+e^x) is σ(x)\sigma(x) (Problem 4).
  3. 1−σ(x)=1−11+e−x=e−x1+e−x1 - \sigma(x) = 1 - \dfrac{1}{1+e^{-x}} = \dfrac{e^{-x}}{1+e^{-x}}.Put 1 over the denominator 1+e−x1 + e^{-x}.
  4. e−x1+e−x=1ex+1\dfrac{e^{-x}}{1+e^{-x}} = \dfrac{1}{e^x + 1}.Divide top and bottom by e−xe^{-x}.
  5. σ(−x)\sigma(-x)1/(1+ex)1/(1 + e^{x}) is the definition of σ\sigma evaluated at −x-x. Since ex/(1+ex)=σ(x)e^x/(1+e^x) = \sigma(x) (Problem 4, step 5), this also says ddxln⁡σ(x)=1−σ(x)=σ(−x)\tfrac{d}{dx}\ln\sigma(x) = 1 - \sigma(x) = \sigma(-x).

Problem 9

Differentiate 1+sin⁡2(2x)\sqrt{1+\sin^2(2x)} and simplify with a double-angle identity.

  1. Four layers, outermost first: t\sqrt{t}, then 1+s21 + s^2, then sin⁡w\sin w, then w=2xw = 2x.Reading the function from the outside in lists the compositions; the chain rule needs one factor per layer.
  2. The derivative of t\sqrt{t}, evaluated at the inner function 1+sin⁡22x1 + \sin^2 2x: 121+sin⁡22x\dfrac{1}{2\sqrt{1+\sin^2 2x}}.(t)′=1/(2t)(\sqrt t)' = 1/(2\sqrt t) at t=1+sin⁡22xt = 1 + \sin^2 2x, which is at least 1, so the square root is never 0.
  3. The derivative of 1+s21 + s^2, evaluated at sin⁡2x\sin 2x: 2sin⁡2x2\sin 2x.(1+s2)′=2s(1 + s^2)' = 2s at s=sin⁡2xs = \sin 2x.
  4. The derivative of sin⁡w\sin w, evaluated at 2x2x: cos⁡2x\cos 2x; and (2x)′=2(2x)' = 2.(sin⁡w)′=cos⁡w(\sin w)' = \cos w at w=2xw = 2x, and the innermost derivative is the constant 2.
  5. ddx1+sin⁡22x=2sin⁡2xcos⁡2x⋅221+sin⁡22x\dfrac{d}{dx}\sqrt{1+\sin^2 2x} = \dfrac{2\sin 2x\cos 2x\cdot 2}{2\sqrt{1+\sin^2 2x}}.Chain rule through all four layers: the product of the factors in steps 2 to 4.
  6. 2sin⁡2xcos⁡2x=sin⁡4x2\sin 2x\cos 2x = \sin 4x.Double-angle identity sin⁡2θ=2sin⁡θcos⁡θ\sin 2\theta = 2\sin\theta\cos\theta with θ=2x\theta = 2x.
  7. sin⁡4x1+sin⁡2(2x)\dfrac{\sin 4x}{\sqrt{1+\sin^2(2x)}}Substitute step 6 into the numerator of step 5; the remaining factor 2 cancels the 2 in the denominator.

Problem 10

The curve x2+xy+y2=7x^2 + xy + y^2 = 7 defines yy as a function of xx near most of its points. Find dydx\dfrac{dy}{dx}.

  1. Treat yy as a function of xx and differentiate both sides of x2+xy+y2=7x^2 + xy + y^2 = 7 with respect to xx.The equation holds at every xx in a stretch of the curve, so the derivatives of the two sides are equal there. Write y′y' for dy/dxdy/dx.
  2. ddxx2=2x\dfrac{d}{dx}x^2 = 2x.Power rule.
  3. ddx(xy)=1⋅y+x y′\dfrac{d}{dx}(xy) = 1\cdot y + x\,y'.Product rule with u=xu = x and v=yv = y; yy depends on xx, so its derivative y′y' stays.
  4. ddxy2=2y⋅y′\dfrac{d}{dx}y^2 = 2y\cdot y'.Chain rule: the derivative of t2t^2 evaluated at yy is 2y2y, times the inner derivative y′y'.
  5. 2x+y+xy′+2yy′=02x + y + xy' + 2yy' = 0.Add steps 2 to 4; the right side, 7, is constant.
  6. y′(x+2y)=−(2x+y)y'(x + 2y) = -(2x + y).Collect the terms containing y′y' on one side.
  7. dydx=−2x+yx+2y\dfrac{dy}{dx} = -\dfrac{2x + y}{x + 2y}, valid where x+2y≠0x + 2y \neq 0Divide by x+2yx + 2y, which is allowed only where it is not 0. Where x+2y=0x + 2y = 0 the curve meets y=−x/2y = -x/2, so 34x2=7\tfrac34x^2 = 7 and x=±28/3x = \pm\sqrt{28/3}; the tangent there is vertical, and near those two points yy is not a function of xx.

Where this goes wrong

1. Forgetting the inner derivative

ddxsin⁡x=cos⁡x\tfrac{d}{dx}\sin x = \cos x is the first derivative most people memorize, and it is easy to reuse it with anything in the place of xx.

  1. sin⁡(3x2)\sin(3x^2) has outer function sin⁡\sin and inner function 3x23x^2Right so far: the function is a composition.
  2. “The derivative of sin⁡\sin is cos⁡\cos, so the derivative of sin⁡(anything)\sin(\text{anything}) is cos⁡(anything)\cos(\text{anything}).”The analogy that causes the mistake: ddxsin⁡x=cos⁡x\tfrac{d}{dx}\sin x = \cos x applied with 3x23x^2 in the place of xx.
  3. ddxsin⁡(3x2)=cos⁡(3x2)\tfrac{d}{dx}\sin(3x^2) = \cos(3x^2)This is the outer derivative evaluated at the inner function, the chain rule's first factor, with the second factor, (3x2)′=6x(3x^2)' = 6x, left off. The correct derivative is 6xcos⁡(3x2)6x\cos(3x^2) (Problem 3). ddxsin⁡x=cos⁡x\tfrac{d}{dx}\sin x = \cos x is the case where the inner function is xx and its derivative is 1, which is why the factor never shows up there.

2. Quotient rule with the numerator the wrong way round

The product rule's two terms can be added in either order, and the quotient rule looks like it has the same two terms.

  1. u=xu = x, v=1+x2v = 1 + x^2, u′=1u' = 1, v′=2xv' = 2xRight so far: the pieces are those of Problem 2.
  2. “The numerator is the two cross terms, one minus the other.”The analogy that causes the mistake: remembering the terms of the product rule without the order the minus sign imposes.
  3. (x1+x2)′=x⋅2x−(1+x2)(1+x2)2\Big(\dfrac{x}{1+x^2}\Big)' = \dfrac{x\cdot 2x - (1+x^2)}{(1+x^2)^2}That is uv′−u′vuv' - u'v; the quotient rule is u′v−uv′u'v - uv'. Swapping the two terms of a difference flips its sign, so the whole answer comes out negated: x2−1(1+x2)2\dfrac{x^2 - 1}{(1+x^2)^2} instead of 1−x2(1+x2)2\dfrac{1 - x^2}{(1+x^2)^2}. A check at x=0x = 0 catches it: the function rises through the origin, so the derivative there must be positive, and this line gives −1-1.

3. Product rule as the product of the derivatives

For a sum, the derivative is the sum of the derivatives, and it is natural to expect the same for a product.

  1. u=x3u = x^3, v=exv = e^x, u′=3x2u' = 3x^2, v′=exv' = e^xRight so far: the pieces are those of Problem 1.
  2. “The derivative of a product is the product of the derivatives.”The analogy that causes the mistake: the sum rule carried over to products.
  3. (x3ex)′=3x2ex(x^3e^x)' = 3x^2e^xThat is u′v′u'v', and because v′=ex=vv' = e^x = v it also equals u′vu'v, one of the product rule's two terms, which makes it look half-right. The other term is uv′=x3exuv' = x^3e^x, and the derivative is ex(x3+3x2)e^x(x^3 + 3x^2) (Problem 1). A check with x⋅x=x2x \cdot x = x^2 shows the analogy fails: the product of the derivatives is 1⋅1=11 \cdot 1 = 1, but (x2)′=2x(x^2)' = 2x.

4. Power rule on a variable exponent

xxx^x looks like xnx^n, and (xn)′=nxn−1(x^n)' = nx^{n-1} is the rule people reach for first.

  1. xxx^x for x>0x > 0Right so far: the function and its domain.
  2. “xxx^x is xx to a power, so bring the power down and subtract 1.”The analogy that causes the mistake: the power rule applied with n=xn = x.
  3. (xx)′=x⋅xx−1(x^x)' = x\cdot x^{x-1}The power rule needs a constant exponent; here the exponent changes with xx, and its contribution, the term xxln⁡xx^x\ln x, is lost. This line simplifies to xxx^x, which is not the derivative: at x=1x = 1 it gives 1, the correct value, but at x=ex = e it gives eee^e where the derivative is 2ee2e^e. Take logs first (Problem 7): xx(ln⁡x+1)x^x(\ln x + 1).

5. Derivative of a log without the inside

(ln⁡x)′=1/x(\ln x)' = 1/x is short and easy to reuse with any argument in the place of xx.

  1. ln⁡(1+ex)\ln(1+e^x) has outer function ln⁡\ln and inner function u=1+exu = 1 + e^xRight so far: the function is a composition.
  2. “The derivative of ln⁡\ln of something is one over that something.”The analogy that causes the mistake: (ln⁡x)′=1/x(\ln x)' = 1/x applied with 1+ex1 + e^x in the place of xx.
  3. ddxln⁡(1+ex)=11+ex\tfrac{d}{dx}\ln(1+e^x) = \dfrac{1}{1+e^x}This is only the outer derivative evaluated at the inner function. The chain rule gives (ln⁡u)′=u′/u(\ln u)' = u'/u, and u′=exu' = e^x here, so the derivative is ex1+ex=σ(x)\dfrac{e^x}{1+e^x} = \sigma(x) (Problem 4). The wrong line is σ(−x)\sigma(-x), which falls where the true derivative rises: softplus is increasing, and its slope must approach 1 as xx grows, not 0.

Print this set: differentiation-rules.pdf (problems, answers, and worked solutions on separate pages).