Set the slope and intercept, then track how y changes as x moves. Switch to 3D to explore a line with both y and z coordinates.
Parameters
Slope (m)
Y-Int (c)
Slope (mz)
Z-Int (cz)
-10010
Presets
Graph Explorer
Click points & drag arrows
Live Calc
General Form
y=mx+c
z=mzx+cz
Current Equation
Evaluating Point X
Let x = 2
y = (1)(2) + 0 = 2
z = (0)(2) + 0 = 0
Resulting Coordinates
( 2, 2 )
Overview
Read slope and intercept
y = mx + c
The slope m is the rate of change: how much y changes for each unit change in x. A positive slope rises as x increases; a negative slope falls; zero makes a horizontal line. The intercept c is the y-coordinate where the line crosses the y-axis, at (0, c).
For y = 2x + 1, x = 0 gives y = 1, and every increase of 1 in x raises y by 2. In the graph, set Slope (m) to 2 and Y-Int (c) to 1. Changing c to 3 moves every point up by 2; changing m changes how quickly y rises.
Read a Line from Its Equation
In y = mx + c, m gives the change in y for each unit of x; c gives y when x = 0. Change either value in the graph to see its effect.
Build a line from two points
For points (1, 5) and (3, 11), the slope is
m = (11 − 5) / (3 − 1) = 3
Substitute either point into y = mx + c. Using (1, 5), 5 = 3(1) + c, so c = 2. The line is y = 3x + 2; checking the second point gives 11 = 3(3) + 2.
The same line can be written in point-slope form as y - 5 = 3(x - 1), which starts from a known point and slope. Rearranging gives slope-intercept form, y = 3x + 2, or standard form, 3x - y + 2 = 0.
This method fails when the two points have the same x-coordinate: the run is zero, so the slope is undefined. That line is vertical and has the form x = k; it cannot be written as y = mx + c.
Fit a line to measured data
Real measurements rarely land exactly on one line. Ordinary least squares chooses the slope and intercept that minimise the sum of squared vertical residuals. With an intercept, the fitted coefficients are
m = Σ[(x − x̄)(y − ȳ)] / Σ[(x − x̄)²] c = ȳ − m x̄
For example, fitting the points (1, 2.1), (2, 4.2), (3, 5.8), (4, 8.1), (5, 9.9) gives y = 1.95x + 0.17. In this range, a one-unit increase in x is associated with about a 1.95-unit increase in y. That describes an association; it does not show that x causes y. A straight-line fit can also be misleading when the relationship curves or when it is extrapolated far beyond the measured x-values.
A classifier with two input features can place its decision boundary where w₁x₁ + w₂x₂ + b = 0. When w₂ ≠ 0, rearranging gives x₂ = −(w₁/w₂)x₁ − b/w₂, which is a line: its slope is −w₁/w₂ and its intercept is −b/w₂. This is why a linear model's boundary can be drawn as a line, while its coefficients are not each individually “the slope” or “the intercept.” See the perceptron lesson for the weighted-sum form.
Try this above
Press Horizontal. The slope is zero, so moving x does not change y.
Press Negative. The line falls from left to right; the sign sets direction, while the absolute value sets steepness.
Set Slope (m) to 2 and Y-Int (c) to 1. Move the x control and check that each increase of 1 raises y by 2.
Change only Y-Int (c). The line shifts without changing its slope.
Switch to 3D Space and vary the second slope. The visualiser traces a 3D line whose y and z coordinates each change with x.
About to run: Slope (m). Before it does — what happens to the readout?
Committing to an answer first is the point — the reveal runs the experiment on the visualisation above and reads the real value back, so nothing here is scripted.
Check yourself
0 of 4
Answer without scrolling back up.
In y = mx + c, what does c control?
c is the intercept: it slides the whole line up and down without rotating it. m is the slope, and it is the only term that changes the steepness.
A line has slope m = 0. What does it look like?
Slope is rise over run. A zero rise for any run is a flat, horizontal line. A vertical line is the case with no defined slope at all, because the run is zero and you cannot divide by it.
Why does this one equation matter so much later on?
w·x + b is y = mx + c with more inputs. Weights play the role of slopes and the bias plays the role of the intercept, which is why a perceptron can only ever draw a straight boundary.
For y = 3x + 2, what changes if the intercept becomes 4 and the slope stays 3?
The intercept sets y when x = 0. Increasing c from 2 to 4 shifts every point up by 2 without changing the slope.
Cheat sheet
Equation of a Line (y = mx + c)
Drag slope and intercept and watch y = mx + c respond. See slope-intercept, point-slope and standard form describe the same line.
Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.