Algebraic Intersection of a Step Function and another function I am trying to find an algebraic way to solve for the intersection of a step function and another function (in this case linear but any polynomial function in general). The example is given as follows :
Line : $y = 2x+100 $ and
Step : $y = -200 \lfloor {-x/150} \rfloor +400$
I tried solving this by setting them equal but I arrive at a logical issue in which
$2x-300 = -200 \lfloor {-x/150} \rfloor $
I have no interval to assign the floor function to as it depends completely on the neighbouring value of $x$. I don't know of any other manipulation to solve this without either plotting the functions or guessing values of the step function which may intersect the line as well. Any ideas?
 A: First of all, it is a bit cleaner to write the step function with ceiling rather than floor: $y = 200 \lceil x/150\rceil + 400$.
As for solving the problem: rather than guessing values, we can start with the inequality $$x/150 \le \lceil x/150\rceil < x/150 + 1.$$ (Rounding up to the next integer always increases the value we get, but by no more than $1$.) Therefore if $2x-300 = 200\lceil x/150\rceil$, we have $$200(x/150) \le 2x-300 < 200(x/150+1)$$ which simplifies to $450 \le x < 750$. This means that $3 \le x/150 < 5$, and $\lceil x/150\rceil$ is $3$, $4$, or $5$.
We get an intersection point for each case:

*

*If $\lceil x/150 \rceil = 3$, then $2x-300 = 200\cdot 3$, so $x=450$.

*If $\lceil x/150 \rceil = 4$, then $2x-300 = 200\cdot 4$, so $x=550$.

*If $\lceil x/150 \rceil = 5$, then $2x-300 = 200\cdot 5$, so $x=650$.

In all cases, we should check that we did not get an extraneous solution: $\lceil x/150 \rceil$ matches what it is assumed to be in the case. All three checks are satisfied, so $x=450$, $x = 550$, and $x = 650$ give us the three intersection points.
If there were more cases than this, I would want to "automate" checking them. Write $x = 150a - b$ where $0 \le b < 150$, so that $\lceil x/150\rceil = a$, and solve $$2(150a-b) - 300 = 200a$$ for $b$ in terms of $a$. We get $b = 50a - 150$; the condition that $0 \le b < 150$ tells us $3 \le a < 6$ (again), and the values $a=3,4,5$ give us $b=0,50,100$, for $x = 3\cdot150-0$, $x=4\cdot150-50$, and $x=5\cdot150-100$: the same solutions we found earlier.
