[Math] How to find the derivative of a function that takes in two variables

calculusmultivariable-calculus

We won't learn derivations in school for next 3 or 4 years, but I got interested in math and started learning about derivations on Khan Academy. I do understand what would a derivative of $f(x) = x^2$ be, but what if $f(x, y) = (x + y)(x + y)$ ? I guess i would need a three dimensional graph for that, and thus I wouldn't be looking for a tangent line, but more like a tangent surface of some sort? How can I express the "slope" of a surface? I guess that I need at least two numbers… I did some calculations, I'm pretty sure that they're wrong but I got that $f'(x, y) = 2x + 2y$, if given that $f(x, y) = (x + y)(x + y)$… This doesn't really make any sense to me, at all, so how do you do it?

Best Answer

The usual thing one does (but this can vary according to what you're trying to achieve) is to compute a vector called the gradient of the function, notated $\nabla f$. The gradient has one component for each input to $f$; for each component you treat all other variables temporarily as constants and differentiate with respect to the chosen one: $$(\nabla f)(x,y) = \left(\frac{d}{dx}f(x,y), \frac{d}{dy}f(x,y)\right) = ( 2(x+y), 2(x+y) ) $$ In this example it may be a bit hard to see what's going on, because both components end up being the same, so let's try another one: $g(x,y)=x^2y+y$ gives $$\nabla g(x,y) = (2xy, x^2+1)$$

The intuitive property of the gradient is that if we have some small offset $(h,k)$ from $(x,y)$, then the difference $f(x+h,y+k)-f(x,y)$ is closely approximated by the dot product between $(h,k)$ and $\nabla f(x,y)$.

The components of the gradient are called partial derivatives and are often notated with a special sign as $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$. The $\partial$ sign looks a bit like a $d$, but is different as a reminder that a single partial derivative is not usually enough to estimate $\Delta f$; you need both of them.