# How do I differentiate this? (logarithm & chain)

I keep getting wrong results when trying to differentiate this:

${\partial \over \partial x} \ln{(x - \sqrt{x^2+a^2})}$

Thanks for hints!

-
$a$ being a constant why do you consider the partial derivative? –  Mercy Jun 20 '12 at 23:59
It's not a constant originally, sorry, I guess I confused the description... –  kralyk Jun 21 '12 at 0:28

There may be a typo in the question, since the thing inside the logarithm is $\le 0$. So we solve a different problem, finding the derivative of $\ln(|x-\sqrt{x^2+a^2}|)$, or more simply of $\ln(\sqrt{x^2+a^2}-x)$.

Differentiate, using the Chain Rule (twice). We get $$\frac{\frac{x}{\sqrt{x^2+a^2}}-1}{\sqrt{a^2+x^2}-x}.$$

Bring the top to a common denominator, and simplify. We get $$-\frac{1}{\sqrt{x^2+a^2}}.$$

Another variant that makes sense in the reals is finding the derivative of $\ln(x-\sqrt{x^2-a^2})$. The same method yields $-\frac{1}{\sqrt{x^2-a^2}}$.

-
Oh, I didn't notice the thing is <= 0. Makes me question the quality of the teacher who wrote those excercises... –  kralyk Jun 21 '12 at 0:29
Oh my god, I was actually right all along, I just didn't simplify the result properly. I'll be damned... Anyway, thank you. –  kralyk Jun 21 '12 at 0:35
@kralyk: Minor slips are part of life. That's why when grading, if a student makes a typo-like slip, I often give full marks if apart from the slip the argument is correct. A good reason not to have multiple choice tests (which I have never given). –  André Nicolas Jun 21 '12 at 0:36
The teacher who wrote these doesn't allow slips. Luckily, I'll be examined by another teacher, who has a more human attitude, like you... –  kralyk Jun 21 '12 at 0:45

You should be getting, firstly

$$\frac{\partial }{{\partial x}}\ln \left( {x - \sqrt {{x^2} + {a^2}} } \right) = \frac{{\frac{\partial }{{\partial x}}\left( {x - \sqrt {{x^2} + {a^2}} } \right)}}{{x - \sqrt {{x^2} + {a^2}} }}$$

Then

$$\frac{\partial }{{\partial x}}\left( {x - \sqrt {{x^2} + {a^2}} } \right) = \frac{\partial }{{\partial x}}x - \frac{\partial }{{\partial x}}\sqrt {{x^2} + {a^2}}$$

For

$$\frac{\partial }{{\partial x}}\sqrt {{x^2} + {a^2}} = \frac{\partial }{{\partial x}}{\left( {{x^2} + {a^2}} \right)^{\frac{1}{2}}}$$

use the power rule and the chain rule:

$$\frac{\partial }{{\partial x}}u{\left( {x,a} \right)^n} = nu{\left( {x,a} \right)^{n - 1}}u'\left( {x,a} \right)$$

I think you should be having either

$$\ln \left( {x + \sqrt {{x^2} + {a^2}} } \right)$$

or

$$\ln \left( {\sqrt {{x^2} + {a^2}} - x} \right)$$

as the original function, since your function is complex valued for any $x$. Anyways, the result will remain the same.

-

An other method: $y=\ln |x- \sqrt{x^2+a^2}|$ gives :

\begin{align*} e^y &= x-\sqrt{x^2+a^2}\\ (e^y-x)^2 &=x^2+a^2 \\ 2(e^y-x) \left(e^y\frac{dy}{dx} -1\right) &=2x \\ e^y\frac{dy}{dx}&= 1+\frac{x}{e^y-x}=\frac{e^y}{e^y-x}\end{align*} Since : $e^y-x=-\sqrt{x^2+a^2}$, this gives : $$\frac{dy}{dx}= - \frac{1}{\sqrt{x^2+a^2}}$$

-