# Derivative of a non-continuous function?

I am having trouble with understanding the following question:

Find the derivative of the given function: $$f(x)=\frac{x}{2x+\frac{1}{3x+1}}$$

I have always thought that in order for a function to have a derivative, it must be continuous. This function is clearly undefined for $f(-\frac{1}{3})$. So, how is it possible for it to have a derivative?

Ignoring that, I have tried to solve for the derivative but my textbook is disagreeing with me on the answer. Here's what I did

$$f(x)=\frac{x}{2x+\frac{1}{3x+1}}$$

$$f(x)=\frac{x}{\frac{6x^2+2x+1}{3x+1}}$$

$$f(x)=\frac{x}{1}\cdot\frac{3x+1}{6x^2+2x+1}$$

$$f(x) =\frac{x}{1}\cdot\frac{3x+1}{2x(3x+1)+1}$$

$$f(x) =\frac{x}{1}\cdot\frac{1}{2x+1}$$

$$f(x) =\frac{x}{2x+1}$$

$$f'(x) =\frac{(2x+1)(x)'-(x)(2x+1)'}{(2x+1)^2}$$

$$f'(x) =\frac{1}{(2x+1)^2}$$

-
What did you do to get from the 4th line to the 5th? – Dennis Gulko Oct 6 '12 at 20:10
Factored out the common factor of $2x$ from $6x^2+2x$ – Richard Oct 6 '12 at 20:11
Not the corrected if $f(x)=\frac{x}{1}\cdot\frac{3x+1}{2x(3x+1)+1}$ else $f(x)=\frac{x}{1}\cdot\frac{1}{2x+1}$ – Madrit Zhaku Oct 6 '12 at 20:14
It's good to check your algebra by plugging in a value from time to time, especially when you're getting an answer which doesn't seem to work. Try $x=1$ in your first few steps and see if you can find where the problem has to be. – Alexander Gruber Oct 6 '12 at 20:15

The problem is with your algebra: $$\frac{3x+1}{2x(3x+1)+1}\ne\frac1{2x+1}\;,$$ as you can check by verifying that $(3x+1)(2x+1)\ne 2x(3x+1)+1$.

It’s true that $f$ isn’t defined everywhere and therefore isn’t differentiable everywhere, but it turns out to be differentiable almost everywhere, and the derivative is the same function everywhere that it’s defined.

-

HINT: $\frac{a+b}{c(a+b)+d}\neq\frac{1}{c+d}$

-
I realized that about 5 minutes after posting it. facepalm – Richard Oct 6 '12 at 20:19

The function has a derivative everywhere but at $-2/3$, that's okay. Your mistake is between step 4 and 5, you can't pull $3x + 1$ out like that.

-