# How to solve these equations that involve the ceiling function

I am not sure how to solve these equations because the involve the ceiling function. I am trying to solve for $M$ and $L$ in terms of only $C$. Is there a way? If not, is there an algorithm that could calculate $M$ and $L$ values based on a given $C$ value? Here are the equations:

$$M = C + L - 1$$

$$L = \lceil\ 0.06\ M\ \rceil$$

-
It's possible to get solutions, although you could have more than one. For example, if $C=16$ you could have $\{M=16,L=1\}$ or $\{M=17,L=2\}$. – Matt Groff Mar 31 '11 at 20:12

You can convert $L=\lceil 0.06 M \rceil$ into two inequalities,

$$0.06M\le L < 0.06M + 1\;,$$

together with the condition that $L$ is an integer. Then you can substitute $M$ from the first equation:

$$0.06(C+L-1)\le L < 0.06(C+L-1) + 1$$

and "solve" for $L$:

$$0.06(C-1)\le 0.94L < 0.06(C-1) + 1\;,$$

$$\frac{0.06(C-1)}{0.94}\le L < \frac{0.06(C-1) + 1}{0.94}\;.$$

Since the difference between the two bounds is $1/0.94\approx 1.06$, this can have either one or two integer solutions for $L$, depending on $C$, which you can substitute into the first equation to get the corresponding values for $M$.

-
Thanks. My math is rusty. I actually do need an integer solution for L, anyone will do. So to get one I could just take the ceiling of the lower bound of that inequality of L? – YWE Mar 31 '11 at 21:33
@YWE: Exactly -- since the difference between the bounds is greater than $1$, that will always be less than the upper bound. (Even if you didn't need an integer solution for $L$, you'd automatically get one, since $L$ is equal to a value of the ceiling function, which only takes integer values.) – joriki Mar 31 '11 at 21:35

You can rewrite your problem as the intersection of two objects. Let $x=M$ and $y=L$ then the first equation is the parametric line $y=x+1-c$ and the second equation $y = \lceil 0.06x \rceil$ can be thought as a collection of horizontal lines (I let you figure out precisely what is that collection). Now all you want is to find the intersection of these two things (which clearly will involve your parameter $c$.

-