Line Equation Calculator

Calculate line equations from two points or point and slope. Get slope-intercept, point-slope, and standard forms with visualization.

Two Points
Point & Slope
Slope & Intercept

Two-Point Formula: Given points (x₁, y₁) and (x₂, y₂), the slope is m = (y₂ - y₁)/(x₂ - x₁)

Then the line equation is: y - y₁ = m(x - x₁) or y = mx + b where b = y₁ - mx₁

Enter as decimal or fraction like 3/4 or 1 1/2
Enter as decimal or fraction like 3/4 or 1 1/2
Enter as decimal or fraction like 3/4 or 1 1/2
Enter as decimal or fraction like 3/4 or 1 1/2

Point-Slope Formula: Given point (x₁, y₁) and slope m, the line equation is: y - y₁ = m(x - x₁)

Enter as decimal or fraction like 3/4 or 1 1/2
Enter as decimal or fraction like 3/4 or 1 1/2
Positive slope = line rises, Negative slope = line falls, 0 = horizontal line
Enter as decimal or fraction like 3/4 or -2/3

Slope-Intercept Form: y = mx + b where m is the slope and b is the y-intercept

Enter as decimal or fraction like 3/4 or -2/3
Enter as decimal or fraction like 3/4 or -1 1/2
Range of x-values to display on the graph
Calculating...

Understanding Line Equations

In coordinate geometry, a straight line can be represented by various equations. The most common forms are slope-intercept, point-slope, and standard form. Each has its own advantages depending on the given information.

Key Line Equation Forms:

1. Slope-Intercept Form: y = mx + b

- m is the slope (steepness of the line)

- b is the y-intercept (where line crosses y-axis)

- Most common form for graphing and analysis

2. Point-Slope Form: y - y₁ = m(x - x₁)

- (x₁, y₁) is a known point on the line

- m is the slope

- Useful when you know a point and the slope

3. Standard Form: Ax + By = C

- A, B, and C are integers (usually with A ≥ 0)

- Useful for finding x and y intercepts easily

- Can represent vertical lines (B = 0)

Special Cases

1

Horizontal Lines: Slope m = 0, equation: y = b (constant)

Example: y = 3 is a horizontal line through (0,3)

2

Vertical Lines: Slope is undefined, equation: x = a (constant)

Example: x = 2 is a vertical line through (2,0)

3

Parallel Lines: Have the same slope (m₁ = m₂)

Example: y = 2x + 1 and y = 2x - 3 are parallel

4

Perpendicular Lines: Slopes are negative reciprocals (m₁ × m₂ = -1)

Example: y = 2x + 1 and y = -½x + 3 are perpendicular

Slope Interpretation

Slope Value Line Direction Angle with x-axis Example
m > 0 Rises to the right 0° < θ < 90° y = 2x + 1 (steep rise)
m < 0 Falls to the right 90° < θ < 180° y = -3x + 2 (steep fall)
m = 0 Horizontal y = 5 (flat line)
m = 1 45° upward 45° y = x
m = -1 45° downward 135° y = -x
m = undefined Vertical 90° x = 3

Applications of Line Equations

  • Physics: Motion with constant velocity (position vs. time graphs)
  • Economics: Supply and demand curves, cost functions
  • Engineering: Stress-strain relationships, electrical circuits
  • Data Science: Linear regression, trend lines
  • Computer Graphics: Line drawing algorithms, 3D rendering
  • Navigation: Course plotting, GPS systems

Calculator Features:

  • Three input methods: Two points, point & slope, slope & intercept
  • Calculates all common line equation forms
  • Handles special cases (vertical, horizontal lines)
  • Computes intercepts, angle, and other line properties
  • Visualizes the line with points and intercepts
  • Uses exact fractions for precise calculations

Frequently Asked Questions

Slope-intercept form (y = mx + b) requires knowing the slope and y-intercept, making it ideal for graphing. Point-slope form (y - y₁ = m(x - x₁)) requires knowing a point on the line and the slope, making it useful when you don't know the y-intercept. Both can be converted to each other through algebraic manipulation.

For vertical lines, use the "Two Points" method with the same x-coordinate for both points (e.g., (2,1) and (2,3)). The calculator will detect this special case and display the equation as x = constant. The slope will be shown as "undefined" or "infinite".

Yes! First calculate the slope of the given line. For a parallel line, use the same slope with a different point. For a perpendicular line, use the negative reciprocal of the slope (-1/m). You can then use the "Point & Slope" method with the new slope and your desired point.

If you enter two identical points, there are infinitely many lines passing through that single point. The calculator will show an error because a unique line cannot be determined from a single point. You need either two distinct points or one point and a slope.

The angle θ between the line and the positive x-axis is calculated using the arctangent of the slope: θ = arctan(m). The result is converted to degrees. For positive slopes, the angle is between 0° and 90°. For negative slopes, we add 180° to get an angle between 90° and 180°.

The calculator uses the Fraction.js library to handle fractions precisely. You can input values as fractions (like 3/4 or 1 1/2) or decimals. The calculator will display results as simplified fractions when possible. For example, a slope of 0.5 will be shown as 1/2, and the equation will use fractional coefficients when appropriate.