# Derivative of primitive function in high dimension

Suppose $$x \in \mathbb{R}^n$$, and $$f : \mathbb{R} \rightarrow \mathbb{R}$$, $$g :\mathbb{R}^n \rightarrow \mathbb{R}$$ are two functions. $$F(u)$$ is the primitive function of $$f$$, $$F(u) = \int_0^u f(v) dv$$.

I want to compute the gradient of $$F(g(x))$$. I know that I should use the chain rule, but I couldn't understand chain rule in higher dimensions.

The answer is $$(F'(g(x))\frac {\partial g} {\partial x_1},F'(g(x))\frac {\partial g} {\partial x_2},..., F'(g(x))\frac {\partial g} {\partial x_n})$$ $$=(f(g(x))\frac {\partial g} {\partial x_1},f(g(x))\frac {\partial g} {\partial x_2},..., f(g(x))\frac {\partial g} {\partial x_n})$$
Let $$h(x)=F(g(x))$$. The multivariate chain rule states $$dh=\frac{\partial h}{\partial dx^i}dx^i$$, with implicit summation over repeated indices. By the univariate chain rule, $$\frac{\partial h}{\partial x^i}=f(g(x))\frac{\partial g}{\partial x^i}$$, so $$dh=f(g(x))\frac{\partial g}{\partial x^i}dx^i$$. In particular, $$\nabla h$$ is the vector whose $$i$$th component is the $$dx^i$$ coefficient, so $$\nabla h=f(g)\nabla g$$, in agreement with @KaviRamaMurthy's answer.