1 - Equations of Lines – Complete Lesson

A detailed lesson on the equation of a line: slope, point-slope form, general form, parallel and perpendicular lines, intersections, and distance from a point to a line. Includes two series of 10 exercises with full solutions.

Equations of Lines

This lesson covers every standard way of writing the equation of a straight line, how to find slopes, how to handle parallel and perpendicular lines, and how to use the point-to-line distance formula. Two series of exercises (fundamental and advanced) with full solutions follow the theory.

Learning objectives

By the end of this lesson you should be able to:

  1. Compute the slope of a line from two points.
  2. Write the equation of a line in slope–intercept, point–slope, two–point, general, and intercept forms, and switch between them.
  3. Recognize horizontal and vertical lines.
  4. Determine whether two lines are parallel, perpendicular, coincident, or intersecting.
  5. Solve linear systems to find intersections.
  6. Compute the distance from a point to a line.

1. Coordinates and straight lines

In the Cartesian plane, a point is an ordered pair (x,y). A straight line is the set of points whose coordinates satisfy a linear equation in x and y.

A linear equation has the general shape ax+by+c=0 with (a,b)≠(0,0). Two distinct points determine exactly one line.


2. Slope (gradient)

Given two distinct points A(x1,y1) and B(x2,y2) with x1≠x2, the slope of the line AB is

m = y2−y1 x2−x1

Interpretation:

Slope Geometry
m>0 line rises from left to right
m<0 line falls from left to right
m=0 horizontal line
undefined (division by 0) vertical line x=x1

The slope measures the rate of change: if x increases by 1, y changes by m.


3. Forms of the equation of a line

Every non-vertical line has exactly one equation in each of the following forms. Vertical lines are treated separately.

3.1 Slope–intercept form

y=mx+b
  • m = slope
  • b = y-intercept (the line crosses the y-axis at (0,b))

When to use: when you already know the slope and the y-intercept.

3.2 Point–slope form

y−y1 = m(x−x1)

When to use: the most practical form when you know one point (x1,y1) and the slope m. Expand it to reach slope–intercept form.

3.3 Two–point form

y−y1 y2−y1 = x−x1 x2−x1 (x2≠x1)

When to use: when you only have two points. Compute m first, then use point–slope form.

3.4 General (standard) form

ax+by+c=0

with a,b,c integers and usually a≥0, gcd(a,b,c)=1.

If b≠0, the slope is m=−ab, and the equation can be rearranged to slope–intercept form:

y=−abx−cb

3.5 Intercept form

If the line crosses the x-axis at (a,0) and the y-axis at (0,b), with a≠0 and b≠0:

xa + yb = 1

3.6 Horizontal and vertical lines

Line Equation Slope
horizontal through (0,b) y=b 0
vertical through (a,0) x=a undefined

4. Parallel and perpendicular lines

Let two lines have slopes m1 and m2 (both defined).

  • Parallel ⇔ m1=m2. They are distinct if their y-intercepts differ.
  • Perpendicular ⇔ m1⋅m2=−1, i.e. m2=−1m1.

A vertical line and a horizontal line are always perpendicular.


5. Intersection of two lines

The intersection of two lines is the solution of the system formed by their equations.

Given y=m1x+b1 and y=m2x+b2:

  • If m1≠m2: exactly one intersection, x=b2−b1m1−m2.
  • If m1=m2 and b1≠b2: parallel distinct lines, no solution.
  • If m1=m2 and b1=b2: coincident lines, infinitely many solutions.

6. Distance from a point to a line

The distance from the point P(x0,y0) to the line ax+by+c=0 is

d = |ax0+by0+c| a2+b2

The absolute value ensures d≥0. This formula works for every line (including vertical and horizontal).


7. Worked examples

Example 1 – Line through two points

Find the equation of the line through A(1,2) and B(4,8).

Step 1 – Slope:

m= 8−24−1 = 63 =2

Step 2 – Point–slope with A(1,2):

y−2=2(x−1) ⇒ y=2x

Check with B(4,8): 2(4)=8 ✓.

Example 2 – Line parallel to a given line

Find the line through P(2,−1) parallel to 3x−y+5=0.

The given line has slope m=3 (rewrite as y=3x+5). The parallel line has the same slope:

y+1=3(x−2) ⇒ y=3x−7

Example 3 – Line perpendicular to a given line

Find the line through Q(1,2) perpendicular to y=2x+3.

Slope of the given line: m1=2. Perpendicular slope: m2=−12.

y−2=−12(x−1) ⇒ y=−12x+52

Example 4 – Intersection

Find the intersection of y=x+1 and y=−x+5.

Solve x+1=−x+5, so 2x=4, hence x=2, then y=3. Intersection: (2,3).

Example 5 – Distance from a point to a line

Distance from P(1,2) to 3x+4y−5=0:

d = |3(1)+4(2)−5| 32+42 = |3+8−5|5 = 65 =1.2

Example 6 – Intercept form

A line passes through the x-intercept a=4 and the y-intercept b=−2. Intercept form:

x4 + y−2 =1 ⇒ x−2y=4 ⇒ y=x2−2

Series 1 – Fundamental (10 exercises)

These exercises test the basic mechanics. Show every step.

Exercise 1.1 — Find the slope of the line through A(2,3) and B(5,9).

Exercise 1.2 — Find the equation of the line through (2,−1) with slope m=3.

Exercise 1.3 — Find the equation of the line through A(−1,4) and B(2,−2).

Exercise 1.4 — Convert 2x−3y+6=0 to slope–intercept form. State the slope and the y-intercept.

Exercise 1.5 — Find the x-intercept and the y-intercept of the line 4x+6y=12.

Exercise 1.6 — Write the equation of (a) the horizontal line through (3,−2) and (b) the vertical line through the same point.

Exercise 1.7 — Find the equation of the line parallel to y=2x−5 passing through (1,3).

Exercise 1.8 — Find the equation of the line perpendicular to y=3x+1 passing through (2,4).

Exercise 1.9 — Determine whether 2x+3y=6 and 4x+6y=12 are parallel, coincident, or intersecting.

Exercise 1.10 — Find the intersection of y=x+1 and y=−x+5.


Series 2 – Advanced (10 exercises)

These exercises combine several notions. A complete solution is expected.

Exercise 2.1 — Find the equation of the line with x-intercept 3 and y-intercept −2.

Exercise 2.2 — Calculate the distance from P(2,−1) to the line 3x−4y+5=0.

Exercise 2.3 — Let A(0,0), B(4,0), C(0,3). Find the equations of the three sides of triangle ABC.

Exercise 2.4 — For the same triangle, find the equation of the altitude from C to AB.

Exercise 2.5 — Find the perpendicular bisector of the segment joining A(1,3) and B(5,7).

Exercise 2.6 — Find the equation of the line through A(2,1) parallel to the line through B(1,4) and C(3,−2).

Exercise 2.7 — The lines L1:(m−1)x+2y−3=0 and L2:3x+(m+1)y+4=0 are perpendicular. Find the value(s) of m.

Exercise 2.8 — Find the point on the line y=2x+1 that is closest to the origin.

Exercise 2.9 — Find the equation(s) of the line through (1,2) such that the triangle formed with the two axes has area 4.

Exercise 2.10 — The lines L1:x+y=1, L2:2x−y=3, and L3:ax+3y=5 are concurrent. Find a.


Solutions – Series 1

1.1 m=9−35−2=63=2.

1.2 y−(−1)=3(x−2)⇒y=3x−7.

1.3 m=−2−42−(−1)=−63=−2. Then y−4=−2(x+1)⇒y=−2x+2.

1.4 2x−3y+6=0⇒3y=2x+6⇒y=23x+2. Slope: 23, y-intercept: 2.

1.5 x-intercept: set y=0 → x=3. y-intercept: set x=0 → y=2. So (3,0) and (0,2).

1.6 (a) y=−2; (b) x=3.

1.7 Parallel slope m=2. y−3=2(x−1)⇒y=2x+1.

1.8 Perpendicular slope m=−13. y−4=−13(x−2)⇒y=−13x+143.

1.9 Rewrite both: y=−23x+2 and y=−23x+2. Same slope, same intercept → coincident lines.

1.10 x+1=−x+5⇒x=2⇒y=3. Intersection: (2,3).


Solutions – Series 2

2.1 Intercept form: x3+y−2=1⇒−2x+3y=−6⇒y=23x−2.

2.2 d=|3(2)−4(−1)+5|9+16=|6+4+5|5=155=3.

2.3 AB:y=0. AC:x=0. BC: slope 3−00−4=−34, so y=−34x+3.

