Home » Floor

Tag: Floor

Consider the continuity of (-1)^[1/x]

Define:

    \[ f(x) = (-1)^{\left \lfloor \frac{1}{x} \right \rfloor} \qquad \text{for } x \neq 0, \]

where \lfloor \ \rfloor denotes the greatest integer function, or floor function. Sketch the graph of f(x) for -2 \leq x \leq -\frac{1}{5} and \frac{1}{5} \leq x \leq 2. Evaluate

    \[ \lim_{x \to 0^+} f(x) \qquad \text{and} \qquad \lim_{x \to 0^-} f(x). \]

Is it possible to define f(0) in a way that makes f(x) continuous at 0.


First, we sketch the graph of f on the requested intervals.

Rendered by QuickLaTeX.com

As x \to 0^+, f(x) alternates between +1 and -1.
As x \to 0^-, f(x) alternates between +1 and -1.

There is no way to define f(0) to make f continuous at 0 since f(x) will take both values +1 and -1 no matter how small we choose our \delta > 0. (So, if we were to try to define f(0) = 1, then for \varepsilon = \frac{1}{2} > 0 there is no \delta> 0 such that f(x) < \varepsilon whenever |x| < \delta, and similarly if we try to define f(0) = -1.)

Consider the limit and continuity of the floor function of (1/x)

Define:

    \[ f(x) = \left\lfloor \frac{1}{x} \right\rfloor \qquad \text{for } x \neq 0, \]

where \lfloor \ \rfloor denotes the greatest integer function, or floor function. Sketch the graph of f(x) for -2 \leq x \leq -\frac{1}{5} and \frac{1}{5} \leq x \leq 2. Evaluate

    \[ \lim_{x \to 0^+} f(x) \qquad \text{and} \qquad \lim_{x \to 0^-} f(x). \]

Is it possible to define f(0) in a way that makes f(x) continuous at 0.


First, we sketch the graph of f on the requested intervals.

Rendered by QuickLaTeX.com

As x \to 0^+, f(x) takes on arbitrarily large positive values.
As x \to 0^-, f(x) takes on arbitrarily large negative values.

There is no way to define f(0) to make f continuous at 0.

Establish some properties of the integral of the floor function

Define a function

    \[ f(x) =  \begin{dcases}     x - [x] - \frac{1}{2} & \text{if } x \notin \mathbb{Z} \\    0 & \text{if } x \in \mathbb{Z}. \end{dcases} \]

where [x] denotes the greatest integer less than or equal to x, also called the floor function.

