📘 CodingMarble Learn

Linear Graphs: Straight Lines and y = mx + c

A linear graph is a straight line. Its equation is y = mx + c. m is the gradient (how steep: rise ÷ run). c is the y-intercept (where the line cuts the y-axis). Lines with the same m are parallel. If m₁ × m₂ = −1 the lines are perpendicular. Where two lines cross, both equations are true, so the crossing point solves them together. In real-life graphs the gradient is a rate (like speed) and the area under the graph can be a total (like distance).

🎬 Step-by-step story

  1. This is a graph grid. The x-axis goes left–right and the y-axis goes up–down. Together they cut the grid into four quadrants.
  2. Make a table for y = 2x + 1 and plot the points. They line up in one straight line. That is why it is called a linear graph.
  3. The gradient tells how steep the line is. Go 1 step right (run), then count the steps up (rise). Gradient = rise ÷ run = 2.
  4. Now change c from 1 to 4. The line slides up but does not tilt. c is where the line cuts the y-axis.
  5. The green line has the same gradient, so it is parallel. The purple line has gradient −½, so it is perpendicular. Where two lines cross is the solution of both equations.
  6. Free play: move the m and c sliders. Try a negative m, then m = 0.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why are the points of y = 2x + 1 all on one straight line?

Each time x goes up by 1, y goes up by the same amount (2). Equal steps every time make a straight line.

How do I count the gradient on a graph?

Pick two points on the line. Count how many squares across (run) and how many up or down (rise). Gradient = rise ÷ run, with a minus sign if the line goes down.

Does changing c change how steep the line is?

No. Changing c just slides the line up or down. Watch the line in step 3: it keeps the same tilt.

Why do perpendicular gradients multiply to −1?

Turning a line by 90° swaps rise and run and flips one direction. So the gradient 2/1 becomes −1/2, and 2 × −½ = −1.

What does a negative gradient look like?

It goes down from left to right. Move the m slider below zero in free play to see it.

Coordinates in four quadrants

A point is written as (x, y). First go across (x), then go up or down (y). Remember: "along the corridor, then up the stairs".

The two axes cut the plane into four quadrants:

The midpoint of (x₁, y₁) and (x₂, y₂) is ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2).

Straight lines: y = mx + c

To plot a line, make a table of values: pick some x values, work out y, plot the points and join them with a ruler. If one point is off the line, check your sums.

Every straight line (except a vertical one) can be written as y = mx + c.

Special lines: y = 3 is horizontal; x = −2 is vertical; y = x goes through the origin at 45°.

To find the equation from two points: work out m, then put one point into y = mx + c to find c. If the equation looks different, like 2y − 4x = 6, rearrange it to make y the subject: y = 2x + 3.

Where a line cuts the axes

Put x = 0 to find the y-intercept. Put y = 0 to find the x-intercept (the root).

Parallel and perpendicular lines

Parallel lines never meet. They have the same gradient: y = 2x + 1 and y = 2x − 3 are parallel.

Perpendicular lines meet at a right angle. Their gradients multiply to −1: m₁ × m₂ = −1. So the perpendicular gradient is the negative reciprocal: 2 → −½, −3 → ⅓, ¾ → −4/3.

Example: the line through (4, 1) perpendicular to y = 2x + 5 has m = −½. Then 1 = −½ × 4 + c, so c = 3, and the line is y = −½x + 3.

Solving equations using graphs

Every point on a line makes its equation true. So the point where two lines cross makes both equations true at once. That point is the solution of the simultaneous equations.

Example: draw y = 2x + 1 and y = −x + 7. They cross at (2, 5), so x = 2, y = 5.

To solve 2x + 1 = 4 with a graph, draw y = 2x + 1 and y = 4 and read the x value where they meet (x = 1.5). Graph answers can be a little rough, so check by putting the values back into the equations.

Other graphs you should recognise

Not every graph is a straight line. Learn the shapes so you can spot them:

Moving graphs: y = f(x) + a moves the graph up by a. y = f(x + a) moves it left by a. y = −f(x) reflects it in the x-axis, and y = f(−x) reflects it in the y-axis.

Real-life graphs: gradient and area

In a real-life graph the axes have units, so the gradient is a rate:

For a curved graph, the gradient at a point is the gradient of the tangent there; the area under it can be estimated with strips.

Try it: a graph from your own walk

Walk at a steady pace and count how many steps you take every 10 seconds for one minute. Make a table (time, total steps) and plot it. Is it a straight line? Find the gradient: that is your steps per second. Now walk faster for the next minute: what happens to the line? Then check with the slider in the 3D: a bigger m means a steeper line.

Key formulas and definitions

Worked examples

1. Find the gradient and y-intercept of y = 3x − 5.

Compare with y = mx + c: m = 3 and c = −5. The line goes up 3 for every 1 across and cuts the y-axis at (0, −5).

2. Find the gradient of the line through (1, 2) and (4, 11).

m = (11 − 2) ÷ (4 − 1) = 9 ÷ 3 = 3.

3. Find the equation of the line through (2, 7) with gradient 4.

y = 4x + c. Put in (2, 7): 7 = 8 + c, so c = −1. The line is y = 4x − 1.

4. Rearrange 3y + 6x = 12 into y = mx + c and state the gradient.

3y = −6x + 12, so y = −2x + 4. Gradient −2, y-intercept 4.

5. Find the line perpendicular to y = 3x + 2 that passes through (6, 1).

Perpendicular gradient = −1/3. 1 = −1/3 × 6 + c = −2 + c, so c = 3. The line is y = −⅓x + 3.

6. A car speeds up from 0 to 20 m/s in 10 s, then keeps 20 m/s for 15 s. Find the distance from the velocity–time graph.

Triangle: ½ × 10 × 20 = 100 m. Rectangle: 15 × 20 = 300 m. Total distance = 400 m. Acceleration in the first part = gradient = 20 ÷ 10 = 2 m/s².

Common mistakes

Practice quiz

1. In y = mx + c, what does c tell you?
2. Which line is parallel to y = 5x − 2?
3. The point (−3, 4) is in which quadrant?
4. What is the gradient of a line perpendicular to one with gradient 4?
5. On a distance–time graph, the gradient shows:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is a linear graph?

A graph that is a straight line. Its equation can be written as y = mx + c, where m is the gradient and c is the y-intercept.

How do you find the equation of a line from a graph?

Read c where the line cuts the y-axis. Find m = rise ÷ run between two clear points. Write y = mx + c.

How do you know if two lines are perpendicular?

Multiply their gradients. If the answer is −1, they meet at a right angle.

Where this is taught

England (GCSE, A level)Year 9Algebra
England (GCSE, A level)Year 103.2 Algebra

Learn first

Learn next

Related lessons

All Maths lessons