Why This Matters
Computing derivatives from the limit definition every time would be painfully slow. The power rule, product rule, and quotient rule are shortcuts that let you differentiate most functions quickly and reliably. These rules are derived from the limit definition once, and then applied mechanically forever after.
The power rule alone handles all polynomials: the derivative of x to the n is n times x to the (n-1). The product rule handles the derivative of two functions multiplied together -- and it is not simply the product of the derivatives (a common mistake). The quotient rule handles ratios of functions.
Together with the constant multiple rule and sum rule, these three rules let you differentiate any combination of polynomial, rational, and power functions. Mastering them is essential because every later topic in calculus -- optimization, related rates, integration by parts -- requires fast and accurate differentiation.
Define Terms
Visual Model
The full process at a glance. Click Start tour to walk through each step.
Three core rules let you differentiate polynomials, products, and quotients without returning to the limit definition.
Code Example
// Power rule: d/dx[x^n] = n * x^(n-1)
function powerRuleDerivative(coefficient, exponent, x) {
const newCoeff = coefficient * exponent;
const newExp = exponent - 1;
return newCoeff * Math.pow(x, newExp);
}
console.log("Power Rule Examples:");
console.log("d/dx[3x^4] at x=2:", powerRuleDerivative(3, 4, 2)); // 12*8 = 96
console.log("d/dx[x^2] at x=5:", powerRuleDerivative(1, 2, 5)); // 2*5 = 10
// Polynomial derivative: sum of power rule terms
function polyDerivative(coeffs, x) {
// coeffs[i] is coefficient of x^i
let result = 0;
for (let i = 1; i < coeffs.length; i++) {
result += coeffs[i] * i * Math.pow(x, i - 1);
}
return result;
}
// f(x) = 2x^3 - 5x^2 + 3x - 7 => f prime(x) = 6x^2 - 10x + 3
const coeffs = [-7, 3, -5, 2]; // constant, x, x^2, x^3
console.log("\nf(x) = 2x^3 - 5x^2 + 3x - 7");
console.log("f prime(1):", polyDerivative(coeffs, 1)); // 6 - 10 + 3 = -1
console.log("f prime(2):", polyDerivative(coeffs, 2)); // 24 - 20 + 3 = 7
// Product rule: d/dx[f*g] = f prime * g + f * g prime
function productRuleAt(f, g, x, h = 0.00001) {
const fp = (f(x + h) - f(x - h)) / (2 * h);
const gp = (g(x + h) - g(x - h)) / (2 * h);
return fp * g(x) + f(x) * gp;
}
// d/dx[x^2 * sin(x)] at x = pi
const prodResult = productRuleAt(x => x*x, Math.sin, Math.PI);
console.log("\nd/dx[x^2 * sin(x)] at pi:", prodResult.toFixed(4)); // -pi^2 approx -9.8696
// Quotient rule: d/dx[f/g] = (f prime * g - f * g prime) / g^2
function quotientRuleAt(f, g, x, h = 0.00001) {
const fp = (f(x + h) - f(x - h)) / (2 * h);
const gp = (g(x + h) - g(x - h)) / (2 * h);
return (fp * g(x) - f(x) * gp) / (g(x) * g(x));
}
// d/dx[x^2 / (x+1)] at x = 2
const quotResult = quotientRuleAt(x => x*x, x => x+1, 2);
console.log("d/dx[x^2/(x+1)] at 2:", quotResult.toFixed(4)); // (2*3 - 4*1)/9 = 8/9Interactive Experiment
Try these exercises:
- Use
polyDerivativeto find the derivative ofx^5 - 3x^3 + 2xat x = 1. Verify by computing the numerical derivative. - Apply the product rule to
x * e^x. What is the derivative at x = 0? At x = 1? - Apply the quotient rule to
1/x. Verify that the result matches the power rule applied tox^(-1). - What happens if you try the quotient rule and the denominator is 0 at your evaluation point? Try
x/(x-2)at x = 2. - Differentiate the polynomial
(x-1)(x-2)(x-3)by first expanding it, then usingpolyDerivative.
Quick Quiz
Coding Challenge
Write a function called `polyDerivativeAt` that takes an array of coefficients (where coeffs[i] is the coefficient of x^i) and a value x, and returns the derivative of the polynomial evaluated at x. For example, coefficients [3, -2, 5] represent 3 - 2x + 5x^2, whose derivative is -2 + 10x. Round the result to 4 decimal places.
Real-World Usage
Derivative rules are the computational engine of calculus:
- Automatic differentiation: Machine learning frameworks (PyTorch, TensorFlow) implement derivative rules algorithmically to compute gradients of loss functions with millions of parameters.
- Symbolic math: Computer algebra systems (Mathematica, SymPy) use these rules to produce exact symbolic derivatives.
- Physics engines: Game physics and robotics simulations differentiate position equations to get velocity and acceleration.
- Financial modeling: The "Greeks" in options pricing (delta, gamma, theta) are derivatives of the option price with respect to various parameters.
- Control theory: PID controllers compute the derivative of the error signal to predict and dampen oscillations.