Skip to content
DeepForgeby svx
All problems
MediumCalculusca-030

Implicit Differentiation

Problem

The curve x^2 + y^2 + a * x + b * y + c = 0 defines y implicitly as a function of x.

Differentiating implicitly gives dy/dx = -(2 * x + a) / (2 * y + b). Return that slope at (x, y), or None when 2 * y + b == 0 (vertical tangent).

Hint

Differentiate every term with respect to x, treating y as y(x) and dy/dx as the unknown.

Test cases

case 1
in: [0,0,1,1]
expected: -1
case 2
in: [0,0,3,4]
expected: -0.75
case 3
in: [2,-4,0,0]
expected: 0.5
case 4
in: [0,0,1,0]
expected: null
Starter codePython
def implicit_derivative(a, b, x, y):
    # Return None when 2*y + b == 0
    # Your code here
    pass

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