try to derive sin(z) wrt z, where z is a vector

76 Views Asked by At

I am sitting right now on a exercie matrix calculus and i am little stuck up by the basics because i am not a mathematician rather a comeputer scientist and my question

Is $\sin(z)$ where $z \in {\mathbb R}^{n}$ same as \begin{bmatrix} \sin(z_1) \\ \sin(z_2) \\...\\ \sin(z_n) \end{bmatrix} ?

1

There are 1 best solutions below

0
On BEST ANSWER

$ \def\a{\alpha}\def\o{{\tt1}}\def\p{\partial} \def\L{\left}\def\R{\right} \def\LR#1{\L(#1\R)} \def\vecc#1{\operatorname{vec}\LR{#1}} \def\Diag#1{\operatorname{Diag}\LR{#1}} \def\trace#1{\operatorname{Tr}\LR{#1}} \def\qiq{\quad\implies\quad} \def\grad#1#2{\frac{\p #1}{\p #2}} \def\m#1{\left[\begin{array}{r}#1\end{array}\right]} $Let $f(\a)$ denote any function of a scalar variable $(\a)\,$ and $\,f'\!=\grad{f}{\a}\;$ its derivative.

This relationship is best expressed in differential form $\,(df=f'\,d\a)\;$ because when the function is applied elementwise to a vector argument $(a)$ it is the differential relationship which holds, i.e.
$$\eqalign{ f &= f(a),&\quad g = f'(a) \\ df &= g\odot da \\ }$$ where $\odot$ denotes the elementwise/Hadamard product. But recall that an elementwise product between vectors can be replaced by converting one of the vectors into a diagonal matrix, e.g. $$\eqalign{ G &= \Diag{g} \qiq Ga = g\odot a \\ }$$ Applying this substitution to the differential allows one to recover the gradient $$\eqalign{ df &= G\,da \\ \grad{f}{a} &= G \;=\; \Diag{f'(a)} \\ }$$ Remember, the above analysis applies to any function. In this particular problem $$\;f=\sin,\quad f'\!=\cos \\$$