Math AAHL
Math AASL
Terms of Service
Login
Sign Up
erplex
LoginJoin
IB Math AAHL
/
2: Functions
/
Cartesian plane & lines

Cartesian plane & lines

erplex

© 2025 Perplex Learning Incorporated. All rights reserved.

All content on this website has been developed independently from and is not endorsed by the International Baccalaureate Organization. International Baccalaureate and IB are registered trademarks owned by the International Baccalaureate Organization.

TeamContactTerms of ServicePrivacy Policy

Equations of a Line

In the previous section, we talked about lines briefly, in the context of constructing a line between two points. We calculated the distance between any two points, learned how to find a midpoint, and defined the concept of the gradient, or "steepness," of the line connecting these points.


With every concept we discussed, we went from two points to a line between them. In this section, our goal will be to define lines outside of this framework, so we can go from finding the equation for a line to choosing two points anywhere on it.

Powered by Desmos

Powered by Desmos

In this section, we will learn several different ways to write the equation of a line.

A line's equation describes its path on the coordinate plane by defining the relationship between the x- and y- values of every point on the line. Since y is the dependent variable and x is independent, we often write equations with "y=" on the left and an equation in terms of x on the right. This way, for every value of x we plug in, the equation returns the value of y on the line and at the x coordinate we specified. You can think of an equation like a set of instructions for where to plot y based on your choice of x.


Let's think about the gradient using this "equation as a set of instructions" framework. We already know that gradients represent steepness. A gradient of m tells you: for every one step you move right in the x direction, go m steps (up if positive, down if negative) in the y direction.

Powered by Desmos

We can also generalize this beyond one step, and get at the core idea of what x and y represent: for every x steps you move in the x direction, go mx steps in the y direction.

Checkpoint

A line with gradient m=−23​ passes through the point (1,2).

Find the y-coordinate of the line where x=3.

Select the correct option

A line's gradient isn't the only number that determines what it looks like or how it behaves. Another important value in determining the behavior of a line is its y-intercept, usually denoted c.


The y-intercept of a line is the value of y where the line passes through the y-axis, which occurs when x=0. Try dragging around the y-intercept on the graph below to see how changing the y-intercept changes the line.

Powered by Desmos

Note that some resources refer to both an x- and y-intercept. The x-intercept occurs is the value of x where the line passes through the x-axis, which occurs when y=0. We won't be working too much with x-intercepts, but this is a good term to know as you continue your math education and refer to other resources.

Powered by Desmos

Now that we've defined the gradient and y-intercept, we can write our first equation for a given line. We can give the equation of any one line in many different forms, and perhaps the most common is gradient-intercept form, which we have been exploring.

Gradient-intercept form

A straight line is defined by its gradient and its y-intercept. The gradient-intercept equation of a line is thus:

y=mx+c📖

Discussion

Now that we have this equation, try playing around with changing both the gradient and y-intercept at the same time to see how changing a line's equation changes the line itself.

Powered by Desmos

What does each part, mx and c, actually do to change the geometry of the line?


If you were given the slope m and some point (x,y) on the line but not given the y-intercept c, could you still write an equation for the line? How?

Each line y=mx+c is made up of two parts:

  1. The term mx sets the steepness (gradient): as x increases by 1, y increases by m. A larger positive m makes the line steeper upward; a negative m makes it slope downward.
  2. The constant c shifts the line up or down: it is the y–intercept, i.e. the point (0,c) where the line crosses the y–axis.

If you know the gradient m and a point (x1​,y1​) on the line but not c, start from the gradient–intercept form and determine c by requiring that the line passes through (x1​,y1​):

y1​=mx1​+c

Solve for c:

c=y1​−mx1​

Substitute back into y=mx+c:

y​=mx+(y1​−mx1​)=mx+y1​−mx1​=m(x−x1​)+y1​​

So an equation of the line is

y=mx+(y1​−mx1​)

and you can check it passes through (x1​,y1​) and has slope m.

Checkpoint

A line y with gradient m=−2 passes through the point (3,−5).

Find the value of the y-intercept c, and write the equation of the line in gradient-intercept form.

Select the correct option

We don't need both the gradient and the y-intercept to write the equation of a line. In fact, even if we do have both of these things, sometimes it makes more sense to write the equation in a different form.


Point-gradient form is another common way of giving the equation of a line.

Point-gradient form

If we know a point (x1​,y1​) on a line and the gradient m of the line, we can use the point-gradient form of the line:

y−y1​=m(x−x1​)📖

Try playing around with this diagram and seeing how changing the values of x1​,y1​, and m impacts the graph:

Powered by Desmos

Discussion

What is the relationship between the gradient-intercept and point-gradient forms of an equation for a line? How could you rewrite gradient-intercept as point-gradient, and vice versa?

Starting from the gradient–intercept form

y=mx+c

suppose we know a point (x1​,y1​) on the line. Since that point lies on the line,

y1​=mx1​+c⟹c=y1​−mx1​.

Substitute this back into y=mx+c:

y=mx+(y1​−mx1​)⟹y−y1​=m(x−x1​).

The last equation is exactly the point–gradient (point–slope) form.


Conversely, if you start with

y−y1​=m(x−x1​),

you can expand and collect terms to recover

y=mx+(y1​−mx1​),

so that c=y1​−mx1​. Hence the two forms are algebraically equivalent ways to describe the same line.

Checkpoint

The equation of a line is given by y=m(x−23​)+5.

For what value of m will the line pass through the point (−4,3)?

Select the correct option

Discussion

All of the equations we've covered so far include a "y=" at the beginning. As mentioned above, when sketching curves, this is a very useful way to start an equation -- but it doesn't need to be how we start every equation.


For example, take a look at the line in the graph below.

Powered by Desmos

Can you write an equation for it using one of the forms we already know?

No – a vertical line has no (finite) gradient. Since for any two points on it Δx=0, the “rise over run” m=Δy/Δx would require division by zero and so is undefined. In other words, y cannot be written as a single-valued function of x in the form y=mx+c when the line is vertical.

When lines are horizontal or vertical, they don't have gradients in the form we've come to expect.


We say vertical lines do not have a "well-defined" gradient, since they exist at only one x value and every possible y value. The change in y can be anything we choose depending on the segment, but as we saw above, if we were to try to find the gradient of these lines, we would have to divide by zero:

m=ΔxΔy​=0Δy​=undefined

Even though they don't have a gradient, vertical lines clearly exist. To write their equations, we ignore the y value entirely and instead write the equation for the line exclusively in terms of x. This is a way of saying that the y value doesn't matter. We can choose any y we like and the line will exist, as long as we only use the x value the equation gives us.

Vertical lines

A vertical line does not have a well defined gradient, since there is no "run" - the x-values never change.


We cannot write the equation of a vertical line in the form y=⋯. Instead we write

x=k

for some constant k.

Horizontal lines could be thought of as the "opposite" of vertical lines, since they are defined (they exist) at every possible x value and only one y value. The change in y is always zero. However, since x can change by any amount depending on the segment we choose, we end up dividing zero by some constant number to find the gradient:

m=ΔxΔy​=Δx0​=0

Similar to how we write the equations for vertical lines using only x, we write the equations for horizontal lines using only y. This indicates that we can choose any x value we like, so long as our y value is the same.

Horizontal lines

A horizontal line has gradient m=0. It is therefore in the form

y=c

for some constant c.

You might be wondering if there's any way to write these special cases based off of a general equation. It turns out the answer is yes!

Standard form of a line

The equation of a straight line can also be given in the form

ax+by+d=0📖


This reduces to

y=−ba​x−bd​


In examinations, you may be asked to write the equation of a line in standard form.

Try playing around with this diagram and seeing what you find:

Powered by Desmos

Discussion

Try playing around with this diagram and seeing how the values of a, b, and d change the graph.

What are the values of the line's gradient and y-intercept when:

  • a=3,b=1,d=1?

  • a=−1,b=2,d=0?

  • a=25​,b=0,d=0?

  • a=0,b=−1,d=1?

What do you notice about the relationship between these three values and the line's general behavior?

The general equation for a straight line is:

ax+by+d=0


SL 2.1


