# Chain rule applied to a function of a line segment

I've used the chain rule several times, but the following has appeared in a mathematical text (Loring Tu's Introduction to Manifolds):

Let $f$ be a function on an open subset $U$ of $\mathbb{R}^n$ star shaped with respect to a point $p = (p^1,p^2, \ldots p^n)$ in $U$.

Then as $U$ is star shaped w.r.t. $p$, for any $x$ in $U$ the line segment $p+t(x-p)$, $0 \leq t \leq 1$ lies in $U$. So $f(p + t(x-p))$ is defined for this range of $t$. Here's what I don't understand. By the chain rule:

$\frac{d}{dt}f(p + t(x-p)) = \sum (x^i -p^i)\frac{\partial f}{\partial x^i}(p + t(x-p))$.

Now the chain rule states that if $f$ is a function of say two variables $u$ and $v$, themselves functions of $t$ then

$\frac{df}{dt} = \frac{\partial f}{du}\frac{du}{dt} + \frac{\partial f}{dv}\frac{dv}{dt}$.

Now looking at the form of the equation given I'm guessing that $f(x^1, x^2, \ldots x^n)$, each $x^i$ itself a function of $t$. So perhaps this would then mean that the term $(x^i - p^i)(p+ t(x-p))$ has arisen as a result of calculating $\frac{dx^i}{dt} = \frac{dx^i}{du}\frac{du}{dt}$, where $u = p + t(x-p)$. But then this does not seem to help. I'm mixing up the variables?

-

not saying anything that hasnt been said (definitely agree that using $x$ twice can be confusing if youre not used to it)...

if $p=(p_1,...,p_n)$ and $y=(y_1,...,y_n)$ is any point in the set then $$f(p+t(y-p))=f(p_1+t(y_1-p_1),...,p_n+t(y_n-p_n))$$ and $$\frac{df}{dt}=\frac{\partial f}{\partial x_1}\frac{dx_1}{dt}+...+\frac{\partial f}{\partial x_n}\frac{dx_n}{dt}$$ where $x_i=p_i+t(y_i-p_i)$ is a function of $t$ (the $i$th coordinate as we move along the line segment). we have $dx_i/dt=y_i-p_i$ since $x_i$ is a constant $p_i$ plus the variable $t$ times the constant $y_i-p_i$. putting this into the expression for $df/dt$ gives $$\frac{df}{dt}(p+t(y-p))=\sum_{i=1}^n(y_i-p_i)\frac{\partial f}{\partial x_i}(p+t(y-p))$$

-
@joriki @Ross Millikan I got the bit where the $(y^i - p^i)$ came from, just where does the $p + t(y-p)$ come from? – user38268 Jun 28 '11 at 14:50
@D Lim you are evaluating $f$ and its derivatives at points $p+t(y-p)$ on the line segment between $p$ and $y$ (so its not multiplication or anything like that if thats what confusing you) – yoyo Jun 28 '11 at 16:03
My god I spent the last few days being confused over some notation!! I thought that $\frac{\partial f}{\partial x^i} (p + t(y-p))$ meant some partial derivative multiplied by that, my god! In any case I think I would have written: $\frac{\partial}{\partial x^i} f(p + t(y-p))$. – user38268 Jun 28 '11 at 22:03

In your first expression, $\frac{d}{dt}f(p + t(x-p)) = \sum (x^i -p^i)\frac{\partial f}{\partial x^i}(p + t(x-p))$, $u$ and $v$ are not mentioned. The term $(x^i - p^i)(p+ t(x-p))$ came from the chain rule, calculating the small change in each coordinate as $t$ is varied.

If $f$ is a function of $u$ and $v$, themselves functions of the coordinates, you certainly have $\frac{df}{dt} = \frac{\partial f}{du}\frac{du}{dt} + \frac{\partial f}{dv}\frac{dv}{dt}$, but without knowing how $u$ and $v$ depend on $t$ we cannot say more. In particular, we have no reason to expect that $u = p + t(x-p)$. Maybe $u(\vec{x})=\vec{y}\cdot\vec{x}$ for some fixed vector $\vec{y}$. Then $\frac{du}{dt}=\frac{\vec{x-p}\cdot \vec{y}}{|\vec{x-p}|}$

-

Yes, you're mixing up the variables. It's confusing that the same name $x$ is being used for the argument of $f$ and for a point from which particular arguments depending on $t$ are calculated. Let's keep the name $x$ for the argument, so $f$ is a function of $x$ (i.e. of $x^1,\dotsc,x^n$), and call the end point of the line segment $y$ instead of $x$. Then

$$\frac{\mathrm d}{\mathrm dt}f(p+t(y-p))=\sum(y^i-p^i)\frac{\partial f}{\partial x^i}(p+t(y-p))\;.$$

Now you can see the correspondence to your formula involving $u$ and $v$: These two variables correspond to $x^1$ and $x^2$, so your formula says

$$\frac{\mathrm df}{\mathrm dt}=\frac{\partial f}{\partial x^1}\frac{\mathrm dx^1}{\mathrm dt}+\frac{\partial f}{\partial x^2}\frac{\mathrm dx^2}{\mathrm dt}\;.$$

(I've corrected the notation for the partial derivative.) The correspondence is complete when you note that

$$\frac{\mathrm dx^i}{\mathrm dt}=\frac{\mathrm d}{\mathrm dt}(p+t(y-p))^i=\frac{\mathrm d}{\mathrm dt}(p^i+t(y^i-p^i))=y^i-p^i\;.$$

-