# Algebra with Ceiling Function

I have this equation here that I need to solve for the variable 'r'. Normally this would be easy, but with the ceiling function I'm unsure of how to approach it.

$$0 = \frac{h}{w} - \frac{\lceil\frac{n}{r}\rceil\, y}{r\,x}$$

Thanks in advance for the help guys.

-
As your function is not one to one, the inverse is not unique. – Fabian May 5 '11 at 21:17

If $\lceil \frac{n}{r}\rceil = k$, then you have $$r = k\left(\frac{wy}{hx}\right).$$ This will occur precisely when $k-1\lt \frac{n}{r}\leq k$. This means that you must have $$k-1 \lt \frac{nhx}{kwy}\leq k.$$ If $k\gt 0$, this is equivalent to $$k^2-k \lt \frac{nhx}{wy}\leq k^2.$$ For $k\lt 0$, it is equivalent to $$k^2-k \gt \frac{nhx}{wy}\geq k^2.$$ For $k=0$, there is no solution unless $h=0$. If $k=h=0$, then you just want $-1\lt \frac{n}{r}\leq 0$.
So first determine the possible values of $k$ for which the inequalities can hold (since you, presumably, know the values of $n$, $h$, $x$, $w$, and $y$), then use that to determine the value of $r$ by specifying the value of $\lceil\frac{n}{r}\rceil$.
Added. You say below $n$ and $r$ are positive, so $k\geq 1$. Note that there is at most one value of $k$ that can work, since $(k+1)^2 - (k+1) = k^2 + k \gt k^2$. But there may be no value of $k$ that works at all.
Shouldn't the first leq symbol in $k-1 \leq n/r \leq k$ instead be a strict inequality? If $n/r$ hits the lower bound $k-1$, doesn't this become $\lceil n/r \rceil = k-1 = k$? – JasonMond May 5 '11 at 23:43
@Shawn: I don't know what you did. If $n=4$, $x=1.33$, $y=1$, $h=221.116$, $w=154.6667$, then $nhx/wy = 7.605626292$. You want a value of $k$ for which $k^2-k\lt 7.605626292 \leq k^2$. Since $k$ must be a positive integer, you get that $k$ must be at least $3$ (otherwise, $7.605626292$ is not less than or equal to $k^2$); and must be at most $3$ (otherwise, it's not greater than $k^2-k$). So the correct value of $k$ is $k=3$. Therefore, the value of the ceiling is $3$, so $r=3(wy)/(hx) \approx 1.57778$. Note that $n/r \approx 2.535$, so $\lceil n/r\rceil = 3$, as required. – Arturo Magidin May 10 '11 at 21:03