Implicit differentiation

### 13.2.3 Implicit differentiation

The implicitdiff command can differentiate implicitly defined functions or expressions containing implicitly defined functions. It has three different calling sequences.

- To implicitly differentiate dependent variables, implicitdiff takes four arguments:
  - constraints, an equation or list of equations which implicitly define the dependent variables as functions of the independent variables; these will be of the form

    gi(x1,…,xn,y1,…,ym)=0

    for i=1,2,…,m, where x1,…,xn are the independent variables and y1,…,ym are the dependent variables.
  - depvars, the list of dependent variables, where each dependent variable can optionally be written as a function of the xi or the name written as a function of the independent variables yi(x1,…,xn). If there is only one dependent variable, this can be omitted.
  - y, a dependent variable or a list of dependent variables to be differentiated.
  - diffvars, a sequence of independent variables xi1,…,xik with respect to differentiate.
- implicitdiff(constraints ⟨,depvars ⟩,y,diffvars) returns the derivative (or list of derivatives) of y with respect to diffvars.
- To find a specified derivative of an expression containing implicitly defined functions, implicitdiff takes four arguments:
  - expr, a differentiable expression involving independent variables x1,x2,…,xn and dependent variables y1,y2,…,ym.
  - constraints, an equation or list of equations which implicitly define the dependent variables as functions of the independent variables; these will be of the form

    gi(x1,…,xn,y1,…,ym)=0

    for i=1,2,…,m.
  - depvars, the dependent variable or list of dependent variables, where each dependent variable can either be the variable name yi or the name written as a function of the independent variables yi(x1,…,xn)).
  - diffvars, a sequence of independent variables xi1,…,xik with respect to which expr is differentiated.
- implicitdiff(expr,implicitdef,depvars,diffvars) returns the expression expr differentiated with respect to diffvars.
- To find all kth order derivatives of an expression involving implicitly defined functions, implicitdiff takes four mandatory arguments and one optional argument:
  - expr, a differentiable expression involving independent variables x1,x2,…,xn and dependent variables y1,y2,…,ym.
  - constraints, an equation or list of equations which implicitly define the dependent variables as functions of the independent variables; these will be of the form

    gi(x1,…,xn,y1,…,ym)=0

    for i=1,2,…,m.
  - vars, a list [x1,…,xn,y1,…,ym] of the independent and dependent variables entered as symbols in single list such that dependent variables come last.
  - order=k, where k is the order of the derivatives to be taken.
  - Optionally, a, a point where the partial derivatives should be evaluated at.
- implicitdiff(expr,implicitdef,vars,order=k ⟨,a ⟩) returns all partial derivatives of order k. If k=1 they are returned in a single list, which represents the gradient of expr with respect to independent variables. If k=2 the corresponding Hessian matrix is returned (see Section 13.7.3). If k>2, a table with keys in form [k1,k2,…,kn], where ∑i=1nki=k, is returned. Such a key corresponds to

  ∂k f
  ∂ var1k1 ∂ var2k2 ⋯ ∂ varnkn
  | .

#### Examples

implicitdiff(x^2*y+y^2=1,y,x)

− |
2 x y
x2+2 y

implicitdiff([x^2+y=z,x+y*z=1],[y(x),z(x)],y,x)

−2 x y−1
y+z

implicitdiff(x*y,-2x^3+15x^2*y+11y^3-24y=0,y(x),x)

2 x3−5 x2 y+11 y3−8 y
5 x2+11 y2−8

f:=x*y*z:; g:=-2x^3+15x^2*y+11y^3-24y=0:; implicitdiff(f,g,[x,z,y],order=1)

| ⎡ ⎢ ⎢ ⎣ |
2 x3 z−5 x2 y z+11 y3 z−8 y z
5 x2+11 y2−8
| ,x y | ⎤ ⎥ ⎥ ⎦

implicitdiff(f,g,[x,z,y],order=2,[1,-1,0])

⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ |
64
9
− |
2
3
− |
2
3
| 0
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦

In the following example, the value of ∂4 f/∂ x4 is computed at the point (x=0,y=0,z).

pd:=implicitdiff(f,g,[x,z,y],order=4,[0,z,0]):; pd[4,0]

−2 z |  |  |  |  |  |  |  |  |  |