Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Equation of the Line
y = 2x − 2
slope-intercept form
Slope (m) 2
Y-intercept (b) -2

What this calculator does

This tool finds the equation of a straight line when you know its slope (\(m\)) and the coordinates of one point it passes through (\(x_1\), \(y_1\)). It returns the result in the familiar slope-intercept form \(y = mx + b\), ready to graph or use in further algebra.

How to use it

Enter the slope \(m\), then the x-coordinate (\(x_1\)) and y-coordinate (\(y_1\)) of any point on the line. The calculator instantly computes the y-intercept and assembles the full equation. Slopes and coordinates can be positive, negative, or decimal values.

The formula explained

Start from the point-slope form, \(y - y_1 = m(x - x_1)\). Distributing the slope gives \(y = m(x - x_1) + y_1\). Expanding produces $$y = mx + (y_1 - m\cdot x_1),$$ so the y-intercept is \(b = y_1 - m\cdot x_1\). With \(m\) and \(b\) known, the line is fully described by \(y = mx + b\).

Advertisement
Line on coordinate axes showing a given point, the slope, and the y-intercept
The line is built from one known point and the slope, then rewritten to find the y-intercept b.

Worked example

Suppose \(m = 2\) and the line passes through \((3, 4)\). Then $$b = 4 - 2\cdot 3 = 4 - 6 = -2.$$ The equation is therefore \(y = 2x - 2\). You can verify by plugging in \(x = 3\): \(y = 2(3) - 2 = 4\), which matches the point.

Worked example showing a point and the resulting line through it with slope triangle
Plotting the example point and slope gives the full line and its intercept.

FAQ

What if the slope is zero? A slope of 0 gives a horizontal line \(y = y_1\), where \(b\) equals \(y_1\).

Can it handle vertical lines? No. Vertical lines have an undefined slope and cannot be written as \(y = mx + b\); they take the form \(x = x_1\) instead.

What is the y-intercept? It is the value of \(y\) where the line crosses the y-axis (\(x = 0\)), equal to \(b = y_1 - m\cdot x_1\).

Last updated: