Let $\mathcal{A} \colon \mathbb{R}^{n} \to \mathbb{R}^{m}$ be a linear operator and $h \colon \mathbb{R}^{n} \to \mathbb{R}$ be a twice continuously differentiable function. Compute the gradient of the following functions: \begin{align} f \left( x , y \right) & = \left\langle y , \nabla h \left( x \right) \right\rangle , \\ g \left( x , z \right) & = \dfrac{1}{2} \left\lVert \mathcal{A}^{*} \left( \mathcal{A} x - z \right) \right\rVert ^{2} , \end{align} where $y \in \mathbb{R}^{n}$ and $z \in \mathbb{R}^{m}$ are given.
It can be seen that $\partial_{y} f \left( x , y \right) = \nabla h \left( x \right)$. However, for $\partial_{x} f \left( x , y \right)$ I do not know how to start. If $\nabla h \left( x \right) = \mathcal{A} x$ for example, then I can rewrite $f \left( x , y \right) = \left\langle \mathcal{A}^{*} y , x \right\rangle$ and so $\partial_{x} f \left( x , y \right) = \mathcal{A}^{*} y$. But it's not always the case as I have no further information on $h$.
For $g$ I rewrite as \begin{align} g \left( x , z \right) & = \dfrac{1}{2} \left\lVert \mathcal{A}^{*} \mathcal{A} x \right\rVert ^{2} + \dfrac{1}{2} \left\lVert z \right\rVert ^{2} + \left\langle \mathcal{A}^{*} \mathcal{A} x , \mathcal{A}^{*} z \right\rangle \end{align} and so $\partial_{x} g \left( x , z \right) = \mathcal{A}^{*} \mathcal{A} x + \mathcal{A}^{*} \mathcal{A} \mathcal{A}^{*} z , \partial_{z} g \left( x , z \right) = z + \mathcal{A} \mathcal{A}^{*} \mathcal{A} x$. These formula looks really weird to me so I'm not really sure that I am corrected