I'm trying to solve a problem I posted here on Math SE. Part of my solution is to round up to the nearest x (e.g. 4.5 rounds up to 6 if x = 2). How do I express that in mathematical notation?
Asked
Active
Viewed 4,235 times
1
MathNewbie
- 235
2 Answers
6
Typically, we round to integers, and so we have good notation for doing so. For example:
- $\lfloor x \rfloor$ rounds $x$ down to an integer,
- $\lceil x \rceil$ rounds $x$ up to an integer, and
- $\lceil x \rfloor$ rounds $x$ to the nearest integer (with the borderline case $\ast.5$ rounding up or down according to some rule).
To round to a multiple of some given number, we can first divide by that number, round to an integer, then multiply by that number. Thus if we want to round $x$ up to the nearest multiple of $m$, we can write $$ m \left\lceil \frac{x}{m} \right\rceil.$$ To round down, or to round to the nearest multiple of $m$, replace $\lceil \cdot \rceil$ with the appropriate operation.
Xander Henderson
- 29,772
5
How about $2\lceil x/2 \rceil$?
EDIT: Yes, it does work.
Proof: We know that $0\le \lceil x/2 \rceil-x/2<1$. Then $0\le 2\lceil x/2 \rceil-x<2$. Since $2\lceil x/2 \rceil$ is an even integer, it is the least even integer that is not lesser than $x$.
ajotatxe
- 65,084
x" – MathNewbie Aug 18 '17 at 16:50