# Floor and Ceiling Functions

### Definitions

Let $$x$$ be a real number. The floor function of $$x,$$ denoted by $$\lfloor {x} \rfloor$$ or $$\text{floor}\left( x \right),$$ is defined to be the greatest integer that is less than or equal to $$x.$$

The ceiling function of $$x,$$ denoted by $$\lceil {x} \rceil$$ or $$\text{ceil}\left( x \right),$$ is defined to be the least integer that is greater than or equal to $$x.$$

For example,

${\lfloor{\pi}\rfloor = 3,\;\;}{\lceil{\pi}\rceil = 4,\;\;}\kern0pt{\lfloor{5}\rfloor = 5,\;\;}\kern0pt{\lceil{5}\rceil = 5.}$

${\lfloor{- e}\rfloor = -3,\;\;}{\lceil{-e}\rceil = -2,\;\;}\kern0pt{\lfloor{-1}\rfloor = -1,\;\;}\kern0pt{\lceil{-1}\rceil = -1.}$

It follows from the definitions that the floor and ceiling functions have type $$\mathbb{R} \to \mathbb{Z}.$$ Formally, for any $$x \in \mathbb{R},$$ they can be defined as

$\begin{array}{*{20}{l}} \text{floor:} & {\lfloor {x} \rfloor = \max \left\{ {n \in \mathbb{Z}:n \le x} \right\}}\\ \text{ceiling:} & {\lceil {x} \rceil = \max \left\{ {n \in \mathbb{Z}:n \le x} \right\}} \end{array}$

### Graphs of the Floor and Ceiling Functions

The floor and ceiling functions look like a staircase and have a jump discontinuity at each integer point.

### Properties of the Floor and Ceiling Functions

There are many interesting and useful properties involving the floor and ceiling functions, some of which are listed below. The number $$n$$ is assumed to be an integer.

