Linear Equation Calculator
Find the equation of a line through two points in slope-intercept form (y = mx + b), with the slope, x- and y-intercepts, and the line's angle.
Cómo usar esta calculadora
- 1Enter the coordinates of the first point.
- 2Enter the coordinates of the second point.
- 3Read the equation of the line in y = mx + b form.
- 4See the slope, both intercepts, and the angle the line makes.
Cómo funciona
Equation of a line
slope m = (y₂ − y₁) ÷ (x₂ − x₁) slope-intercept: y = mx + b, where b = y₁ − m·x₁ point-slope: y − y₁ = m(x − x₁) x-intercept = −b ÷ m, y-intercept = b
A straight line is completely determined by any two points on it, and the standard way to describe it is slope-intercept form, y = mx + b. The slope m measures the line's steepness — the change in y divided by the change in x between the two points, often called rise over run. A positive slope rises left to right, a negative slope falls, and a larger magnitude means a steeper line. The y-intercept b is the value of y where the line crosses the vertical axis, found by substituting the slope and one of the points back into the equation. Together, m and b pin the line down exactly. From this form you can read off the intercepts, sketch the line, and predict the y for any x. The one exception is a vertical line, where the run is zero, making the slope undefined; such a line cannot be written as y = mx + b and is instead described by x equal to a constant.
Ejemplo resuelto
The line through (0, 1) and (2, 5) has slope (5 − 1) ÷ (2 − 0) = 2, and since it passes through (0, 1) its y-intercept is 1, giving y = 2x + 1. It crosses the x-axis where y = 0, at x = −0.5, and rises at about 63.4° to the horizontal.
Linear Equation Calculator: la guía completa
Reading slope and intercept
The power of slope-intercept form is that its two numbers each have a clear, visual meaning. The slope, m, tells you how the line tilts: for every one unit you move right, the line rises (or falls) by m units. A slope of 2 means the line climbs steeply, gaining two units of height for each unit across; a slope of 0.5 climbs gently; a slope of −1 descends at 45 degrees. The sign tells you the direction and the size tells you the steepness, so from the slope alone you can picture the line's orientation before drawing anything.
The intercept, b, anchors the line in place. It is the y-value where the line crosses the vertical axis, the point (0, b). Two lines can have the same slope — they are parallel, tilting identically — but different intercepts place them at different heights. Fixing both the slope and the intercept locks the line to a single position on the plane. This is why y = mx + b is so convenient: change m to rotate the line, change b to slide it up or down, and between them you can describe every non-vertical line there is.
From two points to an equation
Finding a line's equation from two points is a two-step process that this calculator automates but is worth understanding. First, compute the slope as the difference in the y-coordinates divided by the difference in the x-coordinates — the rise over the run. This single number captures the line's tilt regardless of which two points on it you chose, because a straight line has the same slope everywhere. Getting the slope is usually the harder step conceptually, but it is just a subtraction and a division.
With the slope in hand, the intercept follows immediately. Since the line passes through both given points, you can substitute either one, along with the slope, into y = mx + b and solve for b. This works because you now know everything except b: the x and y of a known point and the slope m. Rearranging gives b = y − mx. Some people prefer point-slope form, y − y₁ = m(x − x₁), which skips explicitly finding b by building the equation directly around a known point and the slope; it describes the same line and can be rearranged into slope-intercept form when needed. Either route turns two points into the full equation of the line through them.
Why linear equations are everywhere
Linear relationships — where one quantity changes at a constant rate with respect to another — are the simplest and most common relationships in the world, which is why the equation of a line is so widely used. Any situation with a fixed rate of change is linear: a phone plan with a monthly fee plus a per-minute charge, a taxi fare with a base rate plus a cost per mile, the distance travelled at constant speed, or the total cost of items at a fixed price each. In every case the y-intercept is the starting or fixed amount and the slope is the rate, and y = mx + b models the total.
Beyond everyday budgeting, linear equations are the foundation of more advanced mathematics and science. They are the starting point for calculus, where the slope generalises into the derivative — the instantaneous rate of change of any curve. In statistics, linear regression fits the best straight line through scattered data to reveal trends and make predictions, and the slope and intercept of that line carry real meaning about the relationship. Physics, economics, and engineering are full of linear approximations because, over small enough ranges, almost any smooth relationship looks like a straight line. Mastering the equation of a line, and being able to build it from two points, is therefore a gateway skill that reaches far beyond the coordinate plane where it starts.
Preguntas frecuentes
How do I find the equation of a line from two points?
First find the slope: m = (y₂ − y₁) ÷ (x₂ − x₁). Then find the y-intercept by substituting the slope and one point into y = mx + b, giving b = y − mx. For (0,1) and (2,5), the slope is 2 and b is 1, so the equation is y = 2x + 1.
What do m and b mean in y = mx + b?
m is the slope — how steep the line is, the change in y per unit change in x. b is the y-intercept — the y-value where the line crosses the vertical axis, at the point (0, b). Together they fully describe any non-vertical line.
How do I find the x-intercept?
Set y to zero and solve for x, which gives x = −b ÷ m. It's the point where the line crosses the horizontal axis. A horizontal line (slope 0) has no x-intercept unless it lies on the axis; a vertical line's x-intercept is its constant x-value.
What if the two points have the same x-value?
Then the line is vertical, with an undefined slope (the run is zero, so you'd divide by zero). It can't be written as y = mx + b. Instead it's described simply as x equals that shared value — for example, x = 3.