# Show that the formula for a line through two points (a1,b1) and (a2,b2) is:

y=(b1-b2)/(a1-a2) * x + (a1*b2-a2*b1)/(a1-a2)

The slope part looks right. Could someone explain how the y-intercept part makes sense?

I would think that the y-intercept is:
b1-slope*a1
or
b2-slope*a2

anyone have any ideas?

## To understand the formula for the y-intercept of a line that passes through two points (a1, b1) and (a2, b2), we can break it down step by step.

First, let's start with the slope part, which you mentioned looks correct:

slope = (b1 - b2) / (a1 - a2)

This formula calculates the difference in y-coordinates (b1 - b2) divided by the difference in x-coordinates (a1 - a2) of the two points. So, no issues here.

Now, let's examine the y-intercept part of the formula:

y-intercept = (a1 * b2 - a2 * b1) / (a1 - a2)

The y-intercept represents the point where the line intersects the y-axis when x = 0. To determine this, we need to find the value of y when x = 0. Let's plug in x = 0 into the equation of the line:

y = (b1 - b2) / (a1 - a2) * 0 + (a1 * b2 - a2 * b1) / (a1 - a2)

Since the first term (slope * x) becomes 0, we are left with:

y = (a1 * b2 - a2 * b1) / (a1 - a2)

This expression gives us the y-coordinate when x = 0, which is precisely the y-intercept.

Now, why does this formula make sense?

When two points (a1, b1) and (a2, b2) are given, finding the slope allows us to determine the rate of change between the y-coordinates for each unit change in x. However, this slope alone is not sufficient to determine the exact placement of the line on the coordinate plane.

To calculate the correct y-intercept, we need to consider both x and y values of the given points. By multiplying the x-coordinate of one point by the y-coordinate of the other point and vice versa, then taking the difference, we obtain a value that helps adjust the y-intercept based on the specific points given.

When we divide this value by the difference in x-coordinates (a1 - a2), we are accounting for the change in x units. This ensures that the y-intercept adjusts accordingly to account for any variation between the x-values of the two points.

In summary, while the straightforward formula for the y-intercept might seem intuitive at first (b1 - slope * a1 or b2 - slope * a2), it fails to account for the relationship between the x and y values of the given points. The more comprehensive formula incorporates this relationship, accurately determining the y-intercept of the line passing through the two points.