2.4 AB is horizontal, so the altitude from C is vertical through C(0,3): x=0.

2.5 Midpoint M(3,5). Slope AB=7−35−1=1; perpendicular slope =−1. Line: y−5=−1(x−3)⇒y=−x+8.

2.6 Slope BC=−2−43−1=−3. Parallel through A(2,1): y−1=−3(x−2)⇒y=−3x+7.

2.7 Slopes: m1=−m−12, m2=−3m+1. Perpendicular condition m1m2=−1:

3(m−1) 2(m+1) =−1 ⇒ 3m−3=−2m−2 ⇒ 5m=1 ⇒ m=15

Check: m≠−1 ✓. So m=15.

2.8 Line 2x−y+1=0. Distance from origin: d=15. The closest point is the projection of O(0,0) onto the line. Line direction vector (1,2). Normal n→=(2,−1). Parametric foot:

P=O+tn→ , 2(2t)−(−t)+1=0 ⇒ 5t+1=0 ⇒ t=−15

So P=(−25,15).

2.9 Let the line be xa+yb=1. Passes through (1,2): 1a+2b=1. Area of the triangle: 12|ab|=4⇒|ab|=8.

Case ab=8: from 1a+2b=1, multiply by ab: b+2a=ab=8. System: b=8−2a and a(8−2a)=8⇒8a−2a2=8⇒a2−4a+4=0⇒(a−2)2=0⇒a=2, b=4.

Case ab=−8: b+2a=−8 and ab=−8. Substitute b=−8−2a: a(−8−2a)=−8⇒−2a2−8a+8=0⇒a2+4a−4=0⇒a=−2±22, b=−8−2a.

Two lines: x2+y4=1 (i.e. y=−2x+4), and the two solutions with a=−2±22.

2.10 Solve L1,L2: x+y=1 and 2x−y=3. Add: 3x=4⇒x=43, y=−13. Point P(43,−13).

Substitute into L3: a⋅43+3⋅(−13)=5⇒4a3−1=5⇒4a3=6⇒a=184=92.

So a=92.


Summary sheet

Concept Formula
Slope through two points m=y2−y1x2−x1
Slope–intercept form y=mx+b
Point–slope form y−y1=m(x−x1)
Two-point form y−y1y2−y1=x−x1x2−x1
General form ax+by+c=0 with m=−ab
Intercept form xa+yb=1
Parallel condition m1=m2
Perpendicular condition m1m2=−1
Distance point → line d=

Practice and exercises

Choose an exercise series to practise the equations of lines.

Equations of Lines – Series 1 (Fundamental)

Fundamental exercises on the equation of a line: slope, point–slope form, parallel and perpendicular lines, intersection.

Equations of Lines – Series 2

Advanced exercises on the equation of a line: intercepts, altitudes, perpendicular bisectors, distance point-to-line, concurrency, parametric lines.

Equations of Lines – Series 3

Fundamental exercises on the equation of a line: slope, point–slope form, parallel and perpendicular lines, intersection.

Interactive exercises

Exercises: Equations of Lines

Interactive exercises on slopes, linear equations, parallel and perpendicular lines.

2 - Equations of Lines – Series 1 (Fundamental)

Fundamental exercises on the equation of a line: slope, point–slope form, parallel and perpendicular lines, intersection.

These exercises test the basic mechanics of the equation of a line. Show every step.

Reminder. Slope: m=y2−y1x2−x1 · Point–slope: y−y1=m(x−x1) · Parallel: m1=m2 · Perpendicular: m1m2=−1.


Exercises

Exercise 1.1 — Find the slope of the line through A(2,3) and B(5,9).

Exercise 1.2 — Find the equation of the line through (2,−1) with slope m=3.

Exercise 1.3 — Find the equation of the line through A(−1,4) and B(2,−2).

Exercise 1.4 — Convert 2x−3y+6=0 to slope–intercept form. State the slope and the y-intercept.

Exercise 1.5 — Find the x-intercept and the y-intercept of the line 4x+6y=12.

Exercise 1.6 — Write the equation of (a) the horizontal line through (3,−2) and (b) the vertical line through the same point.

Exercise 1.7 — Find the equation of the line parallel to y=2x−5 passing through (1,3).

Exercise 1.8 — Find the equation of the line perpendicular to y=3x+1 passing through (2,4).

Exercise 1.9 — Determine whether 2x+3y=6 and 4x+6y=12 are parallel, coincident, or intersecting.

