Skip to content

Slope, Line & Quadratic Equation Solver

Find the slope and equation of a line from two points or a point and slope, or solve a quadratic equation with exact roots, discriminant, vertex and graph.

Calculator Details

Equation of the line:y = 3x − 1See results ↓

Slope and line through two points, a line from a point and a slope, the other endpoint from a midpoint, or a quadratic equation

x-coordinate of the first point

y-coordinate of the first point

x-coordinate of the second point

y-coordinate of the second point

Your Results

Equation of the line: y = 3x − 1

Equation of the line

y = 3x − 1

Slope m = 3

Slope (m)

3

Graph

P₁P₂
Line y = 3x − 1. Axes cross at (0, 0); not to scale.

The slope is 3 and the line is y = 3x − 1; the points are 2√10 apart.

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Detailed Breakdown

Properties of the line y = 3x − 1
PropertyExactNote
Slope (m)3
y-intercept (b)−1
x-intercept1/3
Slope-intercept formy = 3x − 1y = mx + b
Point-slope formy − 2 = 3(x − 1)y − y₁ = m(x − x₁)
Standard form3x − y = 1Ax + By = C
Angle of inclination71.56505118°From the positive x-axis
Distance between points2√10≈ 6.32455532
Midpoint(2, 5)

How This Calculator Works

How the Line Is Found

Slope first, then the intercept from one known point, all in exact fractions:

m = (y₂ − y₁) ÷ (x₂ − x₁) = (8 − (2)) ÷ (3 − (1)) = 6 ÷ 2 = 3

b = y₁ − m·x₁ = 2 − (3)·(1) = −1

y = 3x − 1

d = √(Δx² + Δy²) = √((2)² + (6)²) = 2√10

Frequently Asked Questions

How do you find the slope between two points?

Divide the change in y by the change in x: m = (y₂ − y₁) ÷ (x₂ − x₁), often called rise over run. For (1, 2) and (3, 8) that is (8 − 2) ÷ (3 − 1) = 6 ÷ 2 = 3: the line rises 3 units for every unit it moves right. The order of the points does not matter as long as you subtract in the same order on top and bottom.

What do positive, negative, zero and undefined slopes mean?

A positive slope rises from left to right and a negative slope falls. A slope of 0 is a horizontal line (y = constant). When both points have the same x-coordinate the run is 0, division by zero is impossible, and the slope is undefined: the line is vertical, written x = constant, and has no slope-intercept form.

What are slope-intercept, point-slope and standard form?

They are three ways to write the same line. Slope-intercept form y = mx + b shows the slope m and where the line crosses the y-axis (b). Point-slope form y − y₁ = m(x − x₁) uses any known point on the line. Standard form Ax + By = C uses whole numbers with A not negative, which is handy for solving systems. The calculator gives all three, with fractions kept exact.

How does the quadratic formula work?

For ax² + bx + c = 0 with a ≠ 0, the solutions are x = (−b ± √(b² − 4ac)) ÷ 2a. It comes from completing the square on the general equation. For x² − 5x + 6 = 0: a = 1, b = −5, c = 6, so x = (5 ± √1) ÷ 2, giving 3 and 2.

What does the discriminant tell you?

The discriminant D = b² − 4ac is the part under the square root. If D is positive there are two different real roots and the parabola crosses the x-axis twice; if D = 0 there is one repeated root and the vertex touches the axis; if D is negative there are no real roots, the parabola never reaches the axis, and the roots are a pair of complex numbers. If D is a perfect square (of a fraction) the roots are rational and the quadratic factors neatly.

Why are some roots shown with a square root sign?

When the discriminant is not a perfect square the roots are irrational, so no fraction or terminating decimal equals them exactly. The calculator simplifies the radical (√8 = 2√2) and shows the exact form, such as 1 ± √2, next to a 10-digit decimal approximation. Keep the exact form if you need to continue working algebraically.

What is the vertex of a parabola and how is it found?

The vertex is the turning point of y = ax² + bx + c: the lowest point when a > 0 and the highest when a < 0. Its x-coordinate is −b ÷ 2a, halfway between the roots, and its y-coordinate is the value of the quadratic there, c − b² ÷ 4a. For x² − 5x + 6 the vertex is (5/2, −1/4). The vertex form y = a(x − h)² + k shows it directly.

How do you complete the square?

Divide by a, move the constant to the right, then add (b ÷ 2a)² to both sides so the left side becomes a perfect square. For x² − 5x + 6 = 0: x² − 5x = −6, add (−5/2)² = 25/4 to get (x − 5/2)² = 1/4, so x − 5/2 = ±1/2 and x = 2 or 3. The calculator shows these steps for your equation, and the completed square gives the vertex form y = (x − 5/2)² − 1/4 directly.

How do I find an endpoint from the midpoint?

The midpoint is the average of the two ends, so the missing end is twice the midpoint minus the known end: x₂ = 2xₘ − x₁ and y₂ = 2yₘ − y₁. With one end at (1, 2) and the midpoint at (4, 6), the other end is (2·4 − 1, 2·6 − 2) = (7, 10). Choose "Other endpoint from a midpoint" to get it with the segment length and the line through both ends.

Can I enter decimals or negative numbers?

Yes. Each number is converted to an exact fraction from its decimal digits (0.1 becomes 1/10), so results such as a slope of −1/5 come out exactly rather than as −0.19999999. Negative coordinates and coefficients work normally; use the minus sign on your keyboard.

Included: slope, intercepts, slope-intercept, point-slope and standard forms, distance, midpoint and angle for lines; the other endpoint of a segment from one end and the midpoint; discriminant, exact real or complex roots, vertex, vertex and factored forms and completing the square step by step for quadratics. Inputs are converted to exact fractions from their decimal digits.

Left out: cubic and higher-degree equations, systems of equations, inequalities and fraction input such as 1/3 (enter 0.3333 or scale the equation). The graph is a preview, not to scale.

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:

FormDefault exampleBest for
Slope-intercept, y = mx + by = 3x − 1Reading 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 = C3x − y = 1Systems 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:

  1. Move the constant across: x² − 5x = −6.
  2. Add the square of half the x-coefficient, (−5/2)² = 25/4, to both sides: x² − 5x + 25/4 = −6 + 25/4.
  3. The left side is now a perfect square: (x − 5/2)² = 1/4.
  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.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy