Skip to content
Glacius
CalculusConcept reference

Partial derivatives

A partial derivative measures a scalar function’s rate in one independent coordinate while all other coordinates are held constant.

On this page 9 sections
  1. Overview
  2. Understand the idea
  3. For f(x,y)=x^2+3y, choosing y instead changes the calculation
  4. A partial derivative can itself depend on several coordinates
  5. A closer look
  6. Key takeaway
  7. Further questions
  8. Sources & further reading
  9. Concept connections

01Understand the idea#

A partial derivative measures how a several-input function responds when one input changes and all the others stay fixed. For a model with many weights, it isolates the local effect of one weight on the loss. The variable you differentiate with respect to determines what counts as constant.

A partial derivative changes one input coordinate. For f(x,y)=x2+3yf(x,y)=x^2+3y, the highlighted path varies xx and keeps y=2y=2.

Input plane for f(x,y)=x squared+3y. The horizontal highlighted path keeps y=2 while x varies from -2 to 2. At fixed y=2 the scalar function becomes x squared+6. The axes use equal 26 pixels per data unit; the path is in input space, not a graph of output values.Input plane for f(x,y)=x squared+3y. The horizontal highlighted path keeps y=2 while x varies from -2 to 2. At fixed y=2 the scalar function becomes x squared+6. The axes use equal 26 pixels per data unit; the path is in input space, not a graph of output values.
Figure 1Input plane for f(x,y)=x squared+3y. The horizontal highlighted path keeps y=2 while x varies from -2 to 2. At fixed y=2 the scalar function becomes x squared+6. The axes use equal 26 pixels per data unit; the path is in input space, not a graph of output values.
Link to this figure ↗Download SVGDownload PNG

For f(x,y)=x2+3yf(x,y)=x^2+3y, treat yy as a constant when differentiating in xx. The term 3y3y has derivative zero.

fx=fx=2xf_x=\frac{\partial f}{\partial x}=2x

For f(x,y)=x2y+3yf(x,y)=x^2y+3y at (2,4)(2,4), hold y=4y=4 when finding the rate in xx. Symbolically, fx=2xyf_x=2xy, so fx(2,4)=16f_x(2,4)=16. For the rate in yy, hold xx fixed: fy=x2+3f_y=x^2+3, giving 7. The same function has different rates in different input directions.

Check your reasoning

f(x,y)=4xy+y2f(x,y)=4xy+y^2. Find fxf_x.

  1. A4x+2y4x+2y
  2. B4y4y
  3. C4y+2y4y+2y
Show answer and explanation
4y4y

Hold yy fixed: fx=4yf_x=4y.

02For f(x,y)=x^2+3y, choosing y instead changes the calculation#

For f(x,y)=x2+3yf(x,y)=x^2+3y, choosing yy instead changes the calculation. Now x2x^2 is constant, and 3y3y has derivative 3.

fy=3f_y=3

Keep the inner derivative in the chain rule. For g(x,y)=(x+3y)2g(x,y)=(x+3y)^2, hold xx fixed when finding gyg_y. The inner derivative is 3.

gy=6(x+3y)g_y=6(x+3y)
Check your reasoning

f(x,y)=(2x+y)2f(x,y)=(2x+y)^2. A learner writes fx=2(2x+y)f_x=2(2x+y). Repair it.

  1. A2(2x+y)2(2x+y)
  2. B2(2x+y)(2+1)2(2x+y)(2+1)
  3. C4(2x+y)4(2x+y)
Show answer and explanation
4(2x+y)4(2x+y)

The inner derivative in xx is 2.

03A partial derivative can itself depend on several coordinates#

A partial derivative can itself depend on several coordinates. For f(x,y)=x2yf(x,y)=x^2y, first find fx=2xyf_x=2xy, then evaluate at (2,3)(2,3).

fx(2,3)=12f_x(2,3)=12
Check your reasoning

Cost C(a,b)=a2+abC(a,b)=a^2+ab. At (a,b)=(2,3)(a,b)=(2,3), find CaC_a with bb fixed.

Show answer and explanation
7

Ca=2a+b=7C_a=2a+b=7.

04A closer look#

A positive partial derivative means a small increase in that input raises the output locally, with the other inputs fixed. It is a local mathematical sensitivity, not by itself a causal claim about changing a measured feature in the real world.

Key takeaway

Differentiate one coordinate; keep the others fixed.

  • Compute a partial derivative with other coordinates held fixed.

Further questions

Does a fixed coordinate disappear from the answer?
Not necessarily. In xy, the x partial is y because y stays as the constant coefficient. A term containing only fixed coordinates does have derivative zero.

Sources & further reading

  1. [1]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Partial derivatives.” Math behind ML. /learn/c-partial