# How to find gradient of $f(x)=-\sum_{i=1}^n \log x_i$

I am trying to find the gradient $\nabla f(x)\,\,$ of $\,f: \mathbb{R}^n\rightarrow\mathbb{R}$ of $$f(x)=-\sum_{i=1}^n \log x_i,$$ but I am getting stuck when it comes time to deal with the log.

I know there are several options for taking the derivative:

1) delta method, which involves basically applying the extreme value theorem. Add a small perturbation, and then isolating the parts of the function which involve an inner product of the perturbation with a function of the variable: $f(x+h)=f(x)+<\nabla f,h>+o(||h||)$ where $o(||h||)$ is a function such that the limit as h approaches 0 is zero (comes straight from the definition of differentiability);

2) vector calculus using chain rule.

Since the equation $f(x)$ is not expressed in a vector here, I figured it would be easier to do 1) via perturbation, so here's what I tried:

I try to add $h$ which is my perturbation to the vector $x$:

$f(x+h)= - \sum_{i=1}^n \log (x_i+h_i)$

But now here, there are not many options for taking the logarithm of the sum of two numbers. So, I'm wondering if maybe I can split this out into $\log (x_i) + \log(h_i)$ and just call my perturbation $log(h_i)$ instead of $h_i$?

Are there any other hints to finding the gradient of this function $f$?

• do you mean $f(x) = -\log x_1-\log x_2-...-\log x_n$?
– user
Apr 7 '18 at 7:26
• yes, isn't that what I have above? Apr 8 '18 at 20:45
• Yes I see, I asked only to be sure about that!
– user
Apr 8 '18 at 20:47

$$\frac{\partial f}{\partial x_i}=-\frac 1 {x_i}$$
$$\Delta f = \left(-\frac 1 {x_1},-\frac 1 {x_2},...,-\frac 1 {x_n}\right)$$
• that doesn't answer my question of how to find it using the "delta method". as I said in my question. I want to find it using $f(x+h)=f(x)+<\nabla f,h>+o(||h||)$ where $o(||h||)$ is a function such that the limit as h approaches 0 is zero (comes straight from the definition of differentiability); Apr 8 '18 at 20:46