To find the gradient (slope) and y-intercept, rearrange to the form y=mx+c:

by=−ax−d


y=−ba​x−bd​


So, the gradient is m=−ba​ and the y-intercept is c=−bd​.


1. a=3,b=1,d=1:

Substitute into the formulas:

Gradient: m=−13​=−3


y-intercept: c=−11​=−1



2. a=−1,b=2,d=0:


m=−2−1​=21​


c=−20​=0



3. a=25​,b=0,d=0:

If b=0, the equation is 25​x+0⋅y+0=0, or x=0. This is a vertical line, which has an undefined gradient and does not have a y-intercept.


4. a=0,b=−1,d=1:


m=−−10​=0


c=−−11​=1

So the line is horizontal with gradient 0 and y-intercept 1.


What do you notice?

  • The gradient is always m=−ba​ (unless b=0, in which case the line is vertical and the gradient is undefined).

  • The y-intercept is always c=−bd​ (again, undefined if b=0).

  • If a=0, the line is horizontal.

  • If b=0, the line is vertical.

  • Changing d shifts the line up or down without changing its gradient.

These relationships let you quickly predict the line's behavior from the values of a, b, and d.

Checkpoint

The equation of a straight line is

3x+2y−5=0

Find the gradient and intercept of the line.

Select the correct option

Exercise

The equation of a line is given by ax+by+d=0. It is given that d=2a.


The line passes through the point (3,21​).

  1. Find the value of the gradient m.

  2. Hence or otherwise, find the y-value of the y-intercept c.

Select the correct option

Discussion

As we just saw, we can describe the same line in several different ways. But why do we need all of them?

What scenarios might would it make sense to use each of these forms in?


What do we lose when we choose to write the equation of a line in one form over the others?

A useful way to decide which form to use is to look at what information you have, and what you need to read off or do with the line.

  1. Gradient–intercept form y=mx+b

    • When to use:

    – You already know (or want to emphasize) the slope m and the y-intercept b

    – You need to sketch quickly: slope and intercept are immediate.

    – You’re modeling a dependent variable y as a linear function of x.

    • What you lose

    – Cannot represent a vertical line (x=k).

    – The x-intercept isn’t obvious until you solve 0=mx+b.

    – A specific point (x1​,y1​) on the line isn’t built in.

  2. Point–gradient form y−y1​=m(x−x1​)

    • When to use

    – You know one point (x1​,y1​) on the line and its slope m.

    – You want to derive the equation directly from data “point + slope.”

    • What you lose

    – Neither intercept is explicit (you must expand and rearrange).

    – Vertical lines (m→∞) still fail in this form.

  3. Standard form Ax+By+C=0 (or Ax+By=C)

    • When to use

    – You’re solving a system of linear equations by elimination.

    – You want integer (or simple) coefficients A,B,C.

    – You need to represent a vertical line (x=k as 1⋅x+0⋅y−k=0).

    – You want to find intercepts by setting x=0 or y=0.

    • What you lose

    – The slope is buried (must rearrange to y=−BA​x−BC​).

    – Neither intercept is immediately visible until you solve.

Trade-off summary:

– Use gradient–intercept when slope and y-intercept are key.

– Use point–gradient when you build from one known point and a slope.

– Use standard form when you need generality (including vertical lines), integer coefficients, or to solve systems. Each form makes some features “on display” while hiding others, so pick the one that exposes what you need most.

Here are some example equations converted from one form to another:

Gradient-intercept

y=mx+c


Point-gradient

y−y1​=m(x−x1​)

Standard

ax+by+d=0

Graph

y=−21​x+3


y−2=−21​(x−2)


x+2y−6=0

Powered by Desmos

y=2
y−2=0
y−2=0

Powered by Desmos

y=−53​x+51​
y−514​=−53​(x−5)
3x+5y−1=0

Powered by Desmos

n\a

n\a

x+1=0

Powered by Desmos

It's important to note that standard form has the tightest restrictions on how an equation can be written. With the other forms, we can write the same equation in a couple of different ways, depending on the point we choose or fractions we want to work with.

0 / 7

Chat

Ask questions about the content or request clarifications