# $\frac{\partial f_i}{x_j}=\frac{\partial f_j}{x_i}\implies(f_1,\ldots,f_n)$ is a gradient

I was reading a solution when I came across this statement.

So $$\frac{\partial f_i}{x_j}=\frac{\partial f_j}{x_i}.$$ Then there exists a differentiable function $g$ on $\mathbb{R}^n$ such that $\frac{\partial g}{\partial x_i}=f_i$.

Why is this true?

-

The following proofs assume 2 variables.

### Proof of necessary condition:

If $(f_i, f_j)$ is the gradient of a function $F$, it means that:

$$\frac{\partial{F}}{\partial{x_i}} = f_i \\ \frac{\partial{F}}{\partial{x_j}} = f_j$$

Now, if $F$ has continuous second partial derivatives, then according to Clairaut's theorem:

$$\frac{\partial^2{F}}{\partial{x_i}\partial{x_j}} = \frac{\partial^2{F}}{\partial{x_j}\partial{x_i}}$$

Therefore:

$$\frac{\partial{f_i}}{\partial{x_j}} = \frac{\partial{f_j}}{\partial{x_i}}$$

### Proof of sufficient condition:

The function $F$, if it exists, has the property:

$$\frac{\partial{F}}{\partial{x_i}} = f_i$$

By integrating with $x_j$ constant:

$$F = \int_{x_{i_0}}^{x_i} f_i \, dx_i + R(x_j) \tag{1}$$

Now take partial derivatives of both sides with respect to $x_j$:

$$\frac{\partial{F}}{\partial{x_j}} = \frac{\partial}{\partial{x_j}}\int_{x_{i_0}}^{x_i} f_i \, dx_i + R'(x_j) = f_j$$

$$\frac{\partial{F}}{\partial{x_j}} = \int_{x_{i_0}}^{x_i} \frac{\partial{f_i}}{\partial{x_j}} \, dx_i + R'(x_j) = f_j$$

Using the assumption that $\displaystyle \dfrac{\partial f_i}{\partial x_j} = \dfrac{\partial f_j}{\partial x_i}$:

$$\frac{\partial{F}}{\partial{x_j}} = \int_{x_{i_0}}^{x_i} \frac{\partial{f_j}}{\partial{x_i}} \, dx_i + R'(x_j) = f_j$$

Which we can write as:

$$\left. f_j \right|_{x_{i_0}}^{x_i} + R'(x_j) = f_j$$

Therefore:

$$R'(x_j) = f_j(x_{i_0}, x_j)$$

And:

$$R(x_j) = \int_{x_{j_0}}^{x_j} f_j \, dx_j$$

Plug in back into (1): $$F = \int_{x_{i_0}}^{x_i} f_i \, dx_i + \int_{x_{j_0}}^{x_j} f_j \, dx_j$$

Therefore, we have shown that $F$ exists.

-
Isn't that the converse of what I asked? – nael Jun 4 '12 at 1:43
@nael - I added proofs for both necessary and sufficient conditions. – Ayman Hourieh Jun 4 '12 at 2:08
You changed $\displaystyle\frac{\partial f}{\partial x_{\color{Blue}j}}$ to $\displaystyle\frac{\partial f}{\partial x_{\color{Red}i}}$ inside the integral (I'd specify which line but you only tagged a single equation!), and strangely you seem to operate as if there are only two variables, $x_i$ and $x_j$, when really there are $n$ variables: $x_1,\cdots,x_n$, with $i$ and $j$ merely indexing them. – anon Jun 4 '12 at 2:21
@anon: The change inside the integral is using the assumption that $\displaystyle\frac{\partial f_i}{\partial x_j} = \displaystyle\frac{\partial f_j}{\partial x_i}$, so I think that's ok. – Jason DeVito Jun 4 '12 at 2:25
@anon - Jason's explanation is right. And yes my proof assumes 2 variables. – Ayman Hourieh Jun 4 '12 at 2:31