Straight line graph y = mx + c — gradient and intercepts

Move the sliders for m and c in y = mx + c: the straight line moves on the graph, and the calculator shows the gradient, the angle with the x-axis, where the line crosses the axes and whether the linear graph is increasing or decreasing.

y = 2x − 1
−5 5 −6 −4 −2 2 4 6 xy (0, −1) (0.5, 0)

Drag the sliders and the graph and its properties update straight away. Drag the graph with the mouse to move it, and use the buttons in the top right to zoom in and out.

Equation of the line
y = 2x − 1

y = 2x − 1 has a positive gradient, so the line slopes upwards; it crosses the x-axis at (0.5, 0).

Step-by-step breakdown
  1. Gradient m2
  2. Angle with the x-axis63.43°
  3. y-intercept(0, −1)
  4. Roots (x-intercepts)(0.5, 0)
  5. Increasing or decreasingincreasing over the whole domain
  6. Domain(−∞, +∞)
  7. Range(−∞, +∞)

Formula

y=mx + c

m is the gradient: it sets how steep the line is, and the tangent of the angle between the line and the x-axis equals m. c is the y-intercept: the line crosses the y-axis at (0, c).

How we got there

y = 2x − 1

A linear graph is a straight line, so two points are enough to draw it; the table of values below gives five.

How to draw a straight line graph

  1. Make a table of values for two values of x

    For y = 2x − 1: when x = 0, y = −1; when x = 2, y = 3.

  2. Plot the points

    The points are (0, −1) and (2, 3).

  3. Draw a straight line through them

    The line crosses the y-axis at (0, c), here (0, −1).

  4. Find the root

    Solve mx + c = 0: 2x − 1 = 0, so x = 0.5. This is where the line crosses the x-axis.

Graphs still giving you trouble? Find a maths tutor for Year 8

How m and c change the line

Increase m and the line gets steeper; make m negative and it slopes the other way. Changing c moves the line up or down without changing its gradient.

The angle α between the line and the x-axis satisfies tan α = m. For m = 1, the angle is 45°.

Where straight line graphs come up

Any quantity that changes at a steady rate: distance at a constant speed, s = vt + s₀; a taxi fare with a fixed charge plus a price per mile; converting degrees Celsius to Fahrenheit.

That is why y = mx + c is a core GCSE topic: you need to read m and c off a graph, and draw the graph from its equation.

Common mistakes

  • Mixing up m and c: c is not the gradient but where the line crosses the y-axis.
  • Finding the root as x = c/m instead of x = −c/m.
  • Thinking y = 3 is not a linear graph: it is a horizontal straight line with m = 0.

Table of values

Values of the function at a few points, so you can plot the graph by hand.

y = 2x − 1

xy
−2−5
−1−3
0−1
11
23

Frequently asked questions

The equation of a straight line, where m and c are numbers: m is the gradient and c is the y-intercept. If c = 0, the line y = mx passes through the origin, and y is directly proportional to x.

How much y changes when x increases by 1. If m > 0, the line slopes upwards; if m < 0, it slopes downwards; if m = 0, it is horizontal, parallel to the x-axis.

For the y-axis, substitute x = 0: the point is (0, c). For the x-axis, solve mx + c = 0: x = −c/m, provided m ≠ 0.

The lines y = m₁x + c₁ and y = m₂x + c₂ are parallel when m₁ = m₂ and c₁ ≠ c₂. If m₁ ≠ m₂, the lines intersect, and if m₁ · m₂ = −1, they are perpendicular.

The gradient is m = (y₂ − y₁) / (x₂ − x₁). Then find c by substituting one of the points into y = mx + c. For (1, 3) and (3, 7): m = 4/2 = 2, 3 = 2 + c, so c = 1 and the line is y = 2x + 1.

The domain is all real numbers. The range is all real numbers too, except when m = 0: then the function is constant and takes only the value c.

Struggling with graphs?

Book a free introductory lesson with a Mathema tutor. 30 minutes online, no commitment — we find the gap and the plan to close it.