MathMastery.Beta
Learning Resources

Equation of a Straight Line

Interactive curriculum lessons, worked examples, and geometric problem-solving techniques designed to help Kenyan students master CBC, KPSEA, KCSE, and IGCSE mathematics.

Grade 09 Pathway: N/A

First Principles

Objective: Find and interpret the gradient and equation of a straight line.

Imagine driving up the Nairobi–Naivasha escarpment on the Great Rift Valley road. The road climbs steadily: for every few metres you travel forward, you gain a certain height. That ratio of rise (vertical change) to run (horizontal change) is the gradient — the fundamental rate of change of every straight line.

Interactive Gradient Explorerm = 1.00
Rise (\(\Delta y\)): 2Run (\(\Delta x\)): 2Equation: y = 1.00x + 0.00

Drag the two control points on the canvas to see how rise, run, and gradient change dynamically.

(a) Concrete Scenario: Coordinates on a Map

Two landmarks on a grid — such as your starting town and destination — define a unique straight path. Label them \((x_1, y_1)\) and \((x_2, y_2)\). The change in height / vertical position is \(y_2 - y_1\) (the rise); the change in horizontal position is \(x_2 - x_1\) (the run).

(b) Geometric Insight: Rate of Steepness

The gradient \(m\) measures steepness and direction:

  • Positive gradient (\(m > 0\)): Slopes upwards from left to right.
  • Negative gradient (\(m < 0\)): Slopes downwards from left to right.
  • Zero gradient (\(m = 0\)): Completely horizontal line (flat terrain).
  • Undefined gradient: Perfectly vertical line (where run \(= x_2 - x_1 = 0\), dividing by zero is impossible).

(c) Algebraic Rule: Constructing the Line

Once the gradient \(m\) is known, any single point \((x_1, y_1)\) pins down the whole line. Using the point-slope form \(y - y_1 = m(x - x_1)\) and rearranging gives the slope-intercept form: \[ y = mx + c \] where \(m\) is the gradient and \(c\) is the \(y\)-intercept (the value of \(y\) when \(x = 0\)).

Key Formulas

\[ m = \frac{y_2 - y_1}{x_2 - x_1} \] — Gradient Formula: Rise (vertical change \(\Delta y\)) divided by run (horizontal change \(\Delta x\)). Subtract coordinates in the exact same order in numerator and denominator.
\[ y - y_1 = m(x - x_1) \] — Point-Slope Form: Use when you know the gradient \(m\) and any point \((x_1, y_1)\) on the line.
\[ y = mx + c \] — Slope-Intercept Form: \(m\) represents the gradient and \(c\) represents the \(y\)-intercept.
\[ Ax + By + C = 0 \] — General Form: Useful for expressing linear equations with integer coefficients.
\[ m_1 = m_2 \quad \text{and} \quad m_1 \times m_2 = -1 \] — Parallel & Perpendicular Lines: Parallel lines share identical gradients (\(m_1 = m_2\)); perpendicular lines have negative reciprocal gradients (\(m_1 \times m_2 = -1\)).

Worked Examples

Example 1 (Easy — Finding Equation from Gradient and Intercept):

Problem: A straight line has a gradient of \(3\) and crosses the \(y\)-axis at \((0, -4)\). Find the equation of the line.

  1. Identify Given Values: Gradient \(m = 3\) and \(y\)-intercept \(c = -4\).
  2. Substitute into Slope-Intercept Form: \[ y = mx + c \implies y = 3x + (-4) \]
  3. Simplify: \[ y = 3x - 4 \]

Answer: \( y = 3x - 4 \)

Example 2 (Medium — Line Passing Through Two Points):

Problem: Find the equation of the line passing through \(A(2, 5)\) and \(B(6, 13)\) in the form \(y = mx + c\).

  1. Step 1: Calculate the gradient (\(m\)): \[ m = \frac{y_2 - y_1}{x_2 - x_1} = \frac{13 - 5}{6 - 2} = \frac{8}{4} = 2 \]
  2. Step 2: Use point-slope form with point \(A(2, 5)\): \[ y - y_1 = m(x - x_1) \implies y - 5 = 2(x - 2) \]
  3. Step 3: Expand and solve for \(y\): \[ y - 5 = 2x - 4 \implies y = 2x - 4 + 5 \implies y = 2x + 1 \]
  4. Check with Point B: If \(x = 6\), \(y = 2(6) + 1 = 13\). Correct!

Answer: \( y = 2x + 1 \)

