Explore calculusLesson 26 of 48 · 8 min
Differentiate a composed expression
Calculate a derivative and interpret the chain-rule factor.
Maths refresher: Slope and the chain rule
A derivative measures local change. For a composition, multiply the outer derivative by the derivative of its input.
At , the function value is but its derivative is . These are different quantities.
A derivative describes the local rate of change of a function with respect to a chosen variable. SymPy diff applies symbolic differentiation rules to an expression. State the variable explicitly, particularly when parameters appear in the formula.
For a composed function, the chain rule includes the derivative of the inner expression. Differentiating exp(x squared) therefore produces both an exponential factor and a factor. Omitting the inner derivative changes the rate.
The example also evaluates the derivative at a specific input. That number describes the slope there, not the function’s value. Units follow the ratio of output units to input units, and a symbolic derivative does not establish whether the original formula accurately models a measured process.
Will differentiating give only ?
Write a prediction (optional)
Exact symbolic investigation
Select Run Python with the code unchanged.
Your saved draft is open. To use the published code, select Restore example in Tools. Use Recover draft to bring back your code.
Tools
About Python
Python and the course packages can load while you read. Each run starts with fresh user variables; imported modules stay loaded. Stop replaces the worker. Runtime details ↗
Ctrl+Enter or ⌘+Enter runs Python.
Execution error
Technical error details
Your result
Python text output
Compare with the worked example
Executed from the published Python during the site build. Your own run appears above. Build environment ↗
Worked text output
Function: exp(x**2) Derivative: 2*x*exp(x**2) Value at 1: E Slope at 1: 2*E Second derivative: 2*(2*x**2 + 1)*exp(x**2)
Read the starter result
Read Derivative for the factor from the inner derivative. Compare Value at 1 with Slope at 1: they evaluate different expressions at the same input.
Edit and compare
Replace sp.exp(x**2) with sp.exp(3*x+1) on the expression line. Select Run Python and read Derivative. Which factor comes from differentiating the new inner expression?
Scope. Differentiation is conditional on the formula and variable assumptions; it does not validate a physical or statistical model.
Try a fresh case
For , which factor comes from differentiating the inner expression?
Need a hint?
Hint 1
Separate the outer rule from the inner expression.
Hint 2
Differentiate first.