# Derivative of $\frac{ax}{\sqrt{x^2+a^2}}$

It's being a long time since I have done maths, but now for image processing I am trying to find the derivative of the following function respect to $x$: $$\frac{ax}{\sqrt{x^2+a^2}}$$ where $a$ is a constant.

-
Is $a$ a constant? –  Arturo Magidin May 29 '12 at 20:39
yes a is a constant –  hevi May 29 '12 at 20:41
by the way, this is the Perona-Malik diffusion function –  hevi May 30 '12 at 7:24

You can use the Quotient Rule, or the Product Rule and the Chain Rule. We have: $$f(x) = \frac{ax}{\sqrt{x^2+a^2}}$$ So: \begin{align*} \frac{df}{dx} &= \frac{\sqrt{x^2+a^2}(ax)' - ax\left(\sqrt{x^2+a^2}\right)'}{\sqrt{x^2+a^2}^2}\\ &= \frac{a\sqrt{x^2+a^2} - ax\left(\frac{2x}{2\sqrt{x^2+a^2}}\right)}{x^2+a^2}\\ &= \frac{a\sqrt{x^2+a^2} - \frac{ax^2}{\sqrt{x^2+a^2}}}{x^2+a^2}\\ &= \frac{a(x^2+a^2) - ax^2}{(x^2+a^2)^{3/2}}\\ &= \frac{a^3}{(x^2+a^2)^{3/2}}. \end{align*}

-

You could use the rule for the derivative of a ration, of course: $$\left(\frac{u}{v}\right)'=\frac{u'v-v'u}{v^2}$$ however, such examples involving radicals are usually easily handled by taking logarithm as the first step and keeping in mind the chain rule $$\log{\left(u(x)\right)}=\frac{u'(x)}{u(x)}$$ from there on:

$$f(x)=\frac{ax}{\sqrt{x^2+a^2}}$$ $$\log{f(x)} = \log{a}+\log{x}-\frac{1}{2}\log{\left(x^2+a^2\right)}$$ $$\frac{f'(x)}{f(x)}=\frac{1}{x}-\frac{x}{x^2+a^2}$$ $$f'(x)=\frac{a}{\sqrt{x^2+a^2}}-\frac{ax^2}{\sqrt{\left(x^2+a^2\right)^3}}=\frac{a^3}{\sqrt{\left(x^2+a^2\right)^3}}$$

-
Your formula for derivative of a quotient has the wrong denominator on the right hand side. Should be $v^2$, not $u^2$. –  Arturo Magidin May 29 '12 at 20:55
corrected, thank you for pointing out –  Valentin May 29 '12 at 21:00

To beat this further into the ground, here's a way to make the differentiation easy by doing a little up front algebra.

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

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

Now the derivative is an easy power rule computation:

$$\left(-\frac{1}{2}\right)\left(a^{-2} + x^{-2}\right)^{-\frac{3}{2}}\left(-2x^{-3}\right)$$

-

Supposing that a is constant according to quotient rule $$\left(\frac{ax}{\sqrt{x^2+a^2}}\right)'=\frac{a\sqrt{x^2+a^2}-ax\frac{1}{2\sqrt{x^2+a^2}}2x}{x^2+a^2}=\frac{a\sqrt{x^2+a^2}-ax^2\frac{1}{\sqrt{x^2+a^2}}}{x^2+a^2}=\frac{a^3}{(x^2+a^2)^{\frac{3}{2}}}$$

-

I like to use product rule when dealing with derivatives of rational functions. This way you need to remember only one rule instead of two.

$$\left(\frac{ax}{\sqrt{x^2+a^2}}\right)' = a(x(x^2+a^2)^{-1/2})' = a(-x^2(x^2+a^2)^{-3/2}+(x^2+a^2)^{-1/2} )$$

which can be simplified to

$$\frac{a^3}{(x^2+a^2)^{3/2}}$$

-

Let us suppose that 'a' is a constant. Making the substitution, $$x^{2} + a^2 = t$$ we have upon differentiating $$\frac{\mathrm{d} (x^{2} + a^2)}{\mathrm{d} t} = \frac{\mathrm{d} t}{\mathrm{d} t} \\ \\ \Rightarrow 2x\frac{\mathrm{d} x}{\mathrm{d} t} = 1 \\ \Rightarrow 2xdx = dt \\ \Rightarrow xdx = dt/2$$ Using the substitution in the integral, it reduces to $$a/2\int 1/\sqrt{t} dt \\ = a/2 \frac{t^{(-1/2)+1}}{(-1/2)+1} \\ = a/2 \frac{t^{1/2}}{1/2} \\ = at^{1/2}$$ Using the value of t $$= a\sqrt{x^{2}+a^{2}}$$

-
You appear to have integrated when the questions asks for the derivative, I don't think this an answer to the question that was actually asked. –  Tom Oldfield Nov 21 '12 at 16:33
I read that the question asked for differentiation after I did the integration. And since I suck at LaTeX, I couldn't let half an hour of figuring brackets go waste. –  wamiq reyaz Nov 22 '12 at 8:16