Differentiation through product of variables

71 Views Asked by At

I am working on a problem connected to shallow water waves. I have a vector:

$U = \begin{bmatrix} h \\ h \cdot v_1\\ h \cdot v_2\end{bmatrix}$

and a function

$f(U) = \begin{bmatrix} h \cdot v_1 \\ h \cdot v_1^2 + 0.5\cdot gh^2\\ h \cdot v_1 \cdot v_2\end{bmatrix}$

I now want to calculate the Jacobian Matrix of $f(U)$.

However, I am lost at how to calculate the partial derivatives when it comes to differentiating through a product. I.e.:

$\frac{\partial (h \cdot v_1^2 + 0.5 \cdot gh^2)}{\partial (h \cdot v_1)} = \frac{\partial (h \cdot v_1^2) }{\partial (h \cdot v_1)} + \frac{\partial (0.5 \cdot gh^2)}{\partial (h \cdot v_1)} = v_1 + ? \dots$
or

$\frac{\partial (h \cdot v_1^2 + 0.5 \cdot gh^2)}{\partial (h \cdot v_2)} = \frac{\partial (h \cdot v_1^2) }{\partial (h \cdot v_2)} + \frac{\partial (0.5 \cdot gh^2)}{\partial (h \cdot v_2)} = \dots$

Googling it is really difficult and brought no result, since I only ever find explanations for the product rule... Maybe someone here could enlighten me! Any kind of pointer in the right direction is highly appreciated! Thanks so much in advance!

2

There are 2 best solutions below

0
On BEST ANSWER

In the final analysis your $f$ is a function $f:\>{\mathbb R}^3\to{\mathbb R}^3$ taking the variables $h$, $v_1$, $v_2$ as input and producing three scalar values $$u:=hv_1,\quad v:=hv_1^2+{g\over2}h^2,\quad w:=hv_1v_2$$ as output, whereby $g$ seems to be some constant. By definition the Jacobian of $f$ is the matrix of partial derivatives $$\left[\matrix{u_h& u_{v_1}&u_{v_2}\cr v_h& v_{v_1}&v_{v_2}\cr w_h& w_{v_1}&w_{v_2}\cr}\right]=\left[\matrix{v_1& h&0\cr v_1^2+gh& 2v_1h&0\cr v_1v_2&hv_2&hv_1\cr}\right]\ .$$

4
On

To do this, simply get rid of the "products of variables" by a substitution.

First, set $w_1 = h v_1$ and $w_2 = h v_2$.

Next, solve for $v_1 = w_1 / h$ and $v_2 = w_2 / h$.

Next, substitute for $v_1,v_2$ and simplify:

$U = \begin{bmatrix} h \\ w_1\\ w_2\end{bmatrix}$

$f(U) = \begin{bmatrix} w_1 \\ w_1^2 \bigm/ h + 0.5\cdot gh^2\\ w_1w_2 \bigm/ h \end{bmatrix}$

Next, compute the Jacobian Matrix for $f(U)$ in the usual way.

Finally, substitute for $w_1$ and $w_2$ and simplify.

Remarks: In your comment you ask about the "very first" entry of the Jacobian matrix.

The meaning of partial derivatives depends on the full set of coordinate variables, not just on a single variable.

In your problem, you have informed us that the coordinate variables are $h$, $hv_1$, $hv_2$. I have simply subsituted these with one letter symbols $h$, $w_1$, $w_2$, respectively.

The meaning of the partial derivative $\frac{\partial w_1}{\partial h}$, using the coordinate variables you specified, means that you hold $w_1$ and $w_2$ constant and, while holding them constant, you vary $h$ and take the derivative of $w_1$ with respect to $h$. The result is zero, because $w_1$ has been held constant.

You can translate this back into your own notation: the meaning of $\frac{\partial hv_1}{\partial h}$ is that you hold $hv_1$ and $hv_2$ constant and, while holding them constant, you take the derivative of $hv_1$ with respect to $h$. Since $hv_1$ is held constant, its derivative is zero.

In other words, the definition of the partial derivative $\frac{\partial}{\partial h}$ is dependent on which other two coordinates you choose: its definition with coordinates $w_1,w_2$ is not the same as its definition with coordinates $v_1,v_2$. You can verify this for yourself if you look up the actual definition of partial derivatives, as a limit of difference quotients. See here for a discussion.