Math Lab

Line Through Two Points

Straight Lines · Class XI

Choose two points (x₁,y₁) and (x₂,y₂); the line and its slope update automatically.

-3
type a value
-1010
-2
type a value
-1010
4
type a value
-1010
5
type a value
-1010
Live values
  • Slope1
  • y-intercept1
  • Length P₁P₂9.8995
xy
  • Line P₁P₂

Formulas in this lab

  • Slope
    m=y2y1x2x1m = \dfrac{y_2 - y_1}{x_2 - x_1}
  • y-intercept
    c=y1mx1c = y_1 - m x_1
  • Length P₁P₂
    (x2x1)2+(y2y1)2\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}
Tip: Make x₁ = x₂ and the slope blows up , that's a vertical line.

Frequently asked questions

How do I find a line through two points?

Given $(x_1, y_1)$ and $(x_2, y_2)$, the slope is $m = \frac{y_2 - y_1}{x_2 - x_1}$ and the equation is $y - y_1 = m(x - x_1)$. So for $(1, 2)$ and $(3, 6)$, $m = 2$ and the line is $y = 2x$. This two-point form is unavoidable in coordinate geometry.

How do I use the two-point line lab?

Slide the four coordinates $x_1, y_1, x_2, y_2$. The lab computes slope $m$, y-intercept $c$ and writes the equation $y = mx + c$. Test edge cases like $x_1 = x_2$ (vertical line, undefined slope) to see how the lab handles division by zero.

Vertical line trap: why does $x_1 = x_2$ break the formula?

The slope $m = (y_2 - y_1)/(x_2 - x_1)$ has zero in the denominator. The line is vertical, equation $x = x_1$, and slope is undefined. Many students write $m = \infty$ — formally wrong. Board examiners deduct marks; the lab shows NaN so you learn to spot the case.

Where is the two-point form used in real life?

Plotting a child's growth chart from height at age 5 and age 10 gives a line; the slope is the growth rate per year. Trend lines on a Sensex chart, dose-response in pharmacology, and depreciation of a Maruti Swift over years all use the same two-point recipe.