Equation of a Line (y = mx + c)
Visualize the slope-intercept form in fully interactive 2D space. Adjust slope and intercept, drag the x-coordinate, and watch the live calculation update in real time.
Parameters
Presets
Graph Explorer
Equation of a Line (y = mx + c): A Practical Guide
Every straight line is two numbers: how steeply it climbs, and where it crosses the vertical axis. Fitting a line to data, and a neuron's decision boundary, are both this equation wearing different vocabulary.
Two numbers describe every straight line
m is the slope — how much y changes for each unit of x. c is the intercept — the value of y when x is zero.
Change m and the line pivots. Change c and it slides up or down without tilting. Those are the only two things a straight line can do.
Finding the line through two points
Given (1, 5) and (3, 11):
m = (11 − 5) / (3 − 1) = 6 / 2 = 3
Substitute either point back in to get c. Using (1, 5): 5 = 3(1) + c, so c = 2.
The line is y = 3x + 2. Check with the other point: 3(3) + 2 = 11. Correct.
Where it shows up in machine learning
Linear regression is the search for the m and c that put the line closest to a cloud of points.
A neuron computes z = wx + b. That is the same equation with different letters: the weight is the slope, the bias is the intercept.
Higher dimensions keep the idea and add slopes. With two inputs, z = m₁x + m₂y + c is a plane.
What usually goes wrong
Confusing sign with steepness. A slope of −5 is steeper than a slope of 2. The minus sign only says which way it leans.
Expecting every line to fit this form. A vertical line has an undefined slope — x never changes, so the run is zero. Vertical lines are written x = k instead.
In one line
m tilts, c slides — and a neuron's weight and bias are the same two numbers under different names.
Check yourself
0 of …Answer without scrolling back up.
In y = mx + c, what does c control?
A line has slope m = 0. What does it look like?
Why does this one equation matter so much later on?