# Derivative of remainder function.

I cannot find a derivative of remainder function (i.e. derivative of a(x) mod b(x) with respect to x, and x is a real number and a(), b() is also real-valued functions) in tables of derivatives. Without the loss of generality, we may assume (and it desired at all), that continuous approximation is acceptable.

I note, that (a(x) mod const)' ~ a'(x), (c(x) mod c(x))' = 0, but still I can't conclude form of desired right hand side (a(x) mod b(x))' -> ? function from these borderline cases (maybe dimensional method or method of indefinite coefficients in some form is applicable, but I have not an intuitions of how).

What is the generalized (in sense of continuity) form of remainder derivative?

I mean a remainder function as presented on x86/x86-64 architectures (FPREM and FPREM1).

• For even mildly general $a(x)$, $b(x)$ there seems to be no natural definition of remainder function. – André Nicolas Feb 11 '14 at 18:06
• @AndréNicolas It's incredible. I intuitively feel that the solution is expressed in terms of elementary functions or even of couple of multiplications, additions, subtractions and divisions of operands and its first derivatives. – Orient Feb 11 '14 at 18:08
• @MPW I think there are at least two cases: when lhs < rhs and vice-versa. – Orient Feb 11 '14 at 18:30
• There is a standard definition of the remainder when $a(x)$ and $b(x)$ are polynomials. So any conjectured answer should probably give the "right thing" for polynomials. – André Nicolas Feb 11 '14 at 18:32
• @AndréNicolas Interesting note. I'll try to find the solution for polinomials. – Orient Feb 11 '14 at 18:33

## 1 Answer

How are you defining "$a(x) \mod b(x)$"? Is it something like $a(x) - b(x)[a(x)/b(x)]$ (perhaps assuming $a,b>0$)? If so, and if $a,b$ are continuous, then I would think it is $a'(x)$ (where it exists) since $[\cdot]$ is mostly piecewise constant, right? Of course, there will be holes in the domain of this derivative where jumps occur in the function ($a \mod b$) being differentiated.

EDIT: Oh, I see I drew the wrong conclusion. Since $[\cdot]$ is mostly constant, this means that the derivative will be $a'(x) - b'(x)[a(x)/b(x)]$ where it exists. Better?

• If $[\cdot]$ is constant regardless of constancy of an argument, than derivative is $a'(x) - [a(x)/b(x)] \cdot b'(x)$ except the points, where $a(x) = n \cdot b(x)$ for some natural $n$. Isn't it? – Orient Feb 11 '14 at 18:47
• Yes, I just realized that and have already edited my answer. You are correct. – MPW Feb 11 '14 at 18:52
• $a'(x)$ is an answer only when $a(x) < b(x)$ – Orient Feb 11 '14 at 18:53
• @Dukales: The derivative could still exist where $a=n\cdot b$, as long as $[a/b]$ doesn't jump there. – MPW Feb 11 '14 at 18:54
• Hmm... $[a / b]$ difenitely have steps when dividend growth and passes the points of multiplicity with respect to divisor. In such points the quotient have integer values. – Orient Feb 11 '14 at 18:58