Skip to main content

Learning maths

How to find the equation of a straight line: point-slope, two-point, slope-intercept and general form, with examples

Sprout Editorial Team・・Updated ・10 min read

Equations of straight lines is a learning unit in the Compulsory Part of senior secondary maths. The Education Bureau suggests teaching it in the first term of Secondary 4, and all its learning objectives are foundation topics. To find a line you need just two things: its slope and one point on it, or two points on it. Point-slope form y − y₁ = m(x − x₁) is the workhorse; slope-intercept form y = mx + c shows the slope and y-intercept at a glance; and general form Ax + By + C = 0 covers every line, including vertical ones. The distance, mid-point and slope formulas from junior secondary are the groundwork, and the point where two lines meet comes from solving them simultaneously. Substituting the given points back into your final equation catches most mistakes.

A parent's and child's hands together hold up a plain wooden set square pointing at the camera, with an unmarked pencil crossed behind it.
Key points
  • Equations of straight lines is a compulsory foundation topic, which the curriculum document suggests teaching in the first term of Secondary 4.
  • You need a slope and a point, or two points; finding the slope first and then using point-slope form is the safest route.
  • The general form Ax + By + C = 0 covers every line; set x = 0 or y = 0 to find the intercepts.
  • Two lines with different slopes meet at one point; the same slope with different intercepts means they are parallel.
  • The point-of-division (section) formula is a junior non-foundation topic, and HKDSE Section A covers foundation topics only.
  • Always substitute the given points back into your final equation.

Where straight lines sit in the curriculum: groundwork in junior secondary, equations in Secondary 4

Straight lines are learnt in two stages. The junior secondary unit "Rectangular coordinate system" teaches the distance, mid-point and slope formulas, and students learn to recognise parallel and perpendicular lines from their slopes and to understand intercepts; the point-of-division formula is a non-foundation topic. These formulas are the tools for finding equations later.

In senior secondary, "Equations of straight lines" is a unit in the Measures, Shape and Space strand of the Compulsory Part. Its suggested teaching time is 7 hours, and the curriculum document suggests teaching it in the first term of Secondary 4. Students find the equation of a line given two points, a slope and a point, or a slope and the y-intercept, and describe a line from its equation: its slope, its intercepts on the axes and whether a point lies on it. They also learn how slope relates to inclination and how to tell from the equations how many points two lines meet at. The normal form is not included.

In the HKDSE, the Mathematics Compulsory Part has Paper 1 (conventional questions, 65%, 2¼ hours) and Paper 2 (multiple choice, 35%, 1¼ hours). Section A of each paper covers foundation topics only, while Section B covers both foundation and non-foundation topics. Every learning objective in the straight-line unit is a foundation topic, so it can appear in either section. It is also the basis for the later Equations of circles unit, where students find where a line meets a circle and the equation of a tangent.

Curriculum content related to straight lines (EDB learning content, 2017)
StageUnitLearning objectivesFoundation / non-foundation
Junior secondaryRectangular coordinate systemDistance formula, mid-point formula, slope formula, intercepts, slopes of parallel and perpendicular linesFoundation
Junior secondaryRectangular coordinate systemPoint-of-division formula (called the section formula in many textbooks)Non-foundation
Senior Compulsory Part (S4)Equations of straight linesEquation from two points, a slope and a point, or a slope and y-intercept; slope and intercepts from an equation; whether a point is on a line; slope and inclination; number of intersections of two linesFoundation

First, the four coordinate formulas: distance, mid-point, slope and point of division

Take two points A(x₁, y₁) and B(x₂, y₂). The distance AB = √[(x₂ − x₁)² + (y₂ − y₁)²], which is Pythagoras' theorem applied to the horizontal and vertical distances. The mid-point is the average of the end points, ((x₁ + x₂)/2, (y₁ + y₂)/2). The slope m = (y₂ − y₁)/(x₂ − x₁), the vertical change divided by the horizontal change.

For A(−2, 1) and B(4, 9): the horizontal distance is 4 − (−2) = 6 and the vertical distance is 9 − 1 = 8, so AB = √(36 + 64) = 10. The mid-point is (1, 5) and the slope is 8 ÷ 6 = 4/3. Put brackets round negative coordinates, as in 4 − (−2), so the minus sign is not lost.

