Slope Calculator and Quadratic Solver: Lines, Roots and Vertices
By FindMySum · Last reviewed
This slope calculator and quadratic solver handles the two equations that dominate high-school algebra: the straight line and the parabola. Give it two points, or one point and a slope, and it returns the slope, the intercepts and the line in three standard forms. Give it the coefficients of ax² + bx + c = 0 and it returns the discriminant, the roots in exact form, the vertex and a graph. Every value is worked in exact fractions, so a slope of −1/2 is shown as −1/2 rather than a long decimal.
Slope from two points
The slope of a line measures how steeply it rises: the change in y divided by the change in x between any two points on it.
m = (y₂ − y₁) ÷ (x₂ − x₁)
The calculator's default points are (1, 2) and (3, 8). The rise is 8 − 2 = 6 and the run is 3 − 1 = 2, so m = 6 ÷ 2 = 3. Every step of one unit to the right raises the line by three units.
Once the slope is known, the y-intercept b comes from substituting either point into y = mx + b: 2 = 3 × 1 + b, so b = −1. The line is y = 3x − 1.
The same two points also give the distance between them, from the Pythagorean theorem: √(2² + 6²) = √40, which simplifies to 2√10 ≈ 6.3246. The midpoint is the average of the coordinates, (2, 5), and the angle the line makes with the positive x-axis is the inverse tangent of the slope, about 71.57°.
Three forms of the same line
The calculator writes the line three ways because different problems call for different forms:
| Form | Default example | Best for |
|---|---|---|
| Slope-intercept, y = mx + b | y = 3x − 1 | Reading the slope and y-intercept, graphing |
| Point-slope, y − y₁ = m(x − x₁) | y − 2 = 3(x − 1) | Writing a line from one point and a slope |
| Standard, Ax + By = C | 3x − y = 1 | Systems of equations, integer coefficients |
Standard form is cleared of fractions and scaled so A is not negative. The line through (−2, 4) and (6, 0), for example, has slope −1/2 and intercept 3, which in standard form is x + 2y = 6.
Special cases: horizontal and vertical lines
If the two points have the same y-coordinate the rise is zero, the slope is zero and the line is horizontal: y equals a constant. If they share an x-coordinate the run is zero, and since division by zero is undefined the slope is undefined. The line is vertical and can only be written x = constant. It has no y-intercept unless it is the y-axis itself. The calculator reports these cases in words rather than producing an error or an enormous number.
The quadratic formula
A quadratic equation has the form ax² + bx + c = 0 with a not equal to zero. Completing the square on this general form produces the quadratic formula:
x = (−b ± √(b² − 4ac)) ÷ 2a
The calculator's default quadratic is x² − 5x + 6 = 0, so a = 1, b = −5 and c = 6. The discriminant is (−5)² − 4 × 1 × 6 = 25 − 24 = 1, its square root is 1, and x = (5 ± 1) ÷ 2 gives x = 2 and x = 3. Because the roots are rational the quadratic factors as (x − 2)(x − 3), and you can check that their sum, 5, equals −b/a and their product, 6, equals c/a.
What the discriminant tells you
The discriminant D = b² − 4ac decides the kind of roots before you finish the calculation:
- D > 0: two different real roots. The parabola crosses the x-axis twice.
- D = 0: one repeated real root. The vertex sits on the x-axis; x² − 6x + 9 = (x − 3)².
- D < 0: no real roots. The parabola stays entirely above or below the axis, and the two roots are complex conjugates. For x² + 2x + 5, D = −16 and x = −1 ± 2i.
When D is positive but not a perfect square, the roots are irrational. The calculator simplifies the square root, pulling out square factors so that √8 becomes 2√2, and shows x² − 2x − 1 = 0 as x = 1 ± √2 together with the decimals −0.4142 and 2.4142.
The vertex and the graph
Every parabola has a turning point, the vertex, at x = −b/2a. That x-coordinate is exactly halfway between the two roots, and the line through it is the axis of symmetry. Substituting it back gives the y-coordinate, c − b²/4a. For the default equation the vertex is (5/2, −1/4): the lowest point, because a is positive and the parabola opens upward. Rewriting the equation as y = (x − 5/2)² − 1/4, the vertex form, shows the same point at a glance.
The graph preview plots the curve over a range chosen to show the vertex and any real roots, and marks them. For a line it plots the two points and the line through them. The preview is meant for checking the shape, not for reading values off; use the exact numbers in the results for that.
Completing the square, step by step
The calculator also solves each quadratic by completing the square and shows the steps with your numbers. For x² − 5x + 6 = 0:
- Move the constant across: x² − 5x = −6.
- Add the square of half the x-coefficient, (−5/2)² = 25/4, to both sides: x² − 5x + 25/4 = −6 + 25/4.
- The left side is now a perfect square: (x − 5/2)² = 1/4.
- Take square roots: x − 5/2 = ±1/2, so x = 2 or x = 3.
When a is not 1, the first step divides through by a: 2x² + 4x − 6 = 0 becomes x² + 2x − 3 = 0, then (x + 1)² = 4 and x = −3 or 1. The completed square is the vertex form in disguise: the right-hand side is the discriminant divided by 4a², so a negative right-hand side, as in (x + 1)² = −4 for x² + 2x + 5, means complex roots, and a right-hand side of 0 means one repeated root. The results show the completed square next to the vertex form.
Finding an endpoint from the midpoint
The midpoint of a segment is the average of its two ends, ((x₁ + x₂)/2, (y₁ + y₂)/2). Turned around, it gives the missing end when you know one end and the midpoint: x₂ = 2xₘ − x₁ and y₂ = 2yₘ − y₁. With the endpoint mode's defaults, one end at (1, 2) and the midpoint at (4, 6), the other end is (7, 10). The calculator then treats the two ends like the two-points mode, so you also get the segment's length (10, a 6-8-10 right triangle), its slope of 4/3 and the line y = (4/3)x + 2/3. If both ends share an x-coordinate the segment is vertical, and the line is given as x = constant.
Exact arithmetic
Each number you type is converted to a fraction from its decimal digits, so 0.1 is exactly 1/10 rather than the nearest binary approximation. Slopes, intercepts, the discriminant, the vertex and any rational roots are calculated with these fractions, which is why a line through (0.1, 0.1) and (0.3, 0.7) has a slope of exactly 3 and an intercept of exactly −1/5.
More questions
How can I tell if two lines are parallel or perpendicular?
Compare their slopes. Parallel lines have equal slopes and different intercepts, so y = 3x − 1 and y = 3x + 4 never meet. Perpendicular lines have slopes whose product is −1: the perpendicular to a line of slope 3 has slope −1/3. A vertical line is perpendicular to every horizontal line, even though its slope is undefined.
How do I find where two lines intersect?
Set their right-hand sides equal and solve for x. For y = 3x − 1 and y = −x + 7, 3x − 1 = −x + 7 gives x = 2, and either equation then gives y = 5, so they cross at (2, 5). Parallel lines have no intersection and identical lines share every point. This calculator finds one line at a time; solve the system by hand or with substitution.
What is the difference between slope and gradient or rate of change?
They are the same idea under different names. Gradient is common in the UK and in physics, rate of change in calculus and economics, and slope in North American algebra. A road with a 6% grade has a slope of 0.06: it rises 6 metres for every 100 metres travelled horizontally.
Can every quadratic be solved by factoring?
No. Factoring with whole numbers or fractions only works when the discriminant is a perfect square of a rational number. x² − 5x + 6 factors as (x − 2)(x − 3), but x² − 2x − 1 has discriminant 8 and roots 1 ± √2, which no rational factoring can produce. The quadratic formula and completing the square always work, which is why the calculator uses the formula and then shows a factored form when one exists.
Why complete the square when the quadratic formula works?
Completing the square is where the quadratic formula comes from, and it gives the vertex form y = a(x − h)² + k at the same time, which tells you the turning point and the range of the function without further work. It is also the standard first step for circles and other conic sections. The calculator shows the steps for your equation: divide by a, move the constant across, add (b/2a)² to both sides and take square roots.
How do I find the other end of a segment from its midpoint?
Double the midpoint and subtract the end you know: x₂ = 2xₘ − x₁ and y₂ = 2yₘ − y₁. One end at (−3, 5) with the midpoint at (2, −1) puts the other end at (7, −7). The calculator's endpoint mode does this and also gives the segment's length, 2√61 ≈ 15.62 here, and the equation of the line through both ends.
Where do quadratic equations show up outside the classroom?
Anywhere a quantity depends on the square of another. The height of a thrown ball over time, the area of a rectangle with a fixed perimeter, stopping distance against speed and the profit from a price change with falling demand all lead to quadratics. The vertex answers the 'highest' or 'best' question (maximum height, largest area), and the roots answer 'when does it hit zero'.
What happens to the parabola when I change a, b or c?
c moves the whole curve up or down and is where it crosses the y-axis. a controls the width and direction: a larger |a| makes the parabola narrower, and a negative a turns it upside down. b shifts the vertex sideways and down or up at the same time, because the vertex sits at x = −b/2a. Changing one coefficient and watching the graph preview is the quickest way to build intuition.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.