# Time derivative of scalar function that takes vector as argument

Let's say I have scalar function $$\phi$$ that is function of some vectors $$\vec{\bf{p}}$$ and $$\vec{\bf{r}}$$ such that $$\phi = \phi(\vec{\bf{p}}-\vec{\bf{r}})$$, also vector $$\bf{r}$$ is function of time, so we have $$\phi = \phi(\vec{\bf{p}}-\vec{\bf{r}}(t))$$. Now I want to take derivative of $$\phi$$ in respect of time, and my logic goes (by using a chain rule):

$$\frac{\partial\phi(\vec{\bf{p}}-\vec{\bf{r}}(t))}{\partial t} = \frac{\partial\phi(\vec{\bf{p}}-\vec{\bf{r}}(t))}{\partial(\vec{\bf{p}}-\vec{\bf{r}}(t))}\frac{\partial(\vec{\bf{p}}-\vec{\bf{r}}(t))}{\partial t} = \frac{\partial\phi(\vec{\bf{p}}-\vec{\bf{r}}(t))}{\partial(\vec{\bf{p}}-\vec{\bf{r}}(t))}\frac{d(-\vec{\bf{r}}(t))}{dt}$$

And now I have a problem. First term is directional derivative which means that it is a scalar and with value of $$[\nabla\phi(\vec{\bf{p}}-\vec{\bf{r}}(t))]\cdot (\vec{\bf{p}}-\vec{\bf{r}}(t))$$. And second term $$\frac{d(-\vec{\bf{r}}(t))}{dt}$$ is vector. Which means that my time derivative is vector. On the other hand I expect this time derivative to be scalar.

Where did I go wrong?

I have a feeling that it would help if this directional derivative is multiplied with unit vector $$\frac{\vec{\bf{p}}-\vec{\bf{r}}(t)}{||\vec{\bf{p}}-\vec{\bf{r}}(t)||}$$ and if there is a dot product between fractions so I get scalar. Something like:

$$[[\nabla\phi(\vec{\bf{p}}-\vec{\bf{r}}(t))]\cdot (\vec{\bf{p}}-\vec{\bf{r}}(t))\frac{\vec{\bf{p}}-\vec{\bf{r}}(t)}{||\vec{\bf{p}}-\vec{\bf{r}}(t)||}]\cdot\frac{d(-\vec{\bf{r}}(t))}{dt}$$

But I cannot find any rules that would support this feeling. And since I am not literate enough to read tensor calculus I am asking for your help.

I checked Differentiation of a scalar function w.r.t. a vector but I still have a hard time with this. My question is how to write this down without using any components or coordinate systems. I will use this equation for things in many coordinate systems and I want it to be as general as possible.

First term is directional derivative which means that it is a scalar...

Isn't.

Small simplification: I will write simply $${\bf v}(t) = \vec{\bf{p}}- \vec{\bf{r}}(t)$$ and now we have: $$\phi:{\Bbb R}^n\longrightarrow{\Bbb R},\qquad {\bf v}:{\Bbb R}\longrightarrow{\Bbb R}^n.$$ (vectors/elements of $${\Bbb R}^n$$ are column vectors)

The composition will be $$\phi\circ{\bf v}:{\Bbb R}\longrightarrow{\Bbb R}.$$ And by the chain rule $$D(\phi\circ{\bf v})(t) = (D\phi)({\bf v}(t))\cdot D{\bf v}(t),$$ where:

• $$\cdot$$ is the matrix product,

• $$(D\phi)({\bf v}(t))$$ is a row vector (the transpose of gradient vector),

• $$D{\bf v}(t) = {\bf v'}(t)$$ is a column vector.

Can you continue?

• "Isn't" directional derivative or "isn't" scalar? – MrVragilije Feb 5 '19 at 23:56
• @MrVragilije, isn't a directional derivative and isn't an scalar. – Martín-Blas Pérez Pinilla Feb 6 '19 at 8:45
• what is it then? Is it anything at all? Btw can you check my answer? Is your answer basically saying "calculate gradient of $\phi$, then evaulate the gradient at the ${\bf{v}}(t)$ and then dot multiply it with time derivative of vector ${\bf{v}}(t)$"? – MrVragilije Feb 7 '19 at 1:25
• Oh I find it - it is exactly that - youtube.com/watch?v=qZlBjnC3iro – MrVragilije Feb 7 '19 at 2:18

According to what you've written here it goes as this (under assumption that $$\Bbb{R}^3$$):

$$D(\phi)({\bf{v}}(t)) \cdot D{\bf{v}} (t) = \begin{bmatrix} \frac{\partial \phi}{\partial v^1} & \frac{\partial \phi}{\partial v^2} & \frac{\partial \phi}{\partial v^3} \end{bmatrix} \cdot \begin{bmatrix} \frac{d v^1}{d t} \\ \frac{d v^2}{d t} \\ \frac{d v^3}{d t} \end{bmatrix}$$

Is this good?

And final question, is the first term gradient of $$phi$$ evaluated at the $${\bf{v}}(t)$$ or directional derivative in direction of $${\bf{v}}(t)$$ at $${\bf{v}}(t)$$?

• Your calculations are correct. But $D(\phi)({\bf v}(t))$ isn't a directional derivative. Directional derivatives are scalars: en.wikipedia.org/wiki/Directional_derivative. – Martín-Blas Pérez Pinilla Feb 11 '19 at 10:05
• Thank you very much. I appreciate your help. So, in this case, time derivative of scalar field is directional derivative of that field in the direction of velocity, let's say... Funny how chain rule now got new unexpected twist in my head - since it is a dot product it is basically projection of one vector on another, in this case projection of gradient onto the velocity vector. Cool – MrVragilije Feb 12 '19 at 11:24