How to calculate the derivative of the following function?

69 Views Asked by At

How would you go about calculating the derivative d/dx of the below function f(x)?
a and c are scalars.

$f(x)=\phi(x)^T\phi(x)$, $\phi(x)=$$\begin{bmatrix}\sin(ax_1) \\ \sin(acx_2) \\ 2x_1 \\ 2cx_2\end{bmatrix}$

My guess would be the following (i.e. treating each element in the vector as its own function to the power of two, and spreading the derivative on two columns to get a Jacobian), but that's just a wild guess, as I have never worked with equations with such structure before.

$J_f(x) = \begin{bmatrix}a \cdot cos(2ax_1) & 0\\0 & ac \cdot cos(2acx_2)\\8x_1 & 0\\0 & 8c^2x_2\end{bmatrix}$

I usually always had an x vector inside of an equation, not individual elements of the variable vector mixed in one vector... Maybe I can/should somehow rewrite the equation so that there is a variable vector in there?

1

There are 1 best solutions below

0
On BEST ANSWER

The scalar function is written as $f(\mathbf{x})=\| \mathbf{z} \|^2$. The differential approach yields $$ df =2 \mathbf{z}^T d\mathbf{z} =2 \mathbf{z}^T \mathbf{J}d\mathbf{x} $$ where we have used the Jacobian matrix $\mathbf{J}$ defined as: $$ \mathbf{J} = \begin{pmatrix} a \cos(ax_1) & 0 \\ 0 & ac \cos(acx_2) \\ 2 & 0 \\ 0 & 2c \end{pmatrix} $$ The derivative is thus $ \frac{\partial f}{\partial \mathbf{x}} = 2 \mathbf{J}^T \mathbf{z}$ which is 2-by-1.