Then, define a function

    \[ P(x) = \int_0^x f(t) \, dt \qquad \text{for all } x \in \mathbb{R}. \]

  1. Draw the graph of f(x) for x \in [-3,3] and prove that f is periodic with period 1.
  2. For 0 \leq x \leq 1, prove

        \[ P(x) = \frac{1}{2} (x^2 - x), \]

    and prove that P is also periodic with period 1.

  3. Give a formula for P(x) in terms of the floor of x.
  4. Find a c \in \mathbb{R} such that

        \[ \int_0^1 (P(t) + c) \,dt = 0. \]

  5. For the constant c \in \mathbb{R} from part (d), define

        \[ Q(x) = \int_0^x (P(t) + c) \, dt. \]

    Prove that Q is periodic with period 1 and that if 0 \leq x \leq 1, we have,

        \[ Q(x) = \frac{x^3}{6} - \frac{x^2}{4} + \frac{x}{12}. \]


  1. The graph of f is as follows:

    Rendered by QuickLaTeX.com

    Then, we prove that f is periodic with period 1.
    Proof. We compute to show f(x+1) = f(x) (where I’ve replaced Apostol’s notation [x] with \lfloor x \rfloor since this less likely to cause confusion, also we use the solution to this exercise in the second line)

        \begin{align*}  f(x+1) &= (x+1) - \lfloor x+1 \rfloor - \frac{1}{2} & (\lfloor x \rfloor \text{ denotes floor})\\  &= x - (\lfloor x \rfloor + 1) + \frac{1}{2} & (\lfloor x+1 \rfloor = \lfloor x \rfloor + 1)\\  &= x - \lfloor x \rfloor - \frac{1}{2} \\  &= f(x). \qquad \blacksquare \end{align*}

  2. Proof. First, we establish the requested formula,

        \begin{align*}  P(x) = \int_0^x f(t) \, dt &= \int_0^x \left( t - \lfloor t \rfloor - \frac{1}{2} \right) \, dt \\  &= \int_0^x t \, dt - \int_0^x \lfloor t \rfloor \, dt - \int_0^x \frac{1}{2} \, dt \\  &= \left. \frac{t^2}{2} \right|_0^x - \left. \frac{1}{2} \int_0^x & (\lfloor t \rfloor = 0 \text{ for all } x \in [0,1))\\  &= \frac{1}{2} (x^2 - x). \end{align*}

    This was the requested formula. Next, to show P is periodic with period 1, we show P(x+1) = P(x) for any x,

        \begin{align*}  P(x+1) = \int_0^{x+1} f(t) \, dt &= \int_0^1 f(t) \, dt + \int_1^{x+1} f(t) \, dt \\  &= P(1) + \int_0^x f(t+1) \, dt. \end{align*}

    Then, using the formula in the first part of (b) we have

        \[ P(x) = \frac{1}{2} (x^2 - x) \quad \implies \quad P(1) = \frac{1}{2} (1^2 - 1) = 0. \]

    Further, from part (a) we know f is periodic with period 1, so f(t+1) = f(t), and we have,

        \begin{align*}   P(x+1) &= 0 + \int_0^x f(t) \, dt \\   &= P(x), \end{align*}

    by definition of P(x). Thus, P is periodic with period 1. \qquad \blacksquare

  3. To express P(x) in terms of of \lfloor x \rfloor we compute as follows:

        \begin{align*}  P(x) = \int_0^x f(t) \, dt &= \int_0^1 f(t) \, dt + \int_1^2 f(t) \, dt + \cdots + \int_{\lfloor x \rfloor}^x f(t) \, dt \\  &= 0 + 0 + \cdots + \int_{\lfloor x \rfloor}^x f(t) \, dt \\  &= \int_0^{x - \lfloor x \rfloor} f(t) \, dt, \end{align*}

    where f(t + \lfloor x \rfloor) = f(t) since \lfloor x \rfloor is an integer by definition, and f has period 1, so f(t+n) = f(t) for any integer n. Continuing,

        \begin{align*}  P(x) &= \int_0^{x - \lfloor x \rfloor} \left( t - \lfloor t \rfloor - \frac{1}{2} \right) \, dt \\  &= \left. \frac{t^2}{2} \right|_0^{x - \lfloor x \rfloor} - \left. \frac{t}{2} \right|_0^{x - \lfloor x \rfloor}. \end{align*}

    Here, we know the \lfloor t \rfloor term in the integral is zero since \lfloor t \rfloor = 0 for all t \in [0, \lfloor x \rfloor ] since x - \lfloor x \rfloor < 1. Then,

        \begin{align*} P(x) &= \frac{1}{2} \left( \left( x - \lfloor x \rfloor\right)^2 - x + \lfloor x \rfloor \right) \\  &= \frac{1}{2} \left( x - \lfloor x \rfloor\right)^2 - \frac{1}{2} \left( x - \lfloor x \rfloor \right). \end{align*}

    This is the requested expression of P(x) in terms of \lfloor x \rfloor.

  4. Here we compute the integral, using the formula for P(x) we established in part (c), and solve for the requested constant c,

        \begin{align*}  \int_0^1 \left( P(t) + c \right) \, dt = 0 && \implies && \int_0^1 \left( \frac{1}{2} \left(t - \lfloor t \rfloor \right)^2 - \frac{1}{2}\left(t - \lfloor t \rfloor \right) + c \right) \, dt &= 0 \\ && \implies && \frac{1}{2} \int_0^1 t^2 \, dt - \frac{1}{2} \int_0^1 t \, dt + \int_0^1 c \, dt &= 0 \\ && \implies && \frac{1}{6} - \frac{1}{4} + c &= 0 \\ && \implies && c = \frac{1}{12}. \end{align*}

  5. First we give the proof that Q is periodic with period 1.
    Proof. We compute,

        \begin{align*}  Q(x+1) &= \int_0^{x+1} \left( P(t) + \frac{1}{12} \right) \, dt \\  &= \int_0^1 \left( P(t) + \frac{1}{12} \right) \,dt + \int_1^{x+1} \left( P(t) + \frac{1}{12} \right) \, dt \\  &= 0 + \int_0^x \left( P(t+1) \frac{1}{12} \right) \, dt & (\text{Exp/Cont of interval of int})\\  &= \int_0^x \left( P(t) + \frac{1}{12} \right) \, dt &(P \text{ is periodic with period } 1) \\  &= Q(x). \qquad \blacksquare \end{align*}

    Next, we establish the requested formula. If 0 \leq x \leq 1, we have

        \begin{align*}  Q(x) &= \int_0^x \left( P(t) + \frac{1}{12} \right) \, dt \\  &= \int_0^x \left( \frac{1}{2} \left( t - \lfloor t \rfloor\right)^2 - \frac{1}{2} \left( t - \lfloor t \rfloor \right) + \frac{1}{12} \right) \, dt \\  &= \frac{1}{2} \int_0^x t^2 \,dt - \frac{1}{2} \int_0^x t \, dt + \frac{1}{12} \int_0^x dt \\ \intertext{where all of the $\lfloor t \rfloor$ terms are 0 for $0 \leq t \leq 1$} \\  &= \left. \frac{t^3}{6} \right|_0^x - \left. \frac{t^2}{4} \right|_0^x + \left. \frac{t}{12} \right|_0^x \\  &= \frac{x^3}{6} - \frac{x^2}{4} + \frac{x}{12}.  \end{align*}

    as requested.

