|
Step-by-Step Differentiation
George Beck
The built-in Mathematica operator D gives derivatives immediately without any intermediate steps. In this notebook the operators WalkD and RunD are defined to show each step so that a beginner can learn how to take derivatives. WalkD says what rule is used at each step, but RunD is in too much of a hurry for that.
Differentiation rules
These are all the rules for taking derivatives.
PrintRules
Step-by-step differentiation with each step explained
The defined function WalkD takes a derivative and tells you what rule it is using at each step. Expressions of the form d[y, x] mean dy/dx. Mathematica uses the command D[y, x] to take the derivative of y with respect to x without showing any intermediate steps.
Example 1
Example 2
You can check the result with the built-in differentiation function D.
D[Sin[x + Cos[x]], x]
Quiet step-by-step differentiation
RunD does the same thing as WalkD without telling you what rule is being used at each step.
Example 3
Can you see which rules are being applied at each step? You can check with WalkD.
Example 4
This triple chain is a symbolic example. Do you see the pattern at the end? Can you predict what the derivative of a chain of four functions will look like?
Step-by-step second derivatives
You can use WalkD and RunD twice (in any combination) to give the first derivative followed by the second derivative. You can also do the third derivative using triple combinations, and so on.
Example 5
Again, you can check this with the built-in differentiation operator.
Single-step differentiation
WalkD and RunD do one step after another until the derivative is completely worked out. You can do a single step of a differentiation by using the differentiation rules.
How to apply a rule
This is the format for only a single step in taking the derivative of an expression. The slash-dot (/.) means the rule will be used on the expression.
expression /. rule
In this example we substitute A for x.
The differentiation rules have the arrows already inside them.
Example 6
If there is a sum first, use the linearity rule.
LinearityRule is two rules in one, the first is for sums of functions and the second is for terms with a constant multiplier. Recall that in Mathematica % means the previous result.
% /. LinearityRule
Now use the power rule.
% /. PowerRule
Example 7
SpecificRules gives the derivatives of individual functions that are not combined in any way with other functions.
% /. SpecificRules
Example 8
% /. PowerRule
You can do two steps at a time.
Example 9
The built-in operator D outputs derivatives immediately in one step.
Here is the derivative done manually one step at a time.
% /. SpecificRules /. ChainRule
% /. PowerRule
Example 10
You can use all the rules together. After the first step you can continue with  l until the derivative is finished, that is, until there is no more d in the expression. It is a good exercise to say what rule is being used at each step.
Implementation
Usage messages
Function definitions
The rule d[x_, x_] is repeated intentionally.
Drop the specific rules for generic cases.
Apply specific rules last when applying all at once.
Rule sets for applying the rules individually.
|