The point-of-division formula (called the section formula in many textbooks and revision sites) gives the point P that divides AB in the ratio r : s, so that AP : PB = r : s: P = ((s·x₁ + r·x₂)/(r + s), (s·y₁ + r·y₂)/(r + s)). If AP : PB = 1 : 3, then P = ((3 × (−2) + 1 × 4)/4, (3 × 1 + 1 × 9)/4) = (−1/2, 3). Check: a quarter of the way from A to B, x rises by 6 ÷ 4 = 1.5 and y by 8 ÷ 4 = 2, which also gives (−0.5, 3). Note that x₁ goes with s, not r.

Two non-vertical lines are parallel if their slopes are equal, and perpendicular if their slopes multiply to −1. To test whether three points are collinear, compare the slopes of AB and BC: if they are equal and the lines share point B, the three points lie on one line. A non-vertical line through the origin can be written y = mx, because its y-intercept is 0.

Key formulas at a glance
  • Measures, shape and spaceDistance and mid-pointd = √(x2 − x1)2 + (y2 − y1)2Mid-point = (x1 + x22, y1 + y22)
  • Measures, shape and spaceSlopem = y2 − y1x2 − x1Parallel: m1 = m2; perpendicular: m1m2 = −1
  • Measures, shape and spacePoint of divisionP = (sx1 + rx2r + s, sy1 + ry2r + s)P lies between A(x1, y1) and B(x2, y2), with AP : PB = r : s
  • Measures, shape and spaceEquation of a straight liney − y1 = m(x − x1)
    y = mx + c
    General form Ax + By + C = 0, slope = −AB

Finding the equation: pick the form that fits what you are given

A straight line is fixed by two pieces of information: its slope and a point on it, or two points on it. The curriculum asks students to find the equation of a line given two points, a slope and a point, or a slope and the y-intercept. The table below lists the usual starting information and the form that suits it; in every example you can substitute the given points back to check.

Example: find the line through A(−2, 1) and B(4, 9). The slope is m = (9 − 1)/(4 − (−2)) = 4/3. Point-slope form gives y − 1 = (4/3)(x + 2). Multiplying both sides by 3 gives 3y − 3 = 4x + 8, which in general form is 4x − 3y + 11 = 0. Check: for A, −8 − 3 + 11 = 0; for B, 16 − 27 + 11 = 0, so both points lie on the line.

Going one step further, find the perpendicular bisector of AB. It passes through the mid-point (1, 5) and its slope is the negative reciprocal of 4/3, which is −3/4. So y − 5 = (−3/4)(x − 1), that is 4y − 20 = −3x + 3, or 3x + 4y − 23 = 0. Substituting (1, 5): 3 + 20 − 23 = 0. Questions that combine the mid-point, slope and line equation like this are very common in coordinate geometry.

The intercept form x/a + y/b = 1 suits a line with x-intercept a and y-intercept b (neither 0). It is really a special case of the two-point form, since the line passes through (a, 0) and (0, b). For an x-intercept of 3 and a y-intercept of 6, x/3 + y/6 = 1; multiplying by 6 gives 2x + y − 6 = 0.

Common starting information for finding a line
GivenFormExample
Slope m and a point (x₁, y₁)Point-slope form y − y₁ = m(x − x₁)Slope 2 through (3, 5): y − 5 = 2(x − 3), so y = 2x − 1
Two points (x₁, y₁) and (x₂, y₂)Two-point form: find m = (y₂ − y₁)/(x₂ − x₁), then use point-slope formThrough (1, 2) and (3, 8): m = 3, y − 2 = 3(x − 1), so y = 3x − 1
Slope m and y-intercept cSlope-intercept form y = mx + cSlope −1/2, y-intercept 4: y = −x/2 + 4, so x + 2y − 8 = 0
x-intercept a and y-intercept b (a, b not 0)Intercept form x/a + y/b = 1x-intercept 3, y-intercept 6: 2x + y − 6 = 0
Through the origin with slope my = mxSlope −3: y = −3x, so 3x + y = 0

General form Ax + By + C = 0: reading the slope and intercepts, and testing a point

The general form Ax + By + C = 0 (A and B not both 0) can describe any straight line. When a question does not ask for a particular form, it is usual to use whole-number coefficients with A positive, which makes answers easy to compare. The curriculum asks students to describe a line from its equation: its slope, its intercepts on the axes and whether a point lies on it.

When B is not 0, slope = −A/B and y-intercept = −C/B; the x-intercept is −C/A when A is not 0. For 4x − 3y + 11 = 0: slope = −4/(−3) = 4/3; setting x = 0 gives −3y + 11 = 0, so the y-intercept is 11/3; setting y = 0 gives 4x + 11 = 0, so the x-intercept is −11/4. Substituting x = 0 and y = 0 yourself is safer than memorising the formulas.

