# Computing Directional Derivatives

## EXERCISES

### Problem 1:

Use the definition of directional derivative to compute the directional derivative of the function,

> with(linalg):f := (x,y) -> x/y: 'f(x,y)' = f(x,y);

`                                 f(x, y) = x/y`
 at the point,

> r := vector([6,-2]):
 in the direction of the vector,

> v := vector([-1,3])/sqrt(10):

### Solution 1

Let's call Dvf the directional derivative. From the definition we have,

> Dvf := Limit('(f(r+h*v)-f(r))/h',h=0);

```                                      f(r + h v) - f(r)
Dvf := Limit  -----------------
h -> 0         h```
 where in our case,

> p := evalm(r+h*v): Dvf := Limit((f(p[1],p[2])-f(r[1],r[2]))/h,h=0);

```                                                 1/2
6 - 1/10 h 10
----------------- + 3
1/2
-2 + 3/10 h 10
Dvf :=  lim    ---------------------
h -> 0            h```
 which simplifies to,

> Dvf := Limit(simplify((f(p[1],p[2])-f(r[1],r[2]))/h),h=0);

```                                               1/2
10
Dvf :=  lim    8 ---------------
h -> 0                1/2
-20 + 3 h 10```
 and the directional derivative is then,

> Dvf := limit((f(p[1],p[2])-f(r[1],r[2]))/h,h=0);

```                                             1/2
Dvf := - 2/5 10```

```                                           1/2
```                                               1/2