Skip to content
AI360Xpert
Beta

Derivatives of Common Functions

A short memorized table does most differentiation: powers drop their exponent, exponentials repeat, logs reciprocate, and sine and cosine trade.

The curve x cubed plus 2 e to the x with its tangent at x equals 1: the slope 8.44 comes from adding the power rule piece 3 and the exponential piece 2 e, each rule handling its own term
The curve x cubed plus 2 e to the x with its tangent at x equals 1: the slope 8.44 comes from adding the power rule piece 3 and the exponential piece 2 e, each rule handling its own term

Why Does This Exist?

The chain, product, and quotient rules are combinators: they assemble derivatives from parts. But the parts themselves come from a memorized table, and without it every differentiation stalls at the first term. Loss functions are built from powers (MSE), exponentials (softmax), logs (cross-entropy), and occasionally sinusoids (positional encodings), so this exact table covers the parts ML actually uses.

Derivatives and partial derivatives defines what a derivative is, and the chain rule shows how to combine them. This page is the parts catalog both of them consume.

The one idea you need first

Differentiation is linear: the derivative of a sum is the sum of the derivatives, and constants factor out, (cf)′=cf′(cf)' = cf'. That license to split a function term by term and handle each with one table row is what makes the table powerful.

Think of It Like This

A phrasebook for six regular verbs

Learning a language's grammar rules helps little if you cannot conjugate "to be." The table here is six regular verbs, fully conjugated: power, exponential, natural log, general exponential, sine, cosine. Once they are memorized, the grammar (chain, product, quotient rules) combines them into any sentence a loss function utters.

Irregular verbs exist too, inverse trig and hyperbolics among them, and you look those up as needed. But these six cover daily conversation, so they earn their memory slots first.

How It Actually Works

The table, with a>0a > 0 constant and nn any real number:

  • Power: ddxxn=nxn−1\frac{d}{dx} x^n = nx^{n-1}. Drop the exponent, reduce it by one. ddxx3=3x2\frac{d}{dx} x^3 = 3x^2.
  • Exponential: ddxex=ex\frac{d}{dx} e^x = e^x. It reproduces itself, which is why ee anchors ML math.
  • General exponential: ddxax=axln⁡a\frac{d}{dx} a^x = a^x \ln a. The missing ln⁡a\ln a is the classic dropped factor.
  • Natural log: ddxln⁡x=1/x\frac{d}{dx} \ln x = 1/x, valid for x>0x > 0 only.
  • Sine and cosine trade with a sign: ddxsin⁡x=cos⁡x\frac{d}{dx} \sin x = \cos x and ddxcos⁡x=−sin⁡x\frac{d}{dx} \cos x = -\sin x.

In plain words: powers lean down one degree, exe^x is its own slope, logs become reciprocals, and trig cycles every four differentiations.

Worked example

Differentiate f(x)=x3+2exf(x) = x^3 + 2e^x and evaluate at x=1x = 1.

Split term by term (linearity): ddxx3=3x2\frac{d}{dx}x^3 = 3x^2 by the power rule, and ddx2ex=2ex\frac{d}{dx}2e^x = 2e^x since constants factor out and exe^x reproduces. So f′(x)=3x2+2exf'(x) = 3x^2 + 2e^x.

At x=1x = 1: f′(1)=3+2e≈3+5.4366=8.4366f'(1) = 3 + 2e \approx 3 + 5.4366 = 8.4366. The slope 8.44 splits cleanly into 3 from the cubic piece and about 5.44 from the exponential piece, which is exactly how to sanity-check each rule separately.

Watch Out For

Dropping the ln a in general exponentials

The symptom is a sigmoid-with-base-2 or 10-based loss whose gradient is off by a constant factor: ddx2x\frac{d}{dx}2^x written as 2x2^x instead of 2xln⁡2≈0.693⋅2x2^x \ln 2 \approx 0.693 \cdot 2^x. Everything trains, just at a wrong effective learning rate, which makes this bug look like a tuning problem. Only exe^x reproduces itself; every other base pays the ln⁡a\ln a toll. When in doubt, rewrite axa^x as exln⁡ae^{x \ln a} and let the chain rule do it.

Differentiating ln x where it does not live

ln⁡x\ln x exists only for x>0x > 0, so 1/x1/x as its derivative inherits that domain even though 1/x1/x looks fine at x=−1x = -1. The symptom is NaN losses from log-of-nonpositive evaluations, the most common crash in cross-entropy implementations. Guard inputs with clamping or log-sum-exp style shifts before differentiating, and remember the sum rule twin: ddxlog⁡ax=1/(xln⁡a)\frac{d}{dx}\log_a x = 1/(x \ln a).

The Quick Version

  • (xn)′=nxn−1(x^n)' = nx^{n-1}, (ex)′=ex(e^x)' = e^x, (ax)′=axln⁡a(a^x)' = a^x \ln a, (ln⁡x)′=1/x(\ln x)' = 1/x.
  • (sin⁡x)′=cos⁡x(\sin x)' = \cos x and (cos⁡x)′=−sin⁡x(\cos x)' = -\sin x, cycling every four rounds.
  • Linearity splits sums term by term, so each table row handles its own piece.
  • (x3+2ex)′=3x2+2ex(x^3 + 2e^x)' = 3x^2 + 2e^x, giving about 8.44 at x=1x = 1.
  • Only base ee reproduces; every other exponential base owes a ln⁡a\ln a factor.
  • ln⁡x\ln x and its derivative live on x>0x > 0 only, so clamp before logging.