1. $$\left\lfloor x \right\rfloor = n \;\text{ iff }\; n \le x \lt n + 1$$
2. $$\left\lceil x \right\rceil = n \;\text{ iff }\; n – 1 \lt x \le n$$
3. $$\left\lfloor x \right\rfloor = n \;\text{ iff }\; x – 1 \lt n \le x$$
4. $$\left\lceil x \right\rceil = n \;\text{ iff }\; x \le n \lt x + 1$$
5. $$\left\lfloor { – x} \right\rfloor = – \left\lceil x \right\rceil$$
6. $$\left\lceil { – x} \right\rceil = – \left\lfloor x \right\rfloor$$
7. $$\left\lfloor x \right\rfloor + \left\lfloor { – x} \right\rfloor$$ $$= \left\{ {\begin{array}{*{20}{l}} 0 &{\text{ if } x \in \mathbb{Z}}\\ { – 1} &{\text{ if } x \notin \mathbb{Z}} \end{array}} \right.$$
8. $$\left\lceil x \right\rceil + \left\lceil { – x} \right\rceil$$ $$= \left\{ {\begin{array}{*{20}{l}} 0 &{\text{ if } x \in \mathbb{Z}}\\ 1 &{\text{ if } x \notin \mathbb{Z}} \end{array}} \right.$$
9. $$\left\lfloor {x + n} \right\rfloor = \left\lfloor x \right\rfloor + n$$
10. $$\left\lceil {x + n} \right\rceil = \left\lceil x \right\rceil + n$$

### Fractional Part Function

The fractional part of a number $$x \in \mathbb{R}$$ is the difference between $$x$$ and the floor of $$x:$$

$\left\{ x \right\} = x – \left\lfloor x \right\rfloor .$

For example,

${\left\{ 2 \right\} = 2 – \left\lfloor 2 \right\rfloor }={ 2 – 2 }={ 0}$

${\left\{ {3.51} \right\} = 3.51 – \left\lfloor {3.51} \right\rfloor }={ 3.51 – 3 }={ 0.51}$

${\left\{ {\frac{7}{3}} \right\} = \frac{7}{3} – \left\lfloor {\frac{7}{3}} \right\rfloor }={ \frac{7}{3} – 2 }={ \frac{1}{3}}$

${\left\{ { – 5.98} \right\} }={ – 5.98 – \left\lfloor { – 5.98} \right\rfloor }={ – 5.98 – \left( { – 6} \right) }={ – 5.98 + 6 }={ 0.02}$

The graph of the fractional part function looks like a sawtooth wave, with a period of $$1.$$

The range of fractional part function is the half-open interval $$\left[ {0,1} \right).$$

Some other properties of the fractional part are

1. $$\left\{ x \right\} = 0 \;\text{ iff }\; x \in \mathbb{Z}$$
2. $$\left\{ {x + n} \right\} = \left\{ x \right\}, n \in \mathbb{Z}$$
3. $$\left\{ x \right\} + \left\{ { – x} \right\}$$ $$= \left\{ {\begin{array}{*{20}{l}} 0 &{\text{if } x \in \mathbb{Z}}\\ 1 &{\text{if } x \notin \mathbb{Z}} \end{array}} \right.$$

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Solve the equation ${\left\lfloor {x – \frac{1}{2}} \right\rfloor + \left\lfloor {x – \frac{5}{2}} \right\rfloor + \left\lfloor {x – \frac{9}{2}} \right\rfloor }={ 3.}$

### Example 2

Solve the equation ${x^2} + 2{\left\{ x \right\}^2} = 12.$

### Example 3

Find all $$x$$ satisfying the equation $\left\{ {3x} \right\} = \frac{1}{3}.$

### Example 4

Prove that $$\left\{ \varphi \right\} = \large{\frac{1}{\varphi }}\normalsize,$$ where $$\varphi = \large{\frac{{1+\sqrt 5}}{2}}\normalsize$$ is the golden ratio.

### Example 5

Solve the equation ${x^3} – \left\lfloor x \right\rfloor = 5.$

### Example 6

Solve the equation ${x^2} = \left\lfloor x \right\rfloor + 1.$

### Example 1.

Solve the equation ${\left\lfloor {x – \frac{1}{2}} \right\rfloor + \left\lfloor {x – \frac{5}{2}} \right\rfloor + \left\lfloor {x – \frac{9}{2}} \right\rfloor }={ 3.}$

Solution.

Change the variable: $$x – \large{\frac{1}{2}}\normalsize = z.$$ Then the equation becomes

$\left\lfloor z \right\rfloor + \left\lfloor {z – 2} \right\rfloor + \left\lfloor {z – 4} \right\rfloor = 3.$

Using the identity $$\left\lfloor {x + n} \right\rfloor = \left\lfloor x \right\rfloor + n,$$ we get

${\left\lfloor z \right\rfloor + \left\lfloor z \right\rfloor – 2 + \left\lfloor z \right\rfloor – 4 = 3,}\;\; \Rightarrow {3\left\lfloor z \right\rfloor = 9,}\;\; \Rightarrow {\left\lfloor z \right\rfloor = 3.}$

The last equation means that $$3 \le z \lt 4.$$ Returning back to the variable $$x,$$ we have

${3 \le x – \frac{1}{2} \lt 4,}\;\; \Rightarrow {3\frac{1}{2} \le x \lt 4\frac{1}{2},\;\text{ or }\;}\kern0pt{x \in \left[ {3.5,4.5} \right).}$

### Example 2.

Solve the equation ${x^2} + 2{\left\{ x \right\}^2} = 12.$

Solution.

Since, by definition, $$0 \le \left\{ x \right\} \lt 1,$$ then

${0 \le {\left\{ x \right\}^2} \lt 1,}\;\; \Rightarrow {0 \le 2{\left\{ x \right\}^2} \lt 2.}$

Hence,

$10 \lt {x^2} \le 12.$

Given that $$x^2$$ is an increasing function for $$x \gt 0,$$ we get

$\sqrt {10} \lt x \le \sqrt {12} ,$

that is, the floor of $$x$$ is equal to $$3.$$ Hence, we can represent the number $$x$$ as

$x = \left\lfloor x \right\rfloor + \left\{ x \right\} = 3 + \theta ,$

where $$\theta$$ is the fractional part of $$x.$$

Substitute this expression into the original equation and solve it for $$\theta.$$

${{\left( {3 + \theta } \right)^2} + 2{\theta ^2} = 12,}\;\; \Rightarrow {9 + 6\theta + {\theta ^2} + 2{\theta ^2} = 12,}\;\; \Rightarrow {3{\theta ^2} + 6\theta = 3,}\;\; \Rightarrow {{\theta ^2} + 2\theta = 1,}\;\; \Rightarrow {{\theta ^2} + 2\theta + 1 = 2,}\;\; \Rightarrow {{\left( {\theta + 1} \right)^2} = 2,}\;\; \Rightarrow {\theta + 1 = \sqrt 2 ,}\;\; \Rightarrow {\theta = \sqrt 2 – 1.}$

Therefore,

${x = 3 + \theta }={ 3 + \sqrt 2 – 1 }={ 2 + \sqrt 2 .}$

### Example 3.

Find all $$x$$ satisfying the equation $\left\{ {3x} \right\} = \frac{1}{3}.$

Solution.

Since $$3x = \left\lfloor {3x} \right\rfloor + \left\{ {3x} \right\},$$ we rewrite the equation in the form

${\left\{ {3x} \right\} = \frac{1}{3},}\;\; \Rightarrow {3x – \left\lfloor {3x} \right\rfloor = \frac{1}{3},}\;\; \Rightarrow {\left\lfloor {3x} \right\rfloor = 3x – \frac{1}{3}.}$

The $$RHS$$ must be an integer. We denote it by $$n,$$ so

${3x – \frac{1}{3} = n,}\;\; \Rightarrow {3x = n + \frac{1}{3},}\;\; \Rightarrow {x = \frac{n}{3} + \frac{1}{9},\; n \in \mathbb{Z}.}$

Then we have

${\left\lfloor {3x} \right\rfloor = 3x – \frac{1}{3},}\;\; \Rightarrow {\left\lfloor {3\left( {\frac{n}{3} + \frac{1}{9}} \right)} \right\rfloor = n,}\;\; \Rightarrow {\left\lfloor {n + \frac{1}{3}} \right\rfloor = n.}$

It follows from the last equation that

$n \le n + \frac{1}{3} \lt n + 1.$

This double inequality is valid for any $$n \in \mathbb{Z}.$$ Hence, the solution set is given by

$x = \left\{ {n \in \mathbb{Z} \,\bigg|\, \frac{n}{3} + \frac{1}{9}} \right\}.$

We can check the answer for a few values of $$n:$$

1. $$\kern-1pt n = -1:$$ ${x = – \frac{2}{9},}\;\; \Rightarrow {\left\{ {3x} \right\} = \left\{ {3 \cdot \left( { – \frac{2}{9}} \right)} \right\} }={ \left\{ { – \frac{2}{3}} \right\} }={ \left\{ { – 1 + \frac{1}{3}} \right\} }={ \frac{1}{3};}$
2. $$\kern-1pt n = 0:$$ ${x = \frac{1}{9},}\;\; \Rightarrow {\left\{ {3x} \right\} = \left\{ {\frac{1}{3}} \right\} = \frac{1}{3};}$
3. $$\kern-1pt n = 2:$$ ${x = \frac{7}{9},}\;\; \Rightarrow {\left\{ {3x} \right\} = \left\{ {3 \cdot \frac{7}{9}} \right\} }={ \left\{ {\frac{7}{3}} \right\} }={ \left\{ {2 + \frac{1}{3}} \right\} }={ \frac{1}{3}.}$

### Example 4.

Prove that $$\left\{ \varphi \right\} = \large{\frac{1}{\varphi }}\normalsize,$$ where $$\varphi = \large{\frac{{1+\sqrt 5}}{2}}\normalsize$$ is the golden ratio.

Solution.

We represent the golden ratio $$\varphi$$ as

${\varphi = \frac{{1 + \sqrt 5 }}{2} }={ \frac{{1 + \sqrt 5 + 1 – 1}}{2} }={ \frac{{2 + \sqrt 5 – 1}}{2} }={ 1 + \frac{{\sqrt 5 – 1}}{2} }={ \left\lfloor \varphi \right\rfloor + \left\{ \varphi \right\},}$

so the fractional part of $$\varphi$$ is given by

$\left\{ \varphi \right\} = \frac{{\sqrt 5 – 1}}{2} \approx 0.618\ldots$

Calculate the reciprocal $$\large{\frac{1}{\varphi }}\normalsize :$$

${\frac{1}{\varphi } = \frac{1}{{\frac{{1 + \sqrt 5 }}{2}}} }={ \frac{2}{{1 + \sqrt 5 }} = \frac{{2\left( {1 – \sqrt 5 } \right)}}{{\left( {1 + \sqrt 5 } \right)\left( {1 – \sqrt 5 } \right)}} }={ \frac{{2\left( {1 – \sqrt 5 } \right)}}{{{1^2} – {{\left( {\sqrt 5 } \right)}^2}}} }={ \frac{{2\left( {1 – \sqrt 5 } \right)}}{{1 – 5}} }={ \frac{{2\left( {\sqrt 5 – 1} \right)}}{4} }={ \frac{{\sqrt 5 – 1}}{2}.}$

Hence,

$\left\{ \varphi \right\} = \frac{1}{\varphi }.$

### Example 5.

Solve the equation ${x^3} – \left\lfloor x \right\rfloor = 5.$

Solution.

We represent the number $$x$$ as

$x = \left\lfloor x \right\rfloor + \left\{ x \right\},$

where the fractional part $$\left\{ x \right\}$$ satisfies the condition $$0 \le \left\{ x \right\} \lt 1.$$

Substitute $$\left\lfloor x \right\rfloor = x – \left\{ x \right\}$$ in the equation to get

${{x^3} – \left\lfloor x \right\rfloor = 5,}\;\; \Rightarrow {{x^3} – \left( {x – \left\{ x \right\}} \right) = 5,}\;\; \Rightarrow {{x^3} – x + \left\{ x \right\} = 5,}\;\; \Rightarrow {\left\{ x \right\} = x – {x^3} + 5.}$

It is clear that

${0 \le x – {x^3} + 5 \lt 1,}\;\; \Rightarrow {- 5 \le x – {x^3} \lt – 4,}\;\; \Rightarrow {4 \lt {x^3} – x \le 5.}$

By taking the derivative of the function $$f\left( x \right) = {x^3} – x$$ we find its local extrema:

${f^{\prime}\left( x \right) = \left( {{x^3} – x} \right)^{\prime} }={ 3{x^2} – 1 }={ 0,}\;\; \Rightarrow {{x_{1,2}} = \pm \frac{1}{{\sqrt 3 }}.}$

The function $$f\left( x \right)$$ is increasing on the intervals $$\left( { – \infty , – \large{\frac{1}{{\sqrt 3 }}}\normalsize} \right)$$ and $$\left( {\large{\frac{1}{{\sqrt 3 }}}\normalsize,\infty } \right),$$ and is decreasing on the interval $$\left( { – \large{\frac{1}{{\sqrt 3 }}}\normalsize,\large{\frac{1}{{\sqrt 3 }}}\normalsize} \right).$$ The maximum value on the interval $$\left( { – \infty ,\large{\frac{1}{{\sqrt 3 }}}\normalsize} \right)$$ is attained at $${{x_1} = – \frac{1}{{\sqrt 3 }}}:$$

${f\left( {{x_1}} \right) = f\left( { – \frac{1}{{\sqrt 3 }}} \right) }={ {\left( { – \frac{1}{{\sqrt 3 }}} \right)^3} – \left( { – \frac{1}{{\sqrt 3 }}} \right) }={ – \frac{1}{{3\sqrt 3 }} + \frac{1}{{\sqrt 3 }} }={ \frac{2}{{3\sqrt 3 }} \lt 4.}$

Thus, the function takes the values from $$4$$ to $$5$$ on the last interval $$\left( {\large{\frac{1}{{\sqrt 3 }}}\normalsize,\infty } \right)$$ where it is strictly increasing. Note that

${f\left( 1 \right) = {1^3} – 1 = 0,\;\;}\kern0pt{f\left( 2 \right) = {2^3} – 2 = 6.}$

So, the solution of the equation must be in the range $$1 \lt x \lt 2,$$ that is, $$\left\lfloor x \right\rfloor = 1.$$ This yields:

${{x^3} – \left\lfloor x \right\rfloor = 5,}\;\; \Rightarrow {{x^3} – 1 = 5,}\;\; \Rightarrow {{x^3} = 6,}\;\; \Rightarrow {x = \sqrt[3]{6}.}$

### Example 6.

Solve the equation ${x^2} = \left\lfloor x \right\rfloor + 1.$

Solution.

We rewrite the equation in the form

$\left\lfloor x \right\rfloor = {x^2} – 1.$

Note that $$x^2 -1 \ge -1$$ in the right hand side. Hence, $$x \ge -1$$ in the left hand side, too. From these conditions, we have

${\left\{ \begin{array}{l} {x^2} – 1 \ge -1\\ x \ge -1 \end{array} \right.,}\;\; \Rightarrow {\left\{ \begin{array}{l} {x^2} \ge 0\\ x \ge -1 \end{array} \right.,}\;\; \Rightarrow {x \ge -1.}$

The original equation is equivalent to the following system:

$\left\{ \begin{array}{l} {x^2} – 1 = n\\ n \le x \lt n + 1 \end{array} \right.,$

where $$n \ge -1$$ is an integer.

Express $$x$$ in terms of $$n$$ from the first equation:

${{x^2} = n + 1,}\;\; \Rightarrow {x = \sqrt {n + 1} ,}$

and substitute $$x$$ in the second expression:

${n \le x \lt n + 1,}\;\; \Rightarrow {n \le \sqrt {n + 1} \lt n + 1,}\;\; \Rightarrow {\left\{ {\begin{array}{*{20}{l}} {n \le \sqrt {n + 1} }\\ {\sqrt {n + 1} \lt n + 1} \end{array}} \right..}$

The first inequality in the system has the following solution:

${n \le \sqrt {n + 1} ,}\;\; \Rightarrow {{n^2} \le n + 1,}\;\; \Rightarrow {{n^2} – n \le 1,}\;\; \Rightarrow {{n^2} – n + \frac{1}{4} \le \frac{5}{4},}\;\; \Rightarrow {{\left( {n – \frac{1}{2}} \right)^2} \le \frac{5}{4},}\;\; \Rightarrow {- \frac{{\sqrt 5 }}{2} \le n – \frac{1}{2} \le \frac{{\sqrt 5 }}{2},}\;\; \Rightarrow {\frac{{1 – \sqrt 5 }}{2} \le n \le \frac{{1 + \sqrt 5 }}{2},}$

or approximately $$– 0.61 \lt n \lt 1.62.$$ Since $$n \ge -1,$$ there are only $$2$$ values satisfying the first inequality: $$n = 0, 1.$$

Consider the second inequality:

${\sqrt {n + 1} \lt n + 1,}\;\; \Rightarrow {n + 1 \lt {\left( {n + 1} \right)^2},}\;\; \Rightarrow {n + 1 \lt {n^2} + 2n + 1,}\;\; \Rightarrow {{n^2} + n \gt 0,}\;\; \Rightarrow {n\left( {n + 1} \right) \gt 0,}\;\; \Rightarrow {n \in \left( { – \infty , – 1} \right) \cup \left( {0,\infty } \right).}$

The common solution of the two inequalities is $$n = 1.$$ Therefore,

$x = \sqrt {n + 1} = \sqrt 2 .$