To test whether a point lies on a line, substitute it into the equation. For (1, 5), 4 − 15 + 11 = 0, so it is on the line; for (2, 6), 8 − 18 + 11 = 1, which is not 0, so it is not.

Keep the special cases apart: a horizontal line y = k has slope 0; a vertical line x = k has no slope, so it cannot be written in slope-intercept form, only as x = k, the general form with B = 0. Slope and the angle of inclination θ are linked by m = tan θ: a line of slope 1 is inclined at 45°, and a line of slope 4/3 at about 53.1°.

Two lines: do they meet, run parallel or coincide?

The curriculum asks students to tell from the equations how many points two lines meet at. Compare slopes and intercepts: different slopes mean the lines meet at exactly one point; the same slope with different intercepts means they are parallel and never meet; the same slope and the same intercept mean the two equations describe one line, with infinitely many common points.

To find where two lines meet, solve their equations simultaneously. Take L₁: y = 2x − 1 and L₂: x + y − 5 = 0. Substituting L₁ into L₂ gives x + 2x − 1 − 5 = 0, so x = 2 and then y = 3: the lines meet at (2, 3). Check: 2 × 2 − 1 = 3 and 2 + 3 − 5 = 0, so both equations hold.

Now take 2x − y + 3 = 0 and 4x − 2y − 1 = 0. Both have slope 2, with y-intercepts 3 and −1/2, so they are parallel and never meet; forcing a simultaneous solution leads to an impossible statement such as 0 = 7. By contrast, y = 2x − 1 and x + 2y − 6 = 0 have slopes 2 and −1/2, which multiply to −1, so they are perpendicular.

Common mistakes and how to check

Most mistakes with straight-line equations are slips with signs and arithmetic rather than gaps in understanding. Spending half a minute checking after each question usually finds them. These are the most common ones.

If some of the forms still feel muddled after class, revise the topic's videos and examples first, then ask a teacher at school. If you are thinking about tutoring, the tutoring guide explains how the different kinds compare.

  • Negative coordinates in point-slope form: through (−2, 1), write y − 1 = m(x + 2), not x − 2.
  • Not multiplying out the whole bracket: y − 5 = 2(x − 3) becomes y − 5 = 2x − 6, not 2x − 3.
  • Mixing the order in the slope formula: if the top is y₂ − y₁, the bottom must be x₂ − x₁.
  • Writing a vertical line in slope-intercept form: x = k has no slope and can only be written as x = k.
  • Pairing the ratio wrongly in the point-of-division formula: with AP : PB = r : s, x₁ goes with s and x₂ with r.
  • To check: substitute the given points into your final equation, then confirm the slope matches the question.

Frequently asked questions

Which year is the equation of a straight line taught in?

The distance, mid-point and slope formulas are taught in the junior secondary unit "Rectangular coordinate system". "Equations of straight lines" is a unit in the senior secondary Compulsory Part; the curriculum document suggests teaching it in the first term of Secondary 4, with a suggested teaching time of 7 hours.

What is the section formula?

The section formula is what the curriculum document calls the point-of-division formula. It gives the point that divides AB in the ratio r : s: P = ((s·x₁ + r·x₂)/(r + s), (s·y₁ + r·y₂)/(r + s)). It is a non-foundation topic in the junior secondary curriculum.

Should I learn point-slope or slope-intercept form first?

Both describe the same line in different ways. Slope-intercept form shows the slope and y-intercept directly and is easier to understand; point-slope form is quickest when you know a slope and a point. Once you are confident, learn the general form, which also handles vertical lines.

Why can't a vertical line be written in slope-intercept form?

Every point on a vertical line has the same x-coordinate, so the horizontal change is 0 and the slope does not exist. The line cannot be written as y = mx + c, only as x = k, the general form with B = 0.

How is the straight line tested in the HKDSE?

All the learning objectives in the straight-line unit are foundation topics, so they can appear in Section A or Section B of Paper 1 and Paper 2. Paper 1 is worth 65% and lasts 2¼ hours; Paper 2 is multiple choice, worth 35%, and lasts 1¼ hours. The later Equations of circles unit also uses straight-line equations, for example to find where a line meets a circle and the equation of a tangent.

The links in this article go to the organisations’ own pages. Dates, fees and arrangements can change; check the latest information from the organisation concerned.

Secondary 4 maths: equations of straight lines