by Black Orpheus
 P: 23 One last question for tonight... If you let f: R^n ---> R (Euclidean n-space to real numbers) and f(x) = ||x-a|| for some fixed a, how would you define the gradient in terms of symbols and numbers (not words)?
 Sci Advisor P: 1,253 Start by writing out the definition for ||x - a||
 P: 23 forgot to add that it's for all x not equal to a
P: 23

 HW Helper P: 1,007 For $$f(x)=\| x-a\| = \sqrt{(x_1-a_1)^2+\cdots +(x_n-a_n)^2}$$ we have $$\nabla f(x) = \left< \frac{\partial }{\partial x_1},\ldots , \frac{\partial }{\partial x_n}\right>\cdot \sqrt{(x_1-a_1)^2+\cdots +(x_n-a_n)^2}$$ $$\left< \frac{\partial }{\partial x_1}\sqrt{(x_1-a_1)^2+\cdots +(x_n-a_n)^2},\ldots , \frac{\partial }{\partial x_n}\sqrt{(x_1-a_1)^2+\cdots +(x_n-a_n)^2}\right>$$ $$= \left< \frac{x_1-a_1 }{\sqrt{(x_1-a_1)^2+\cdots +(x_n-a_n)^2}},\ldots , \frac{x_n-a_n }{\sqrt{(x_1-a_1)^2+\cdots +(x_n-a_n)^2}}\right>$$ $$= \frac{1}{\sqrt{(x_1-a_1)^2+\cdots +(x_n-a_n)^2}}\left< x_1-a_1 ,\ldots , x_n-a_n \right>$$ $$= \frac{x-a}{\| x-a\| }$$ which is a unit vector in the direction of x-a.