Prove a formula for the sum of [(na)/b] where a,b are relatively prime integers

Let a,b be relatively prime positive integers (i.e., they have no common factors other than 1). Then we have the formula

    \[ \sum_{n=1}^{b-a} \left[ \frac{na}{b} \right] = \frac{(a-1)(b-1)}{2}. \]

The sum is 0 when b=1.

  1. Prove this result by a geometric argument.
  2. Prove this result by an analytic argument.

  1. Proof. We know by the previous exercise (1.11, #6) that

        \[ \sum_{n=1}^{b-1} \left[ \frac{na}{b} \right] = \begin{array}{l} \text{\# of lattice points inside a right triangle}\\ \text{of base } b \text{ and height } a \ (\text{letting } f(x) = \frac{ax}{b}).\end{array} \]

    Further, from this exercise (1.7, #4), we know

        \[ a(T) = I_T + \frac{1}{2} B_T - 1 \]

    where I_T = number of interior lattice points, and B_T = number of boundary lattice points. We also know by the formula for the area of a right triangle that

        \[ a(T) = \frac{1}{2} (ab). \]

    Thus, we have,

        \[ I = \sum_{n=1}^{b-1} \left[ \frac{na}{b} \right] = \frac{1}{2} (ab) - \frac{1}{2}B_T + 1. \]

    Then, to calculate B_T we note there are no boundary points on the hypotenuse of our right triangle (since a and b have no common factor). (This follows since if there were such a point then \frac{na}{b} \in \mathbb{Z} for some n < b, but then we would have a divides b, contradicting that they have no common factor.) Thus, B_T = a + b + 1. So,

        \begin{align*}  \sum_{n=1}^{b-1} \left[ \frac{na}{b} \right] &= \frac{1}{2} (ab) - \frac{1}{2} (a+b+1) +1 \\ &= \frac{1}{2} (ab - a - b + 1) \\ &= \frac{1}{2} (a-1)(b-1). \qquad \blacksquare \end{align*}

  2. Proof. To derive the result analytically, first, by counting in the other direction we have,

        \[ \sum_{n=1}^{b-1} \left[ \frac{na}{b} \right] = \sum_{n=1}^{b-1} \left[ \frac{a(b-n)}{b} \right]. \]

    Then,

        \begin{align*}  && \sum_{n=1}^{b-1} \left[ \frac{a(b-n)}{b} \right] &= \sum_{n=1}^{b-1} [a] - \sum_{n=1}^{b-1} \left[ \frac{na}{b} \right] - \sum_{n=1}^{b-1} 1 \\ \implies && 2 \sum_{n=1}^{b-1} \left[ \frac{a(b-n)}{b} \right] &= \sum_{n=1}^{b-1} [a] - \sum_{n=1}^{b-1} 1 = (b-1)a - (b-1)\\ \implies && \sum_{n=1}^{b-1} \left[ \frac{na}{b} \right] &= \frac{1}{2} (a-1)(b-1). \qquad \blacksquare \end{align*}

Formula for counting lattice points in the ordinate set of a function

For a nonnegative function f defined on an interval [a,b] define the set

    \[ S = \{ (x,y) \mid a \leq x \leq b, \ 0 < y \leq f(x) \}. \]

(i.e., the region enclosed by the graph of the function and the x-axis between the vertical lines at x=a and x=b). Then prove

    \[ \text{\# of lattice points in } S = \sum_{n=a}^b [f(n)], \]

where [f(n)] is the greatest integer less than or equal to f(n).


We can help ourselves by drawing a picture to get a good idea of what is going on, then turn that intuition into something more rigorous. The picture is as follows:

Rendered by QuickLaTeX.com

In the picture, we can see the number of lattice points in the ordinate set of f(x) (not including the x-axis since the question stipulates S contains the points 0 < y \leq f(x)). At each integer between a and b, we count the number of lattice points beneath [f(x)], the greatest integer less than or equal to f(x). Then we need to turn this intuition from the picture into a proof:

Proof. Let n \in \mathbb{Z} with a \leq n < b. We know such an n exists since a,b \in \mathbb{Z} with a < b. Then, the number of lattice points in S with first element n is the number of integers y such that 0 < y \leq f(n). But, by definition, this is [f(n)] (the greatest integer less than or equal to f(n)). Summing over all integers n, \ a \leq n \leq b we have,

    \[ \text{\# of lattice points in } S = \sum_{n=a}^b [ f(n) ]. \qquad \blacksquare\]

Prove some properties of the greatest integer function

For any x \in \mathbb{R} we denote the greatest integer less than or equal to x by [x]. Prove the following properties of the function [x]:

  1. [x+n] = [x] + n for any integer n.
  2. [-x] = \displaystyle{\begin{cases}  -[x] & \text{if } x \text{ is an integer,} \\ -[x]-1 & \text{otherwise.} \end{cases}}
  3. [x+y] = [x]+[y] or [x]+[y]+1.
  4. [2x] = [x] + \left[ x + \frac{1}{2} \right].
  5. [3x] = [x] + \left[ x + \frac{1}{3} \right] + \left[ x + \frac{2}{3} \right].

  1. Proof. Let [x+n] = m for some integer m. Then,

        \begin{align*}  m \leq x+n < m+1 &&\implies  && m-n &\leq x < m-n+1 \\ &&\implies && [x] &= m-n \\ &&\implies && [x] + n &=  m. \end{align*}

    But, we defined m=[x+n]. Thus, [x+n] = [x] + n for any n \in \mathbb{Z}. \qquad \blacksquare

  2. Proof. If x \in \mathbb{Z}, then x = n for some n \in \mathbb{Z}. Hence, [x]=n and

        \[ -x=-n \quad \implies \quad [-x]=-n \quad \implies \quad [-x]=-[x]. \]

    On the other hand, if x \notin \mathbb{Z}, then let [x] = n. This gives us,

        \begin{align*}  n \leq x < n+1 &&\implies && -n-1 &< -x < n &(n \neq x \text{ since } x \notin \mathbb{Z}) \\ &&\implies && [-x] &= -n-1 = -[x]-1. \qquad \blacksquare \end{align*}

  3. Proof. Let [x] = m and [y] = n, then we have

        \[ m \leq x < m+1 \qquad \text{and} \qquad n \leq y < n+1. \]

    So, adding, we obtain,

        \[ m+n \leq x+y < m+n+2. \]

    Thus,

        \[ [x+y] = m+n = [x] + [y] \qquad \text{or} \qquad [x+y] = m+n+1 = [x] + [y] + 1. \qquad \blacksquare\]

  4. Proof. By part (c) we have,

        \[ [2x] = [x+x] = [x] + [x] \qquad \text{or} \qquad [x] + [x] + 1. \]

    If [2x] = [x] + [x], then let [x] = n,

        \begin{align*}  && [2x] &= 2n \\ \implies && 2n &\leq 2x < 2n+1 \\ \implies && n &\leq x < n + \frac{1}{2} \\ \implies && n &\leq x + \frac{1}{2} < n+1 \\ \implies && \left[ x + \frac{1}{2} \right] &=n . \end{align*}

    Thus, [2x] = 2n = n+n = [x] + \left[ x + \frac{1}{2} \right].
    On the other hand, if [2x] = [x] + [x] + 1, then let [x] = n, and

        \begin{align*}   && [2x] &= 2n+1 \\  \implies && 2n+1 &\leq 2x < 2n+2 \\  \implies && n+\frac{1}{2} &\leq x < n+1 \\  \implies && n +1 &\leq x + \frac{1}{2} <  n+2 \\  \implies && \left[ x + \frac{1}{2} \right] &= n+1. \end{align*}

    Thus, [2x] = n+n+1 = [x] + \left[ x + \frac{1}{2} \right]. \qquad \blacksquare

  5. Proof. By part (c) we have

        \[ [3x] = [x+x+x] = [x+x] + [x] \qquad \text{or} \qquad [x+x]+[x] + 1. \]

    And,

        \[ [x+x] = [x] + [x] \qquad \text{or} \qquad [x]+[x]+1. \]

    So, putting these together we have,

        \[ [3x] = [x]+[x]+[x], \qquad \text{or} \qquad [x]+[x]+[x]+1, \qquad \text{or} \qquad [x]+[x]+[x]+2. \]

    If [3x] = [x] + [x] + [x], then, let [x] = n, so

        \begin{align*} && 3n &\leq 3x < 3n+1 \\ \implies && n &\leq x < n + \frac{1}{3} \\ \implies && n &\leq x + \frac{1}{3} < n+1 & \text{and}&& n &\leq x+\frac{2}{3} < n+1 \\ \implies && [x] &= \left[ x+ \frac{1}{3} \right] = \left[ x+ \frac{2}{3} \right] = n.  \end{align*}

    Thus, [3x] = 3n = [x] + \left[ x + \frac{1}{3} \right] + \left[ x + \frac{2}{3} \right].
    Next, if [3x] = [x] + [x] + [x] + 1, then let [x] = n, giving us,

        \begin{align*}  && 3n+1 &\leq 3x < 3n+1 \\ \implies && n + \frac{1}{3} &\leq x < n + \frac{2}{3} \\ \implies && n + \frac{1}{3} & \leq x + \frac{1}{3} < n+1 &\implies \quad \left[ x + \frac{1}{3} \right] &=n \\ \text{and}, \ \implies && n + 1 &\leq x + \frac{2}{3} < n+2 &\implies \quad \left[ x + \frac{2}{3} \right] &= n+1. \end{align*}

    Thus,

        \[ [3x] = 3n+1  \quad \implies \quad [3x] = [x] + \left[ x + \frac{1}{3} \right] + \left[ x + \frac{2}{3} \right]. \]

    Finally, if [3x] = [x] + [x] + [x] + 2, then let [x] = n, and we have

        \begin{align*} && 3n+2 &\leq 3x < 3n+3 \\ \implies && n+\frac{2}{3} &\leq x < n+1 \\ \implies && n+1 &\leq x+\frac{1}{3} < n+2 & \text{and} && n+1 \leq x+\frac{2}{3} < n+2.  \end{align*}

    So,

        \[ [3x] = 3n+2 = [x] + \left[ x + \frac{1}{3} \right] + \left[ x + \frac{2}{3} \right]. \qquad \blacksquare \]