# Derivative of $\log^{k}(x)$

What is the derivative of $f(x)= \log^{k}x$ where $k$ is a positive integer?

Update:

Hello I have found that $\log^k n$ = $(\log n)^k$

(Thomas H. Cormen, Introduction to Algorithms (2ed) p. 53 )

-
By $\log^k(x)$, do you mean $(\log x)^k$ or the log-base-$k$ of $x$? –  Isaac Jan 19 '11 at 2:56
It could be $log\circ\log\circ\dots\circ\log$, where $\log$ is iterated $k$ times. –  Andres Caicedo Jan 19 '11 at 3:15
as Andres Caicedo said, that notation is reserved for iterating the function n times rather than exponentiation. What he really means is $(\log x)^k$ –  Arjang Jan 19 '11 at 4:23
I don't agree that it's "reserved" for that meaning. But it could mean that, as well as $(\log x)^k$. –  Calle Jan 21 '11 at 16:17
@Arjang: while in most cases we use exponents like that to denote composition, some functions follow a different convention; e.g., $\sin^2(x)$ almost invariably means $(\sin x)^2$, and almost never $\sin(\sin(x))$. Trig and hyperbolic functions follow the "usual power, not composition" convention. While $\log$ and $\ln$ don't usually follow the same convention as trig functions, I've seen it more than once or twice. –  Arturo Magidin Jan 30 '11 at 20:43

Assuming $k$ is an exponent, use the chain rule, $f(x) = g(h(x))$, $\frac{d f}{d x} = \frac{d g}{d h} \frac{d h}{d x}$. In this case we have $g(h) = h^k$ and $h(x) = \log x$.

$$\frac{d}{dx} (\log x)^k = \frac{d}{d h} \left(h^k\right) \frac{d}{d x} \left(\log x \right) = k h^{k-1} \frac{d}{dx} \log x = k (\log x)^{k-1} \frac{d}{dx} \log x$$

Now, if $\log$ is the natural logarithm you get:

$$\frac{d}{dx} (\log x)^k = \frac{k}{x} (\log x)^{k-1}$$

If $\log$ is the base $b$ logarithm you get $\log x = \frac{\ln x}{\ln b}$ (denoting the natural logarithm by $\ln$):

$$\frac{d}{dx} \log^k x = k (\log x)^{k-1} \frac{d}{dx} \frac{\ln x}{\ln b} = k \frac{(\ln x)^{k-1}}{(\ln b)^{k-1}} \frac{1}{x \ln b} = k \frac{(\ln x)^{k-1}}{x (\ln b)^k}$$

EDIT: Given your source you probably want to use $b = 2$ in the formula above.

EDIT2: Changed notation from $\log^k x$ to $(\log x)^k$) for clarity.

Another way to derive the equation above is to use the product rule $f(x) = f_1(x)f_2(x)$, $f'(x) = f_1'(x)f_2(x) + f_1(x)f_2'(x)$. Since $f(x) = (\log x)^k = \log x \log x \cdots \log x$. Now, when you derive you get one term for every factor in the product, each term containing the derivative once. All the terms are equal so you can simply multiply by the number of terms ($k$) instead:

\begin{aligned} \frac{d}{dx} \left(\log x \right)^k = \left(\frac{d}{dx} \log x \right) \log x \cdots \log x \log x + \dots + \log x \log x \cdots \log x \left( \frac{d}{dx} \ \log x \right) = \\ = k \left( \frac{d}{dx} \log x \right) (\log x)^{k-1} \end{aligned}

which is the same expression as obtained above.

-

Use the chain rule (extra characters).

-