# How many solutions are there to this equation involving the floor function: $(n+1)x-\lfloor nx \rfloor = c$?

How many solutions are there for this equation:

$(n+1)x-\lfloor nx \rfloor = c$

I can prove some basic properties of floors and ceiling, but here I'm stumped.

-
Are $n$ and $c$ both supposed to be fixed, given quantities, so that only $x$ is an indeterminate? –  Brian M. Scott Oct 10 '13 at 6:16

Let $y_1(x) = (n+1)x$ and $y_2(x) = c + \lfloor nx \rfloor$. You want to find $x^*$ such that $y_1(x^*) = y_2(x^*)$. Let's look now to $y_2(x)$:
$$y_2(x) = k + c ~~ \forall x \in \left[\frac{k}{n}, \frac{k+1}{n}\right), k \in \mathbb{Z}$$
So you want to solve, for each $k$, the following equation: $$(n+1)x = k + c ~~ \forall x \in \left[\frac{k}{n}, \frac{k+1}{n}\right)$$ The solution is: $$x^* = \frac{k+c}{n+1}$$ This solution is feaseble if $x^*$ is in the set $\left[\frac{k}{n}, \frac{k+1}{n}\right)$. Then:
$$\frac{k+c}{n+1} \geq \frac{k}{n} \wedge \frac{k+c}{n+1} < \frac{k+1}{n}$$ Assuming that $n \in \mathbb{N}$, then: $$n(k+c) \geq k(n+1) \wedge n(k+c) < (k+1)(n+1)$$ $$k \leq nc \wedge k > nc-n-1$$ So you have solutions for each $k$ integer in the set $\left(nc-n-1, nc\right]$.
The length of this set is $n+1$, so you have $n +1$ solutions.