Exercise 1.10 — Find the intersection of y=x+1 and y=−x+5.


Solutions

1.1 m=9−35−2=63=2.

1.2 Point–slope: y−(−1)=3(x−2), hence

y=3x−7

1.3 m=−2−42−(−1)=−63=−2. Then y−4=−2(x+1), so

y=−2x+2

1.4 2x−3y+6=0⇒3y=2x+6⇒y=23x+2. Slope: 23, y-intercept: 2.

1.5 x-intercept: set y=0 → x=3. y-intercept: set x=0 → y=2. Points: (3,0) and (0,2).

1.6 (a) y=−2; (b) x=3.

1.7 Parallel slope m=2. y−3=2(x−1), hence

y=2x+1

1.8 Perpendicular slope m=−13. y−4=−13(x−2), hence

y=−13x+143

1.9 Rewrite both equations in slope–intercept form:

2x+3y=6 ⇒ y=−23x+2 4x+6y=12 ⇒ y=−23x+2

Same slope and same intercept → coincident lines.

1.10 Solve x+1=−x+5:

2x=4 ⇒ x=2 ⇒ y=3

Intersection: (2,3).

3 - Equations of Lines – Series 2

Fundamental exercises on the equation of a line: slope, point–slope form, parallel and perpendicular lines, intersection.

These exercises test the basic mechanics of the equation of a line. Show every step.

Reminder. Slope: m=y2−y1x2−x1 · Point–slope: y−y1=m(x−x1) · Parallel: m1=m2 · Perpendicular: m1m2=−1.


Exercises

Exercise 1.1 — Find the slope of the line through A(2,3) and B(5,9).

Exercise 1.2 — Find the equation of the line through (2,−1) with slope m=3.

Exercise 1.3 — Find the equation of the line through A(−1,4) and B(2,−2).

Exercise 1.4 — Convert 2x−3y+6=0 to slope–intercept form. State the slope and the y-intercept.

Exercise 1.5 — Find the x-intercept and the y-intercept of the line 4x+6y=12.

Exercise 1.6 — Write the equation of (a) the horizontal line through (3,−2) and (b) the vertical line through the same point.

Exercise 1.7 — Find the equation of the line parallel to y=2x−5 passing through (1,3).

Exercise 1.8 — Find the equation of the line perpendicular to y=3x+1 passing through (2,4).

Exercise 1.9 — Determine whether 2x+3y=6 and 4x+6y=12 are parallel, coincident, or intersecting.

Exercise 1.10 — Find the intersection of y=x+1 and y=−x+5.


Solutions

1.1 m=9−35−2=63=2.

1.2 Point–slope: y−(−1)=3(x−2), hence

y=3x−7

1.3 m=−2−42−(−1)=−63=−2. Then y−4=−2(x+1), so

y=−2x+2

1.4 2x−3y+6=0⇒3y=2x+6⇒y=23x+2. Slope: 23, y-intercept: 2.

1.5 x-intercept: set y=0 → x=3. y-intercept: set x=0 → y=2. Points: (3,0) and (0,2).

1.6 (a) y=−2; (b) x=3.

1.7 Parallel slope m=2. y−3=2(x−1), hence

y=2x+1

1.8 Perpendicular slope m=−13. y−4=−13(x−2), hence

y=−13x+143

1.9 Rewrite both equations in slope–intercept form:

2x+3y=6 ⇒ y=−23x+2 4x+6y=12 ⇒ y=−23x+2

Same slope and same intercept → coincident lines.

1.10 Solve x+1=−x+5:

2x=4 ⇒ x=2 ⇒ y=3

Intersection: (2,3).

4 - Equations of Lines – Series 3

Advanced exercises on the equation of a line: intercepts, altitudes, perpendicular bisectors, distance point-to-line, concurrency, parametric lines.

These exercises combine several notions. A complete solution is expected.

Reminder. Distance from P(x0,y0) to ax+by+c=0: d=|ax0+by0+c|a2+b2.


Exercises

Exercise 2.1 — Find the equation of the line with x-intercept 3 and y-intercept −2.

Exercise 2.2 — Calculate the distance from P(2,−1) to the line 3x−4y+5=0.

Exercise 2.3 — Let A(0,0), B(4,0), C(0,3). Find the equations of the three sides of triangle ABC.

