Skip to content
DeepForgeby svx
All problems
MediumCalculusca-029

Chain Rule Evaluation

Problem

Evaluate the derivative of the composite f(g(x)) at x, where f(u) = u^3 + 2 * u and g is a polynomial given by coefficients.

By the chain rule, the derivative is (3 * g(x)^2 + 2) * g'(x).

Hint

Differentiate the outer function at g(x) and multiply by the inner derivative.

Test cases

case 1
in: [[0,1],2]
expected: 14
case 2
in: [[0,0,1],2]
expected: 200
case 3
in: [[3],5]
expected: 0
case 4
in: [[1,0,1],0]
expected: 0
case 5
in: [[0,0,0,1],1]
expected: 15
Starter codePython
def chain_rule(coeffs, x):
    # f(u) = u**3 + 2*u, g is the polynomial
    # Your code here
    pass

5 test cases · run your code against them in the editor