1. Is this right?

I saw a question which puzzled me earlier on this forum (I apologize, but I can't find the original discussion, it's buried a month or so back).

Find a Real --> Real function f which has the following properties:

f(0) = 0 ; f is differentiable at x = 0, and has f '(0) = 1.

and:

For any positive number a, f is NOT monotonically increasing over the interval (0,a).

Well, I just had an inspiration:

$f(x) = \begin{cases}x & for\ x\ irrational \\ x - \cfrac{1}{b} & for\ rational\ x\ where\ x= \cfrac{a}{b}\ in\ lowest\ terms\end{cases}
$

I think it's fairly easy to show that this function is NOT monotonically increasing over any interval (0,a). Just tell me, please: is this right? Am I right to assert that the derivative at 0 is 1?

2. I don't know whether your function is right or not, but the way I see it, you're overcomplicating things. Wouldn't the function f(x) = x for x irrational and 0 for x rational
work just as well? Near 0, it will behave almost exactly the same, and that's all you're looking for.
Actually, on second thought neither function works for this problem. Let's take your function. By the traditional epsilon-delta definition of the derivative, you would need that given any epsilon=e>0, find d>0 s.t. if |x|<d, then |(f(x)-x)/x|<e. But within the set {x| 0<|x|<d}, there is a rational x=1/b in lowest terms (let's say it's positive - negative case is similar), for which |f(x)-x)/x|=|(1/b)/(1/b)|=1 which is by no means less than epsilon. The function I suggested fails for a similar reason.
Now - if there was a way to constrain a sin curve so that it would bouce between x(x+1) and -x(x-1) (both of which have a derivative of 1 at 0), and give this sin curve the property of sin(1/x) s.t. it will oscillate more and more rapidly as it approaches 0 (thus making monotonicity impossible), it might be possible to tame the oscillation enough in order to make the derivative exist. Of course, I'm not sure, and i'll let you do the legwork to figure it out. Who would've guessed - ender wiggin telling mazer what to do . . .

3. HAHAHAHA, great job on the reference. And wonderful theatrics there.

You got me. It doesn't work, damn.

But, on the last thread, I remember everyone talking about that oscillating thing, but no one put up a solution. I thought about it and just couldn't make the function, but I'll sleep on it tonight.

4. solution

OK I've got it figured out.
We want our modified sin function to oscillate between $x^2+x$ and $-x^2+x$. So, it should center around the average of these two, aka, $x$. So it'll be of the form $x+g(x)sin(1/x)$. Now, our amplitude needs to keep us always in sync with the upper and lower bounds, so it needs to be half of the difference between them, aka $x^2$. So our function is $x+x^2sin(1/x)$.

I'm certain that this works.

If you want to challenge yourself, try to find a function which is C-infinity at 0, and has all derivatives equal to 1 there. It's slightly more challenging, but very feasible.