# Differentiating with respect to a vector

Hello i'm new to this forum and this is my first post. I was going over the transport theorems in fluid mechanics and there is one way in which you can convert reynolds transport theorem into a single triple integral by use of the divergence theorem. Afterwards what is inside the integral is the partial derivative of the function wrt to time plus the divergence of the velocity times the scalar function. Using the product rule for divergence it is expanded and grouped terms form what is defined as the material derivative which seems to me that it is simply the total differential. The argument in this case is a scalar function of the position vector and time and the total differential can be found by considering the sum of the partial derivatives of the function wrt to each variable times the differential of the variariable.

Now the nature of the function allows us to write the differential straight away but what if we go about writing the differential as the partial differential wrt to time and the partial differential wrt to the position vector times the dr.(i should state here i did this out of curiosity i do not even know what differentiating wrt to a vector even means. i was simply applying standard algebraic rules to see if there is a connection). By comparing the above with the already established equation for the total differential we see that the the partial derivative of the function with respect to a vector must equal the gradient operator dot the dr. What is really troubling thusly is that differentiating with respect to a actually means something. I tried googling around and i found alot of stuff on exterior calculus, covariant and contravariant vectors but these stuff dont make alot of sense to me due to my engineering background(undegraduate).

What i really want to know is what is this operation of differentiating wrt a vector, how it is related with the jacobian (i've seen somewhere that the jacobian is a vector differentiated wrt to another vector). Also i think i understand the difference of covariant and contravariant basis vectors but i cant find an example of a coordinate system where they are distinct (from what i understand in cartesian and rotational coordinate systems they are the same). Any references to a simple explanation or perhaps a start so i can read up. Its driving me crazy that i do not understand these. Sorry for my bad enginish.

• For some basic information about writing math at this site see e.g. here, here, here and here. Also I don't even really want to read your post right now. It's just a huge wall of text. In the future, try to break your questions/ answers up into smaller sections or add headers or something. – user137731 Nov 23 '14 at 0:52
• Does Matrix calculus page help? – user147263 Nov 23 '14 at 1:24
• seek directional derivative – janmarqz Nov 23 '14 at 1:40
• A pretty elaborate answer is coming your way, bear with me for a while. – alonso s Nov 23 '14 at 2:19
• Sorry for the wall of text. i have checked the wiki sites but they are not very clear as to how the partial differential operator works but one thing that i clearly understand is that a vector is invariant under coordinate transformations and that is why the gradient is defined in terms of a directional derivative – AbeautifullTheorem Nov 23 '14 at 2:44

## 1 Answer

While I have taken courses in fluid dynamics I can't recall the particulars of the procedure you describe. Perhaps you could make somewhat clearer the calculations outlined above concerning the derivatives with respect to a vector.

Now, in most instances where the symbols such as $\frac{\partial f}{\partial \bf{x}}$ or something similar appear it is meant as the derivative of $f$ with respect to every $x_i$ in $\bf{x}$, this yields a vector quantity: $\frac{\partial f}{\partial \bf{x}}=(f_x,f_y,f_z)$.

Now in the particular context of fluid dynamics, in the Lagrangian picture a fluid mass point moves along its flow line: $\mathbf{r}=(x(t),y(t),z(t))$, i.e. we move with the small fluid volume under consideration. The change in a function $f(t,x,y,z)$ might come from its dependence on $t$ or from a change in $\mathbf{r}$, so:

$$\operatorname d\!f=\partial_t f \operatorname d\!t + \sum_i \partial_{x_i}f \operatorname d\!x_i =\partial_t f \operatorname d\!t + \nabla f \cdot \operatorname d\!\mathbf{r}.$$

But $\mathbf{r}$ depends on time: $\mathbf{r}=(x(t),y(t),z(t))$, so $$\operatorname d\! x_i = \frac{\partial x_i}{\partial t}\operatorname d\! t=v_i \operatorname d\! t,$$

so $\operatorname d\! \mathbf{r}=\mathbf{v}\operatorname d\! t$ and $$\operatorname d\!f=\partial_t f \operatorname d\!t + (\nabla f \cdot \mathbf{v})\operatorname d\! t.$$

This yields the well known material derivative: $$D_t f:= \frac{\operatorname d\!f}{\operatorname d\! t}=\partial_t f + (\nabla f \cdot \mathbf{v}).$$

The operator $D_t$ is succintly abbreviated as $$D_t=\partial_t + (\mathbf{v} \cdot \nabla).$$

At not point were derivatives with respect to vectors calculated (at least in this context). Questions regarding operations interpreted as the derivatives of a quantity with respect to a vector can be found all over the site.

On your question about covariant and contravariant vectors: while fluid dynamics makes heavy use of "tensor" quantities, it is ordinarily sufficient to regard this tensors as mere matrices, so the distinction between contravariant and covariant vectors might never be of interest. In special and general relativity, and quantum field theory, however, it is of key physical importance that the laws of physics remain unchanged when changing your reference frame, this leads naturally to the study of certain types of transformations $T:\bf{x}\mapsto \bf{x'}$ (in this case Lorentz transformations, but lets keep the discussion as general as possible) and the manner in which they modify the underlying coordinate system.

Suppose we have a (contravariant) vector $\mathbf{x}=(x^1,\dots,x^n)$ (bear with the superscripts for now) in a certain reference frame and we are given a transformation $$\mathbf{x}\mapsto \mathbf{x'}=\mathbf{x'}(\mathbf{x}):$$ \begin{align} {x'}^1&={x'}^1(x^1,\dots,x^n),\\ & \vdots \\ {x'}^n&={x'}^n(x^1,\dots,x^n). \end{align}

Now from multivariable calculus you might have heard about the Jacobian matrix $J$ and know that $\det{J}$ is the proportionality factor between the volume of the "infinitesimal cubes" $\operatorname d\!x^1\dots \operatorname d\!x^n$ and $\operatorname d\!{x'}^1\dots \operatorname d\!{x'}^n$, but the matrix $J$ tells us way more; if we wanted to calculate an "infinitesimal displacement" $$\operatorname d\!\mathbf{x}=(\operatorname d\!x^1,\dots,\operatorname d\!x^n)$$ the chain rule would yield \begin{align} \operatorname d\!{x'}^1&=\frac{\partial {x'}^1}{\partial x^1}\operatorname d\! x^1+\dots+\frac{\partial {x'}^1}{\partial x^n}\operatorname d\!x^n,\\ &\vdots \\ \operatorname d\!{x'}^n&=\frac{\partial {x'}^n}{\partial x^1}\operatorname d\! x^1+\dots+\frac{\partial {x'}^n}{\partial x^n}\operatorname d\!x^n \end{align}, which is equal to (in matrix-vector notation) $$\operatorname d\!\mathbf{x'}=J \operatorname d\! \mathbf{x}.$$

Vectors whose coordinate differentials transform with $J$ [the Jacobian] are called contravariant, and their coordinates themselves also transform with $J$. All other physical quantities which behave like contravariant vectors when a transformation is applied are called contravariant as well. We denote contravariant quantities by superscripts on their coordinates (hence the notation $\mathbf{x}=(x^1,\dots,x^n)$). Covariant vectors transform as $${x'}^\alpha = J_\beta^\alpha x^\beta.$$ Where summation over repeated indices is implied.

Now the inverse transformation of $\mathbf{x}\mapsto \mathbf{x'}$ is $\mathbf{x'}\mapsto \mathbf{x}:$ \begin{align} {x}^1&={x}^1({x'}^1,\dots,{x'}^n),\\ & \vdots \\ {x}^n&={x}^n({x'}^1,\dots,{x'}^n). \end{align}

And its Jacobian has the form

$$\left( \begin{array}{ccc} \frac{\partial x^1}{\partial {x'}^1} & \cdots & \frac{\partial x^1}{\partial {x'}^n} \\ \vdots & & \vdots \\ \frac{\partial x^1}{\partial {x'}^1} & \cdots & \frac{\partial x^1}{\partial {x'}^n} \end{array} \right)$$

From the chain rule: $\frac{\partial {x'}^i}{\partial x^k} \frac{\partial x^k}{\partial {x'}^j}=\delta_j^i$ (summation over $k$ implied), so we see that the Jacobian of the transformation and the Jacobian of the inverse transformation are inverses. Covariant vectors are those whose coordinates transform according to the Jacobian of the inverse transformation, that is, the inverse of $J$ and are written with subscripts $x_\alpha$.

Covariant vectors can be regarded (at least that's one way to look at them) as elements of the dual space of your original vector space, i.e.: they take vectors and spit out scalars (which are frame-independent). If you recall your linear algebra you can produce scalars through a "scalar product" of two "vectors" $\mathbf{u}$ and $\mathbf{v}, \bf{u\cdot v}$. In component notation (with summation implied):

$${u'}_\alpha {v'}^\alpha=({J^{-1}}_{\alpha}^\gamma u_\gamma) (J_\varphi^\alpha v^\varphi)=({J^{-1}}_{\alpha}^{\gamma}J_\varphi^\alpha)u_\gamma v^\varphi=\delta_\varphi^\gamma u_\gamma v^\varphi = u_\alpha v^\alpha$$

So by requiring that the coordinates of covariant vectors transform with $J$ and contravariant coordinates with $J^{-1}$ we obtain invariant scalar products, as is required in any physically meaningful theory.

Other objects which transform as covariant vectors are the differential operator $\nabla = (\partial_1,\dots,\partial_n)$ with $\partial_\alpha:=\frac{\partial}{\partial x^\alpha}$ (this follows from the chain rule) and the basis vectors $\mathbf{e_i}: \mathbf{{e'}}_i=J^{-1}\mathbf{e}_i$. They are all called covariant (see http://en.wikipedia.org/wiki/Covariant_transformation ).

Higher dimensional covariant, contravariant (or both), with several indices both up and down, are defined as more complex mappings from several copies of your vector space to the real (complex) numbers. Although there are precise definitions, physicists and engineers often skirt around these technicalities.

Hope this helps.

• Thank you for clearing this up. I was interpreting the operation ∂f∂x=(fx,fy,fz) as differentiating f with respect to the vector as a whole – AbeautifullTheorem Nov 23 '14 at 5:12
• @alonsos - contravariant and covariant vectors are used in fluid mechanics - physics.stackexchange.com/questions/232799/… – gansub Jul 7 '16 at 3:02