There are two ways to use it. [From two points] Enter the coordinates of point 1 and point 2 to get the slope, the distance, the angle and the equation of the line. [From one point and a distance] Leave point 2 blank and enter the distance d and the slope m (or the angle θ) to get the coordinates of the point you reach from point 1.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formulas and graphs
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Enter the coordinates of two points and get the slope \(m\) of the line (the rate of change of a linear function) on the spot
- Along with the slope, it also finds the distance between the two points, the angle of inclination \(\theta\), the equation of the line \(y = mx + b\), the y-intercept and the x-intercept
- It also works the other way: from one point, a distance to move and a slope (or an angle), it finds the coordinates of the point you reach
- A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
What is this calculation used for?
Under the ADA (Americans with Disabilities Act) standards, a wheelchair ramp can have a slope of at most 1:12 (1 up for every 12 across, a slope of about 0.083). Asking "can I build a 30-foot ramp to a porch that is 30 inches high?" is a slope calculation: \(30 \div 360 = \dfrac{1}{12}\) (30 feet = 360 inches), so it just meets the rule. As an angle, that is about 4.8°.
When remodeling a home or designing a building, you can check with numbers whether a ramp is safe to use.
A "10%" on a steep-grade sign says "it rises 10 ft for every 100 ft across", a slope of 0.1. As an angle, that is \(\arctan 0.1 \approx 5.7°\). Surprisingly few people know that 10% is not 10°.
Once you can read this, you can judge how steep a hill is in advance, when choosing a gear in a car or planning a bike or running route.
In the US, the steepness of a roof is given as a pitch such as "4/12" (it rises 4 inches for every 12 inches across, a slope of 1/3). As an angle, that is \(\arctan \dfrac{4}{12} \approx 18.4°\).
Each roofing material can only be used within a certain range of pitches, so roofers and designers use this conversion every day. It also helps when you build a shed roof yourself.
If a trail climbs 1,000 ft over a horizontal distance of 1 mile (5,280 ft) on the map, its average slope is \(1000 \div 5280 \approx 0.19\) (an angle of about 10.7°), and by the Pythagorean theorem the distance you actually walk on the slope is \(\sqrt{5280^2 + 1000^2} \approx 5374\) ft.
Knowing with numbers that "the real distance is longer than on the map, and the slope decides how tiring it is" makes your hiking plans safer.
If monthly sales grew from $40,000 in April to $58,000 in July, the slope is \((58{,}000 - 40{,}000) \div (7 - 4) = 6{,}000\) dollars per month, which reads as "growing by $6,000 a month on average".
The slope of a line graph is the pace of change itself. Finding how fast something changes from its values at two times, whether sales, body weight or temperature, is the same calculation as the slope formula on this page.
Formulas and graphs
Symbols and terms
Symbols
| \(m\) | m | The slope of the line: how much it goes up or down for every 1 across. A positive slope rises from left to right; a negative slope falls. US schools use \(m\) for slope. |
| \((x_1, y_1)\), \((x_2, y_2)\) | x sub 1, y sub 1 | The coordinates of the two points. \(x\) is the horizontal position and \(y\) the vertical position; the small number at the lower right (the subscript) tells "the first point" from "the second point". |
| \(\Delta x\), \(\Delta y\) | delta x, delta y | The change (how much a value changed). \(\Delta\) (delta) is the Greek letter for "change": \(\Delta x = x_2 - x_1\) (the run) and \(\Delta y = y_2 - y_1\) (the rise). |
| \(d\) | d | The distance between the two points, from the first letter of "distance". |
| \(\theta\) | theta | A Greek letter often used for angles. On this page, it is the angle between the line and the x-axis (the angle of inclination). |
| \(b\) | b | The y-intercept: the height where the line crosses the y-axis (the value of \(y\) when \(x = 0\)). |
| \(\tan\) | tangent | A trigonometric ratio: "opposite ÷ adjacent", or "up ÷ across", for an angle. The slope of a line is linked to its angle by \(m = \tan\theta\). |
| \(\arctan\) | arctangent | The inverse of tangent: it finds "the angle whose tan is that number". On a scientific calculator it is shown as tan⁻¹. |
Terms
| slope | A number that shows how steep a line is: how much \(y\) increases when \(x\) increases by 1 ("rise over run"). The larger it is, the steeper the line. The grade of a road and the pitch of a roof use the same idea. |
| rate of change | (change in y) ÷ (change in x). It is taught with linear functions in Grade 8, and for a linear function it is exactly the same as the slope of the line. |
| linear function | A function of the form \(y = mx + b\). Its graph is a straight line, with slope \(m\) and y-intercept \(b\) (US schools write \(y = mx + b\); some other countries write \(y = ax + b\)). |
| intercept | Where a graph crosses an axis. The height where it crosses the y-axis is the y-intercept (\(y\) when \(x = 0\)), and where it crosses the x-axis is the x-intercept (\(x\) when \(y = 0\)). |
| angle of inclination | The angle a line makes with the x-axis (the horizontal). It is linked to the slope by \(m = \tan\theta\). |
| grade (pitch) | Everyday names for the steepness of a road, ramp or roof. A "10% grade" road sign says "it rises 10 ft for every 100 ft across", which is a slope of 0.1. Roof pitch is given as rise per 12 inches of run, such as 4/12. |
| coordinates | A pair of numbers (horizontal position, vertical position) that gives the location of a point. The point (3, 4) is "3 to the right and 4 up from the origin". Taught in Grade 6. |
| vertical line | A line perpendicular to the x-axis (going straight up). The change in x is 0, so the slope formula would divide by 0, and the slope is undefined. Its equation is not of the form \(y = mx + b\) but \(x = \text{constant}\). |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back over these topics is the quickest way forward.
| The coordinate plane (Grades 5–6) |
|
| Adding and subtracting integers (Grades 6–7) |
|
| Linear functions and rate of change (Grade 8) |
|
| The Pythagorean theorem (Grade 8) |
|
| The tangent ratio (Geometry) |
|
How to calculate it in Excel
| Point 1 x-coordinate x₁ | 3 |
| Point 1 y-coordinate y₁ | 4 |
| Point 2 x-coordinate x₂ | 6 |
| Point 2 y-coordinate y₂ | 8 |
| Slope m | =(B4-B2)/(B3-B1) |
| Point 1 x-coordinate x₁ | 3 |
| Point 1 y-coordinate y₁ | 4 |
| Point 2 x-coordinate x₂ | 6 |
| Point 2 y-coordinate y₂ | 8 |
| Distance between the points d | =SQRT((B3-B1)^2+(B4-B2)^2) |
| Point 1 x-coordinate x₁ | 3 |
| Point 1 y-coordinate y₁ | 4 |
| Point 2 x-coordinate x₂ | 6 |
| Point 2 y-coordinate y₂ | 8 |
| Angle of inclination θ (degrees) | =DEGREES(ATAN2(B3-B1,B4-B2)) |
| x-coordinate of a point on the line x₁ | 1 |
| y-coordinate of a point on the line y₁ | 5 |
| Slope m | -2 |
| y-intercept b | =B2-B3*B1 |
| x-intercept | =-B4/B3 |
| Point 1 x-coordinate x₁ | 1 |
| Point 1 y-coordinate y₁ | 1 |
| Distance to move d | 5 |
| Slope m | 0.75 |
| Change in x Δx | =B3/SQRT(1+B4^2) |
| Change in y Δy | =B4*B5 |
| x-coordinate reached x₂ | =B1+B5 |
| y-coordinate reached y₂ | =B2+B6 |
"SQRT(…)" is the square root, "^2" squares a number, "DEGREES(…)" converts radians to degrees, and "ATAN2(change across, change up)" finds the angle from the changes in the two directions.
The first table gives a slope of about 1.333, the second a distance of 5, and the third an angle of about 53.13°. ATAN2 in the third table returns negative angles (from −180° to 180°), so for a line that falls from left to right, add 360 if you want the angle from 0 to 360°.
The fifth table finds the solution that goes to the right (the point (5, 4) in the example). For the solution that goes to the left, put a minus sign at the start of the Δx formula (=-B3/SQRT(1+B4^2)).
How to calculate it in Google Sheets
| Point 1 x-coordinate x₁ | 3 |
| Point 1 y-coordinate y₁ | 4 |
| Point 2 x-coordinate x₂ | 6 |
| Point 2 y-coordinate y₂ | 8 |
| Slope m | =(B4-B2)/(B3-B1) |
| Point 1 x-coordinate x₁ | 3 |
| Point 1 y-coordinate y₁ | 4 |
| Point 2 x-coordinate x₂ | 6 |
| Point 2 y-coordinate y₂ | 8 |
| Distance between the points d | =SQRT((B3-B1)^2+(B4-B2)^2) |
| Point 1 x-coordinate x₁ | 3 |
| Point 1 y-coordinate y₁ | 4 |
| Point 2 x-coordinate x₂ | 6 |
| Point 2 y-coordinate y₂ | 8 |
| Angle of inclination θ (degrees) | =DEGREES(ATAN2(B3-B1,B4-B2)) |
| x-coordinate of a point on the line x₁ | 1 |
| y-coordinate of a point on the line y₁ | 5 |
| Slope m | -2 |
| y-intercept b | =B2-B3*B1 |
| x-intercept | =-B4/B3 |
| Point 1 x-coordinate x₁ | 1 |
| Point 1 y-coordinate y₁ | 1 |
| Distance to move d | 5 |
| Slope m | 0.75 |
| Change in x Δx | =B3/SQRT(1+B4^2) |
| Change in y Δy | =B4*B5 |
| x-coordinate reached x₂ | =B1+B5 |
| y-coordinate reached y₂ | =B2+B6 |
How to calculate it in Python
import math
x1, y1 = 3.0, 4.0 # coordinates of point 1
x2, y2 = 6.0, 8.0 # coordinates of point 2
delta_x = x2 - x1 # change in x (run)
delta_y = y2 - y1 # change in y (rise)
slope = delta_y / delta_x # slope m (if delta_x is 0, the line is vertical and this fails)
distance = math.hypot(delta_x, delta_y) # distance between the points (same as √(Δx²+Δy²))
angle = math.degrees(math.atan2(delta_y, delta_x)) % 360 # angle (0 to 360°)
y_intercept = y1 - slope * x1 # y-intercept b
print(f"Slope m: {slope}")
print(f"Distance d: {distance}")
print(f"Angle θ: {angle}")
print(f"Equation of the line: y = {slope}x + {y_intercept}")
# The other way: the point reached by moving a distance d from point (x1, y1) along the slope
d = 5.0
dx = d / math.sqrt(1 + slope ** 2) # solution going right (going left is -dx)
dy = slope * dx
print(f"Point reached: ({x1 + dx}, {y1 + dy})")
How to write it in LaTeX and other math languages (copy and paste)
m = (y₂ − y₁) ÷ (x₂ − x₁)
m = \frac{y_2 - y_1}{x_2 - x_1}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>m</mi>
<mo>=</mo>
<mfrac>
<mrow><msub><mi>y</mi><mn>2</mn></msub><mo>−</mo><msub><mi>y</mi><mn>1</mn></msub></mrow>
<mrow><msub><mi>x</mi><mn>2</mn></msub><mo>−</mo><msub><mi>x</mi><mn>1</mn></msub></mrow>
</mfrac>
</mrow>
</math>
m = (y_2 - y_1)/(x_2 - x_1)
(y2 - y1)/(x2 - x1)
m := (y2 - y1)/(x2 - x1);
m = (y2 - y1)/(x2 - x1);
m = (y_2 - y_1)/(x_2 - x_1)
d = √(Δx² + Δy²)
d = \sqrt{\Delta x^2 + \Delta y^2}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>d</mi>
<mo>=</mo>
<msqrt>
<mrow>
<msup><mrow><mi mathvariant="normal">Δ</mi><mi>x</mi></mrow><mn>2</mn></msup>
<mo>+</mo>
<msup><mrow><mi mathvariant="normal">Δ</mi><mi>y</mi></mrow><mn>2</mn></msup>
</mrow>
</msqrt>
</mrow>
</math>
d = sqrt((Delta x)^2 + (Delta y)^2)
Sqrt[dx^2 + dy^2]
d := sqrt(dx^2 + dy^2);
d = sqrt(dx^2 + dy^2);
d = √(Δx^2 + Δy^2)
θ = arctan(m)
\theta = \arctan m
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>θ</mi>
<mo>=</mo>
<mi>arctan</mi>
<mo>⁡</mo>
<mi>m</mi>
</mrow>
</math>
theta = arctan(m)
ArcTan[m]
theta := arctan(m);
theta = atan(m);
θ = arctan(m)
y = mx + b (b = y₁ − m·x₁)
y = mx + b, \quad b = y_1 - m x_1
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>y</mi>
<mo>=</mo>
<mi>m</mi><mi>x</mi>
<mo>+</mo>
<mi>b</mi>
<mo>,</mo>
<mi>b</mi>
<mo>=</mo>
<msub><mi>y</mi><mn>1</mn></msub>
<mo>−</mo>
<mi>m</mi><msub><mi>x</mi><mn>1</mn></msub>
</mrow>
</math>
y = m x + b, b = y_1 - m x_1
b = y1 - m*x1; y = m*x + b
b := y1 - m*x1; y := m*x + b;
b = y1 - m*x1; y = m*x + b;
y = mx + b, b = y_1 - mx_1
Δx = ±d ÷ √(1 + m²), Δy = m·Δx
\Delta x = \pm\frac{d}{\sqrt{1 + m^2}}, \quad \Delta y = m\,\Delta x
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mrow><mi mathvariant="normal">Δ</mi><mi>x</mi></mrow>
<mo>=</mo>
<mo>±</mo>
<mfrac>
<mi>d</mi>
<msqrt><mrow><mn>1</mn><mo>+</mo><msup><mi>m</mi><mn>2</mn></msup></mrow></msqrt>
</mfrac>
<mo>,</mo>
<mrow><mi mathvariant="normal">Δ</mi><mi>y</mi></mrow>
<mo>=</mo>
<mi>m</mi>
<mrow><mi mathvariant="normal">Δ</mi><mi>x</mi></mrow>
</mrow>
</math>
Delta x = +-d/sqrt(1 + m^2), Delta y = m Delta x
dx = d/Sqrt[1 + m^2]; dy = m*dx
dx := d/sqrt(1 + m^2); dy := m*dx;
dx = d/sqrt(1 + m^2); dy = m*dx;
Δx = ±d/√(1 + m^2), Δy = mΔx
How to have ChatGPT do the calculation
You are a math calculation assistant. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). For the two points (3, 4) and (6, 8) on the coordinate plane, find each of the following: 1. The slope m of the line through the two points 2. The distance d between the two points 3. The angle θ (in degrees) between the line and the x-axis 4. The equation of the line y = mx + b (also show the value of the y-intercept b) Show the formulas you used and the numbers from the execution result.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
