# Simple example of linear approximation with multivariable calc - is this right?

I'm still trying to grasp fully the concept of directional derivatives and how they can be used to approximate functions, and so I have an example of a problem I made up that I tried to evaluate. Let's say I have the function,

$$f(x,y) = x^2+y^2$$

I want to evaluate the directional derivative at the point P = $(2,2,8)$ with the vector $\vec{v} = (1,2)$.

So I first found the gradient $\nabla f = (2x,2y)$, and plugging in the original points I got the gradient at point P to be $(4,4)$. I then found $\nabla f \cdot P$ and got $4 * 1 + 4 * 2 = 12$. So the directional derivative would be $12$. My understanding is that this is the best approximation around the point, and says that moving by $h*\vec{v}$ will cause a change of $12 * h$. So when $h=1$, you would be moving to the point (2,3) and the approximation would be $f \approx 8 + 12 = 20$, but the actual value of the function is $f = 25$. That's a very large error, but when $h$ gets smaller and smaller, this error will decrease monotonically.

I want to clarify if my logic, calculation, and reasoning is correct before I move on from this topic. I'd be worried if I went into the next topic with a fundamental misunderstanding.

• You are missing that the direction has to be a unit vector. – Kaynex May 24 '17 at 1:31
• @Kaynex from my question here, it seems that you do not actually need to scale down to a unit vector: math.stackexchange.com/questions/2291302/… – rb612 May 24 '17 at 1:32
• I'm not sure what's going on in your question, but it's clear here that changing the length of your direction should not matter, yet if you multiply your direction vector by $2$, you're going to double your result. – Kaynex May 24 '17 at 1:35
• That's true, except the directional derivative supposedly does indeed have that property, in most cases. Take a look at the section "finding slope" from Khan Academy - this is where I'm learning it from, and I hear that definitions do differ. But regardless of the approach, shouldn't the linearization yield the same result? – rb612 May 24 '17 at 1:38

First, as someone said in the comments, the formula $\nabla f \cdot \vec{v}$ for directional derivative only holds when $\vec{v}$ is a unit vector. What you are doing is almost correct, and it is similar in flavor to the directional derivative, but you are not computing the directional derivative. Careful with the terminology here.
You can use your approach to estimate the value of $f$ at some point 'near' $P = (2, 2)$. You are using a vector $\vec{v} = (1, 2)$ and taking $h=1$. That means you are trying to approximate $f$ at the point $P + \vec{v} = (3, 4)$. Using the directional derivative method, you estimated $f(3, 4) \approx 20$, but we calculate $f(3, 4) = 25$. Frankly, this isn't too bad of an approximation. Note that the point $(3, 4)$ is $\sqrt{5} \approx 2.2$ units aways from the original point $(2,2)$. This is kind of far to be expecting super close approximations. So being off by $5$ isn't so bad. If you try the same thing but take $h = 0.1$ or even $h = 0.001$, you will see that the error shrinks dramatically.
• @rb612 There is a difference between the definition of the directional derivative (like the wikipedia definitions you linked) and a convenient method for computing it. You don't need $\vec{v}$ to be a unit vector if you use the limit definition of directional derivative. You do however need to take $\vec{v}$ to be a unit vector to use the convenient $\nabla f\cdot \vec{v}$ method of computing the directional derivative. – ChocolateAndCheese May 24 '17 at 4:59
• @rb612 The directional derivative is the 'slope' of the tangent plane in the direction of $\vec{v}$. They are the same thing. Most people avoid the term 'slope' in this context because talking about the 'slope' of a plane doesn't always make sense. – ChocolateAndCheese May 24 '17 at 5:08