TITLE: Is there an equation that will graph a line segment?
QUESTION [6 upvotes]: Is there an equation that, given the two points of a line segment, will result, when graphed for x on a real graph, in a line segment?

REPLY [3 votes]: An expression I found that works very well is
$$\frac{-(x-b_1)(x-b_2)}{\sqrt{-(x-b_1)(x-b_2)}^2}$$
This works well as it is equal to 1 and can be inserted into any function in the form $y=mx+b.
The way that I constructed this expression was by realizing that a square root function is only real for x values where $\sqrt{x}$ is positive.
Then I realized that since a quadratic has 2 zeroes that I could use a binomial to insert the values where I want the limits to be.