TITLE: How can I find the derivative of a function that takes in two variables?
QUESTION [7 upvotes]: 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?

REPLY [2 votes]: A geometric way of thinking about the $n$-th derivative in one variable is that is the best possible $n$-th degree approximation to the function, after the lower derivatives have been subtracted away.
For example, the "0-th derivative" of $f(x)$ at $x_0$ is just the point $f(x_0)$.
Subtract $f(x_0)$ from $f$ and you get a function $f(x) - f(x_0)$ that crosses the $x$-axis at $x_0$. If you zoom in far enough at the point $x_0$, it looks like a line $y = a(x-x_0)$. This line is completely determined by its slope, which we call the first derivative.
Subtract off this line, and now your function $f(x) - f(x_0) - a(x-x_0)$ kisses the $x$-axis at $x_0$ without crossing it. Zoom in far enough and it looks like a quadratic, $\frac{1}{2}b(x-x_0)^2$. Again, the single number $b$ is enough to determine the shape of this quadratic, and we call this number the second derivative.
Now let's look at a two-dimensional function $f(x,y)$. Again, the degree 0 approximation at $(x_0,y_0)$ is just $f(x_0,y_0)$. Subtracting we get $f(x,y) - f(x_0,y_0)$, and if we zoom in this function looks like a plane that passes through the $x-y$ plane at $(x_0,y_0)$. This plane has equation $z = a(x-x_0) + b(y-y_0)$ for some coefficients $a$ and $b$ -- notice that now we need two numbers to completely specify this plane. This pair of numbers is the first derivative of $f$.
Subtracting again we will get a function that is tangent to the $x-y$ plane at $(x_0,y_0)$; zooming in, the surface looks like a degree 2 quadratic surface $z = \frac{1}{2} b(x-x_0)^2 + c(x-x_0)(y-y_0) + \frac{1}{2}(y-y_0)^2.$ The three numbers $b,c,d$ that determine this quadratic are the second derivative, often written as a matrix $\left[\begin{array}{cc} b & c\\ c & d\end{array}\right]$. This surface looks like either a bowl, an extruded parabola, or a saddle.
We can continue this process, approximating what's left of the function with cubic, quartic, etc. surface. But these require more and more numbers to determine, and are harder to visualize geometrically.