Why does this algorithm to plot implicit equations work?

This may be an obvious question, but I can’t seem to figure it out.

I found an algorithm that receives an equation, and in order to plot its graph, for each pixel in the screen, it will replace the variables for the coordinates of the pixel and evaluate both sides of the equation keeping track of which side is greater. Then, when a point makes the formerly greater side become smaller it will know that this point needs to be painted. I have tested it and does a decent job plotting, giving its simplicity. What I don’t have clear is why this works.

This is where I found the algorithm.

Solutions Collecting From Web of "Why does this algorithm to plot implicit equations work?"

Because an equation with two unknown
$$
f(x,y)=0
$$
can be considered as the intersection of the graph of the function $f$ with the plane $z=0$, so the set of the solution of the equation is the same as the zeros of $f$.

When the difference of the two sides change sign, assuming the function is continuous, then there is a zero, so a point to plot.