<s>[INST] Spivak Calculus, Ch 10, problem 32b: Can we use Leibniz's formula to calculate $f^{(k)}(x)$ if $f(x)=\frac{1}{x^2-1}$? Spivak's Calculus, Chapter 10 on Differentiation, problem 32:



*What is $f^{(k)}(x)$ if

a)$f(x) = \frac{1}{(x-1)^n}$
*b) $f(x)=\frac{1}{x^2-1}$

My question regards part $b)$.
$a)$ can be solved quite easily if you use the conclusion of a previous problem (30), which shows

If $f(x)=x^{-n}$ for $n \in \mathbb{N}$ then
$$f^{(k)}(x)=(-1)^k\frac{(n+k-1)!}{(n-1)!}x^{-n-k}\tag{1}$$

$$g(x)=f(x+1)=x^{-n}$$
$$g^{(k)}(x)=f^{(k)}(x+1)=(-1)^k\frac{(n+k-1)!}{(n-1)!}x^{-n-k}$$
$$g^{(k)}(x-1)=f^{(k)}(x)=\frac{d^{k} \frac{1}{(x-1)^n}}{dx^k}=(-1)^k\frac{(n+k-1)!}{(n-1)!}(x-1)^{-n-k}\tag{2}$$
Similarly, we can show that
$$\frac{d^k \frac{1}{(x+1)^n}}{dx^k}=(-1)^k\frac{(n+k-1)!}{(n-1)!}(x+1)^{-n-k}\tag{3}$$
Now for part b).
We can rewrite $f(x)=\frac{1}{x^2-1}$ in two different ways:
$$f(x)=\frac{1}{x+1}\cdot \frac{1}{x-1}\tag{4}$$
$$f(x)=\frac{1}{2} \left ( \frac{1}{x-1}-\frac{1}{x+1} \right )\tag{5}$$
Spivak's solution manual differentiates $(5)$.
$$f^{(k)}(x)=\frac{1}{2} \left ( \frac{d^k \frac{1}{(x-1)^n}}{dx^k} - \frac{d^k \frac{1}{(x+1)^n}}{dx^k} \right )$$
So we can just sub in $(2)$ and $(3)$:
$$f^{(k)}(x)=\frac{1}{2}(-1)^k\frac{(n+k-1)!}{(n-1)!}((x-1)^{-n-k}-(x+1)^{-n-k})\tag{6}$$
My question is: can we apply Leibniz's formula to differentiate $(4)$?
Leibniz's formula tells us that
$$(f \cdot g)^{(n)}(x)=\sum_{k=0}^n \binom{n}{k}f^{(k)}(x) \cdot g^{(n-k)}(x)$$
If we apply this to $f(x)=\frac{1}{x+1}\cdot \frac{1}{x-1}$ then we get
$$f^{(n)}(x)=\sum_{k=0}^n \left [(-1)^k \frac{k!}{0!}(x-1)^{-1-k} \right ] \left [(-1)^{n-k} \frac{(n+k)!}{0!}(x+1)^{-1-k}  \right ]$$
$$= \sum_{k=0}^n \binom{n}{k}(-1)^nk! (n+k)! (x^2-1)^{-1-k}\tag{7}$$
Differentiating the sum in $(5)$ was the easier route. But is the calculation of differentiating $(4)$ correct? Is one route better than the other?
 [/INST] The calculation can be done in both ways. On the one hand we have
\begin{align*}
\color{blue}{f^{(k)}(x)}&=\left(\frac{1}{x^2-1}\right)^{(k)}\\
&=\frac{1}{2}\left(\frac{1}{x-1}-\frac{1}{x+1}\right)^{(k)}\\
&=\frac{1}{2}\left(\left((x-1)^{-1}\right)^{(k)}-\left((x+1)^{-1}\right)^{(k)}\right)\\
&=\frac{1}{2}\left((-1)(-2)\cdots(-1-(k-1))(x-1)^{-1-k}\right.\\
&\qquad\qquad\left.-(-1)(-2)\cdots(-1-(k-1))(x+1)^{-1-k}\right)\\
&=\frac{1}{2}\left((-1)^kk!(x-1)^{-1-k}-(-1)^kk!(x+1)^{k+1}\right)\\
&\,\,\color{blue}{=\frac{(-1)^kk!}{2}\left(\frac{1}{(x-1)^{k+1}}-\frac{1}{(x+1)^{k+1}}\right)}\tag{1}
\end{align*}
On the other hand using the general Leibniz rule we obtain

\begin{align*}
\color{blue}{f^{(k)}(x)}&=\left(\frac{1}{x^2-1}\right)^{(k)}\\
&=\left(\frac{1}{x-1}\cdot\frac{1}{x+1}\right)^{(k)}\\
&=\sum_{j=0}^k\binom{k}{j}\left(\frac{1}{x-1}\right)^{(j)}\left(\frac{1}{x+1}\right)^{(k-j)}\\
&=\sum_{j=0}^k\binom{k}{j}\frac{(-1)^jj!}{(x-1)^{j+1}}\,\frac{(-1)^{k-j}(k-j)!}{(x+1)^{k-j+1}}\\
&=\frac{(-1)^kk!}{(x+1)^{k-1}}\,\frac{1}{x-1}\sum_{j=0}^k\left(\frac{x+1}{x-1}\right)^j\\
&=\frac{(-1)^kk!}{(x+1)^{k-1}}\,\frac{1}{x-1}\,\frac{1-\left(\frac{x+1}{x-1}\right)^{k+1}}{1-\frac{x+1}{x-1}}\\
&=\frac{(-1)^kk!}{(x+1)^{k-1}}\,\frac{1-\left(\frac{x+1}{x-1}\right)^{k+1}}{-2}\\
&\,\,\color{blue}{=\frac{(-1)^kk!}{2}\left(\frac{1}{(x-1)^{k+1}}-\frac{1}{(x+1)^{k+1}}\right)}\tag{2}
\end{align*}
in accordance with (1).

Obviously the first way is more convenient, since we obtain immediately the closed form (1). In (2) we have to cope with a sum and to apply the formula for finite geometric sums till we finally obtain the same form as in (1).
</s>