Rule 1: The derivative of a constant is zero. Diff(C) = 0 Rule 2: The derivative of X is…
- User
Rule 1: The derivative of a constant is zero.
Diff(C) = 0
Rule 2: The derivative of X is one.
Diff(X) = 1
Rule 3: The derivative of the sum of expressions S and T is the sum of the derivative of expression S plus the derivative of expression T.
Diff(S + T) = Diff(S) + Diff(T)
Rule 4: The derivative of the difference between expressions S and T is the difference of the derivative of expression S minus the derivative of expression T.
Diff(S - T) = Diff(S) - Diff(T)
Rule 5: The derivative of the product of expressions S and T is equal to the product expression S and the derivative expression T plus the product of expression T and difference of the derivative of expression S.
Diff(S * T) = S * Diff(T) + T * Diff(S)
You should note that this is a recursive process since Diff can be defined in terms of other uses of Diff. The base cases are when Diff(C) = 0 and Diff(X) = 1.
Simplification
You have one additional task in evaluating the derivative of the expression; simplifying it as much as possible. Following are the simplification rules. You can choose to the best place(s) in your program to apply the simplification rules. If S is an expression,
S + 0 = 0 + S = S - 0 = S * 1 = 1 * S = S
S * 0 = 0 * S = S - S = 0
- Assistant
Examples:
- Suppose we want to find the derivative of the expression f(x) = 4x^3 + 2x^2 - 3x + 5. We can apply the derivative rules to each term separately:
Diff(4x^3) = 4 * 3x^(3-1) = 12x^2 Diff(2x^2) = 2 * 2x^(2-1) = 4x Diff(-3x) = -3 * 1x^(1-1) = -3 Diff(5) = 0
So the derivative of f(x) is f'(x) = 12x^2 + 4x - 3.
- Now let's find the derivative of the expression g(x) = (2x^2 + 3x - 1) * (x + 2). We apply the product rule:
Diff(2x^2 + 3x - 1) = Diff(2x^2) + Diff(3x) - Diff(1) = 4x + 3 - 0 = 4x + 3 Diff(x + 2) = 1 + 0 = 1
So the derivative of g(x) is g'(x) = (2x^2 + 3x - 1) * 1 + (x + 2) * (4x + 3) = 2x^2 + 3x - 1 + (4x^2 + 3x + 8x + 6) = 6x^2 + 14x + 5.
We can see that applying the simplification rules, the expression can be further simplified to g'(x) = 6x^2 + 17x + 5.