# How to calculate derivative of a vector valued function

1. Nov 26, 2008

### Johnson04

1. The problem statement, all variables and given/known data
$$\vec f_1 : \bf R^n \rightarrow R^1$$, $$\vec f_1(\vec x) = \|\vec x\|^2$$, calculate $$\vec f_1'(\left[ \begin{array}{c} 1 \\\vdots\\ 1 \end{array} \right])$$

2. Relevant equations
N/A

3. The attempt at a solution
I calculated the derivative as follow:
Since
$$\vec f_1(\vec x) =\|\vec x \|^2$$, $$\vec f_1(\vec x) = \sum \limits_{i=1}^n x_i^2$$.
So
$$\vec f_1(\vec x + \vec h) = \sum \limits_{i = 1}^n (x_i + h_i)^2 = \sum \limits_{i=1}^n (x_i^2 + 2x_i h_i + h_i^2) = \sum \limits_{i=1}^n x_i^2 + \sum \limits_{i=1}^n 2x_i h_i + \sum \limits_{i=1}^n h_i^2$$.
Thus, we have:
$$\vec f_1(\vec x + \vec h) - \vec f_1(\vec x) = \sum \limits_{i=1}^n (2x_i h_i +h_i^2)$$

Since according to the definition of the derivative of vector valued function (Rudin Analysis Page 212):
If there exists a linear transformation $$A$$ such that
$$\lim \limits_{\vec h to 0} \frac{|\vec f(\vec x + \vec h) - \vec f(\vec x) - A\vec h |}{|\vec h|} = 0$$,
then $$\vec f$$ is differentiable at $$\vec x$$, and
$$\vec f'(\vec x) = A$$

I defined a linear transformation as: $$A = 2 \vec x^T$$, such that we may have $$A \vec h = \sum \limits_{i = 1}^n 2x_i h_i$$. Then since $$\lim \limits_{\vec h to 0} \frac{|\sum \limits_{i = 1}^n h_i^2|}{|\vec h|} = \lim \limits_{\vec h to 0} |\vec h| = 0$$, $$A = 2 \vec x^T = \vec f'(\vec x)$$, and then plug $$\vec x = \begin{pmatrix} 1 \\ \vdots \\1 \end{pmatrix}$$ into the expression $$\vec f'(\vec x)$$.

Is this solution correct? Thanks!

2. Nov 26, 2008

### HallsofIvy

Staff Emeritus
A function from Rn to R is essentially a function f such that $f(x_1, x_2, x_3,\cdot\cdot\cdot, f_n)$ is a number for each $(x_1, x_2, \cdot\cdot\cdot, x_n)$ Its derivative can represented by the vector
$$<\frac{\partial f}{\partial x_1}, \frac{\partial f}{\partial x_2}, \cdot\cdot\cdot, \frac{\partial f}{\partial x_n}>$$
the gradient of the function.

$||x||^2= x_1^2+ x_2^2+ \cdot\cdot\cdot+ x_n^2$
The gradient is $2x_1+ 2x_2+ \cdot\cdot\cdot+ 2x_n$

Evaluate that at $x_1= x_2= x_3= \cdot\cdot\cdot= x_n= 1$.

$$\lim \limits_{\vec h to 0} \frac{|\sum \limits_{i = 1}^n h_i^2|}{|\vec h|}$$
is 0 but that omly tells you the derivative at (0, 0, ..., 0), not at (1, 1, 1,...,1).
What is
$$\lim \limits_{\vec h to 0} \frac{|\sum \limits_{i = 1}^n (1+h_i)^2- 1|}{|\vec h|}$$?

3. Nov 26, 2008

### Johnson04

$$\lim \limits_{\vec h \rightarrow 0} \frac{|\sum \limits_{i=1}^n h_i^2|}{|\vec h|}$$ was obtained from $$\lim \limits_{\vec h \rightarrow 0} \frac{|\vec f(\vec x + \vec h) - \vec f(\vec x) - A\vec h|}{|\vec h|}$$. Since I defined the linear transform at $$\vec x = \left[\begin{array}{c} x_1 \\ \vdots \\ x_n \end{array}\right]$$ as $$A = \left(\begin{array}{ccc} 2x_1 & \ldots & 2x_n \end{array}\right)$$, I got $$A\vec h = \sum \limits_{i = 1}^n 2x_i h_i$$.
Plug this $$A\vec h$$ back to the definition of derivative, I got:
$$\lim \limits_{\vec h \rightarrow 0} \frac{|\vec f(\vec x + \vec h) - \vec f(\vec x) - A\vec h|}{|\vec h|} = \lim \limits_{\vec h \rightarrow 0} |\vec h| = 0.$$.
I think I have shown that the linear transformation $$A$$ does exist at $$\vec x$$, so according to the definition $$\vec f'(\left[\begin{array}{c} 1 \\ \vdots \\ 1 \end{array}\right]) = \left(\begin{array}{ccc} 2 & \ldots & 2 \end{array}\right)$$.
But I just was confused by the fact that the function $$\vec f(\vec x)$$ actually maps $$\bf R^n$$ to $$\bf R^1$$, but the result of my calculation implies that $$\vec f'(\vec x)$$ maps $$\bf R^n$$ to itself? Am I wrong somewhere? Or I still didn't really understand the definition?