Exercise 2.4 — For the same triangle, find the equation of the altitude from C to AB.

Exercise 2.5 — Find the perpendicular bisector of the segment joining A(1,3) and B(5,7).

Exercise 2.6 — Find the equation of the line through A(2,1) parallel to the line through B(1,4) and C(3,−2).

Exercise 2.7 — The lines L1:(m−1)x+2y−3=0 and L2:3x+(m+1)y+4=0 are perpendicular. Find the value(s) of m.

Exercise 2.8 — Find the point on the line y=2x+1 that is closest to the origin.

Exercise 2.9 — Find the equation(s) of the line through (1,2) such that the triangle formed with the two axes has area 4.

Exercise 2.10 — The lines L1:x+y=1, L2:2x−y=3, and L3:ax+3y=5 are concurrent. Find a.


Solutions

2.1 Intercept form:

x3 + y−2 =1 ⇒ −2x+3y=−6 ⇒ y=23x−2

2.2 Distance formula:

d= |3(2)−4(−1)+5| 32+(−4)2 = |6+4+5|5 = 155 =3

2.3 Side AB: both endpoints have y=0, so y=0. Side AC: both endpoints have x=0, so x=0. Side BC: slope 3−00−4=−34, y-intercept 3, so

y=−34x+3

2.4 AB is the horizontal line y=0. The altitude from C is therefore vertical through C(0,3):

x=0

2.5 Midpoint M(3,5). Slope AB=7−35−1=1, so the perpendicular slope is −1. Then

y−5=−1(x−3) ⇒ y=−x+8

2.6 Slope BC=−2−43−1=−3. Parallel line through A(2,1):

y−1=−3(x−2) ⇒ y=−3x+7

2.7 Slopes:

m1=−m−12 , m2=−3m+1

Perpendicular condition m1m2=−1:

3(m−1) 2(m+1) =−1 ⇒ 3m−3=−2m−2 ⇒ 5m=1 ⇒ m=15

(Valid since m≠−1.) So m=15.

2.8 Write the line as 2x−y+1=0. Its direction vector is (1,2), so a normal vector is n→=(2,−1). The closest point is the orthogonal projection of O(0,0):

P=O+tn→ , 2(2t)−(−t)+1=0 ⇒ t=−15

So

P=(−25,15)

2.9 Let the line be xa+yb=1. It passes through (1,2):

1a+2b=1 and 12|ab|=4 ⇒ |ab|=8

Case ab=8: multiply by ab: b+2a=8, so b=8−2a. Then

a(8−2a)=8 ⇒ a2−4a+4=0 ⇒ a=2,b=4

Case ab=−8: b=−8−2a. Then

a(−8−2a)=−8 ⇒ a2+4a−4=0 ⇒ a=−2±22

Solutions:

x2+y4=1 , x−2+22+y−4−42=1 , x−2−22+y−4+42=1

2.10 Solve L1 and L2:

x+y=1 , 2x−y=3 ⇒ 3x=4 ⇒ x=43,y=−13

Substitute into L3:

a⋅43 + 3⋅(−13) =5 ⇒ 4a3−1=5 ⇒ a=92

5 - Exercises: Equations of Lines

Interactive exercises on slopes, linear equations, parallel and perpendicular lines.
3AC Mathematics 4 Interactive Exercises

Practise calculating slopes, finding equations of lines, and identifying parallel and perpendicular lines.

Instructions: Enter your answers in the boxes, then click Check. You can also reveal the solutions or reset an exercise.

Exercise 1: Calculate the slope

Consider the two points A(1,2) and B(3,6) . Calculate the slope of the line passing through A and B.

1° m=

2° Determine the equation of the line in the form y=ax+b :


Exercise 2: Find the slope and y-intercept

For each function, identify the slope a and the y-intercept b.

1° f(x)= 2x+5 : a = b =

2° g(x)= −3x+1 : a = b =

3° h(x)=4 : a = b =


Exercise 3: Determine the equation of a line

Find the equation of the line passing through the two given points.

1° The line passes through A(0,2) and B(1,5) .

2° The line passes through A(0,−1) and B(2,3) .


Exercise 4: Parallel and perpendicular lines

Consider the line d:y=2x+3 .

1° Find the slope of a line parallel to d: m=

2° Find the slope of a line perpendicular to d: m=

3° Find the equation of the line parallel to d and passing through A(1,5) :

6 -