Derivative of dot product confusion

derivativesinner-productsmultivariable-calculus

I know this may be trivial but I don't know how to word the question to find a proper explanation online.

Given $\mathbf{y}\in\mathbb{R^n}$ and $\mathbf{x}\in\mathbb{R^n}$, what would be the derivative of $f(\mathbf{x}) = \mathbf{x}\cdot\mathbf{y}$?

My intuition from dealing with derivatives with scalars tells me that we treat $\mathbf{y}$ as a constant, and the derivative of $f$ would simply be $\mathbf{y}$. However, I am wondering if my thought process is correct; in another word, would the same method dealing with scalars apply to dot product?

Best Answer

Yes!

  1. If $f(\mathbf{x}) = \mathbf{x}\bullet \mathbf{y}$, then $f^\prime(\mathbf{x}) = \mathbf{y}$.

  2. To see this, first use the definition of derivative: $$f^\prime(\mathbf{x}) = \left[\frac{\partial}{\partial x_k} f(\mathbf{x})\right]_k$$

    (The total derivative can be defined as a vector of partial derivatives.)

  3. Then look at a specific component $k$ of the derivative and expand the definition of dot product: $$\frac{\partial}{\partial x_k} f(\mathbf{x}) = \frac{\partial}{\partial x_k} \mathbf{x}\bullet \mathbf{y} = \frac{\partial}{\partial x_k} \sum_i x_iy_i $$

  4. Now, only one of those terms in the sum depends on $x_k$. It is the term $x_ky_k$ (which occurs when $i=k$), and its derivative with respect to $x_k$ is just $y_k$.

  5. Hence the total derivative $f^\prime(\mathbf{x})$ is the vector $[y_k]_k$, or in other words $[y_1, y_2, \ldots] = \mathbf{y}$, as required.

And in general, the rules of calculus (such as the product rule) tend to generalize to matrix equations.

Related Question