Jacobian of a scalar-valued function times a vector-valued function Let $g: \mathbb{R}^n \rightarrow \mathbb{R}$ and $\mathbf{h} : \mathbb{R}^n \rightarrow \mathbb{R}^m$, and define:
\begin{align}
\mathbf{f} : \mathbb{R}^n &\rightarrow \mathbb{R}^m\\
\mathbf{x} &\rightarrow g(\mathbf{x}) \mathbf{h}(\mathbf{x})
\end{align}
I now want to find the Jacobian of $\mathbf{f}$, so using the Product Rule I write:
\begin{equation}
\frac{\partial \mathbf{f}}{\partial \mathbf{x}} = \frac{\partial g}{\partial \mathbf{x}} \mathbf{h} + g\frac{\partial \mathbf{h}}{\partial \mathbf{x}}
\end{equation}
but this is obviously not correct because the dimensions don't add up. They would add up if I write $\mathbf{h} \frac{\partial g}{\partial \mathbf{x}}$ in the first term, but is this the correct answer?
It seems like I'm missing part of the product rule here.

It is correct in this order. You have to use a special type of product of a row with a column vector, the tensor product. Cf. wikipedia.