Example 3 (Hard — Parallel Line in General Form):

Problem: Find the equation of the straight line that passes through the point \((3, -2)\) and is parallel to the line \(4x - 2y + 5 = 0\). Write your final answer in the form \(Ax + By + C = 0\).

  1. Step 1: Find the gradient of the given line: Rearrange \(4x - 2y + 5 = 0\) to slope-intercept form: \[ -2y = -4x - 5 \implies y = \frac{-4}{-2}x + \frac{-5}{-2} \implies y = 2x + 2.5 \] Thus, the gradient \(m = 2\).
  2. Step 2: Use gradient \(m = 2\) for the parallel line: Parallel lines share the exact same gradient, so \(m_{\text{new}} = 2\).
  3. Step 3: Substitute \((3, -2)\) into point-slope form: \[ y - (-2) = 2(x - 3) \implies y + 2 = 2x - 6 \]
  4. Step 4: Rearrange into general form (\(Ax + By + C = 0\)): \[ 0 = 2x - y - 6 - 2 \implies 2x - y - 8 = 0 \]

Answer: \( 2x - y - 8 = 0 \)

Common Mistakes

Mistake Inverting the order of subtraction in numerator and denominator: \[ m = \frac{y_2 - y_1}{x_1 - x_2} \]
Correction Always subtract in the exact same sequence: either \(\frac{y_2 - y_1}{x_2 - x_1}\) or \(\frac{y_1 - y_2}{x_1 - x_2}\). Mismatched order flips the sign of the gradient from positive to negative or vice versa.
Why it feels right Subtraction feels commutative to intuition, but \((x_1 - x_2) = -(x_2 - x_1)\).
Mistake Confusing "zero gradient" with "undefined gradient".
Correction A flat horizontal line (e.g., \(y = 4\)) has \(\text{rise} = 0\), so \(m = \frac{0}{\text{run}} = 0\). A vertical line (e.g., \(x = 3\)) has \(\text{run} = 0\), so \(m = \frac{\text{rise}}{0}\), which is undefined.
Mistake Assuming the gradient of \(3x + 2y = 8\) is \(3\) just because \(3\) is in front of \(x\).
Correction The coefficient of \(x\) is only the gradient when the equation is solved explicitly for \(y\) (i.e., \(y = mx + c\)). Here, \(2y = -3x + 8 \implies y = -\frac{3}{2}x + 4\), so \(m = -1.5\).

Real World

Rift Valley Road Engineering: The highway down the escarpment from Limuru to Mai Mahiu drops approximately \(600\) metres in altitude over a road distance of \(6\) km (\(6000\) m). The average gradient is \(m = \frac{-600}{6000} = -0.10\) (or a 10% descent), requiring heavy trucks to use low gears and runaway truck ramps.
Solar Energy Panel Angles: In Nairobi (near the equator), solar technicians install panels at an angle to maximise irradiance throughout the year. The gradient of the roof trusses dictates the mounting brackets needed to achieve optimal angle.
Water Pipelines in Rural Projects: Gravity-fed water pipes from Mt. Kenya streams to community tanks require a constant minimum gradient (e.g., \(m = 0.02\)) to ensure clean water flows reliably without pooling or bursting joints.
M-Pesa Tariff Linear Models: Financial analysts model linear transaction charges and commissions using \(C = mt + k\), where \(m\) is the marginal commission rate per unit transacted.

Practice

Find the gradient of the line passing through the points \((2, 3)\) and \((6, 11)\). (Type only the number, e.g., 4)
Review the concepts above.
A straight line is given by the equation \(y = 4x - 7\). What is the \(y\)-intercept of this line? (Type only the number, e.g., -5)
Review the concepts above.
A line with gradient \(3\) passes through the point \((2, 5)\). Find the \(y\)-intercept (\(c\)) of this line when written in the form \(y = mx + c\). (Type only the number, e.g., -1)
Review the concepts above.
Find the gradient of the line whose equation is \(2x + 5y = 15\). Give your answer as a decimal. (Type only the number, e.g., -0.4)
Review the concepts above.
A line passes through the point \((1, 4)\) and is parallel to the line \(6x - 2y + 7 = 0\). What is the \(y\)-intercept (\(c\)) of this parallel line? (Type only the number, e.g., 1)
Review the concepts above.
A road climbing an escarpment passes through points \(A(4, 10)\) and \(B(12, k)\). If this road is perpendicular to a survey line that has gradient \(-2\), find the value of \(k\). (Type only the number, e.g., 14)
Review the concepts above.