Neural Sync Active
Straight Lines
Registry Synced
Straight Lines
2995 words
15 min read
Reading compass
Now · 🎯 Learning Objectives
Straight Lines
🎯 Learning Objectives
By the end of this topic, you will be able to:
- Compute the slope of a line given two points or an equation
- Write the equation of a line in point-slope, slope-intercept, two-point, intercept, and general forms
- Determine whether two lines are parallel or perpendicular using slope conditions
- Compute the angle between two intersecting lines
- Calculate the distance from a point to a line, and between parallel lines
- Understand the line of best fit using the sum of squared errors (SSE)
📋 Prerequisites
- Coordinate Geometry — points, distance formula
- Basic algebra — solving linear equations, working with fractions
📖 Core Content
2.1 The Slope of a Line
2.1.1 Intuition: Steepness
If you're hiking up a mountain trail, some sections are steep and some are gentle. The slope of a line captures exactly this idea of steepness — how much the line rises (or falls) for each unit you move horizontally.
A flat road has slope 0. A staircase might have slope 0.5 (rise 1 unit for every 2 units forward). A cliff is nearly vertical (slope approaches infinity).
💡 Why this matters: Slope is the foundation of rate of change — the core idea in calculus (derivatives). In data science, the slope of a regression line tells you how much the target variable changes per unit change in a feature.
2.1.2 Definition
The slope m of a line passing through points P1(x1,y1) and P2(x2,y2) is:
As inclination: If a line makes angle θ with the positive x-axis:
Key facts:
- Horizontal line (θ=0∘): m=tan0∘=0
- Vertical line (θ=90∘): slope is undefined (tan90∘ is undefined)
- Positive slope: line goes up as x increases (rising)
- Negative slope: line goes down as x increases (falling)
2.1.3 Worked Examples
Example 1.1 (Easy): Find the slope of the line through (1,2) and (4,8).
Step 1: m=4−18−2=36=2
Example 1.2 (Medium): Find the slope of the line through (−3,5) and (2,−7).
Step 1: m=2−(−3)−7−5=5−12=−2.4
Example 1.3 (Edge case): Find the slope of the line through (3,4) and (3,9).
Step 1: m=3−39−4=05, which is undefined.
2.2 Equations of a Straight Line
2.2.1 Intuition: Describing a Line
Just as a point is described by its coordinates, a line is described by an equation — a condition that every point on the line satisfies. If (x,y) lies on the line y=2x+1, then plugging in gives y=2x+1.
There are several forms, each useful in different situations:
(Diagram)
2.2.2 Forms Summary
| Form | Equation | When to Use |
|---|---|---|
| Horizontal | y=a | Line parallel to x-axis |
| Vertical | x=a | Line parallel to y-axis |
| Point-slope | y−y1=m(x−x1) | Given a point (x1,y1) and slope m |
| Slope-intercept | y=mx+c | Given slope m and y-intercept c |
| Two-point | y−y1=x2−x1y2−y1(x−x1) | Given two points |
| Intercept | ax+by=1 | Given x-intercept a and y-intercept b |
| General | Ax+By+C=0 | Standard form, all lines |
| X-intercept form | y=m(x−d) | Given x-intercept d and slope m |
2.2.3 Converting Between Forms
From general form Ax+By+C=0:
- Slope: m=−BA
- y-intercept: −BC
- x-intercept: −AC Recipe for writing a line equation:
- Identify what information you have (point + slope? two points? intercepts?)
- Choose the corresponding form
- Substitute the known values
- Simplify to the required form
2.2.4 Worked Examples
Example 2.1 (Easy — Point-Slope): Find the equation of the line through (2,3) with slope 4.
Step 1: Use point-slope: y−y1=m(x−x1)
Step 2: y−3=4(x−2)
Step 3: Simplify: y−3=4x−8⟹y=4x−5
Example 2.2 (Medium — Two-Point): Find the equation of the line through (1,2) and (4,8).
Step 1: Find slope: m=4−18−2=2
Step 2: Use point-slope with (1,2): y−2=2(x−1)
Step 3: Simplify: y−2=2x−2⟹y=2x
Example 2.3 (Medium — Intercept): Find the equation of the line with x-intercept 3 and y-intercept 4.
Step 1: a=3, b=4: 3x+4y=1
Step 2: Multiply by 12: 4x+3y=12
Example 2.4 (Hard — General Form): Convert 3x−2y+6=0 to slope-intercept form and find its slope and intercepts.
Step 1 — Slope-intercept: 3x−2y+6=0⟹−2y=−3x−6⟹y=23x+3
Step 2 — Slope: m=23
Step 3 — y-intercept: c=3 (from y=23x+3)
Step 4 — x-intercept: Set y=0: 3x+6=0⟹x=−2
2.3 Parallel and Perpendicular Lines
2.3.1 Intuition
- Parallel lines run side by side, never meeting. They have the same steepness (equal slopes).
- Perpendicular lines meet at a right angle (90∘). Their slopes are negative reciprocals.
2.3.2 Conditions
For two non-vertical lines with slopes m1 and m2:
| Condition | Formula | Example |
|---|---|---|
| Parallel | m1=m2 | y=2x+1 , y=2x−5 |
| Perpendicular | m1⋅m2=−1 | y=2x+1 , y=−21x+3 |
For lines in general form A1x+B1y+C1=0 and A2x+B2y+C2=0:
- Parallel: A1B2=A2B1
- Perpendicular: A1A2+B1B2=0
2.3.3 Worked Examples
Example 3.1 (Easy): Are y=3x+2 and y=3x−7 parallel?
Step 1: m1=3, m2=3
Step 2: Since m1=m2, the lines are parallel.
Example 3.2 (Medium): Find the equation of the line perpendicular to y=−21x+3 passing through (4,1).
Step 1: Slope of given line: m1=−21
Step 2: Slope of perpendicular: m2=−m11=−−1/21=2
Step 3: Point-slope: y−1=2(x−4)
Step 4: Simplify: y−1=2x−8⟹y=2x−7
Example 3.3 (Hard): Are the lines 2x+3y−6=0 and 4x+6y+12=0 parallel?
Step 1 — Method 1 (Slopes):
Line 1: y=−32x+2⟹m1=−32
Line 2: y=−64x−2=−32x−2⟹m2=−32
m1=m2 → parallel.
Step 2 — Method 2 (General form):
A1=2,B1=3, A2=4,B2=6
A1B2=2×6=12, A2B1=4×3=12
A1B2=A2B1 → parallel.
2.4 Angle Between Two Lines
2.4.1 Formula
The acute angle θ between two lines with slopes m1 and m2 (m1m2=−1) is:
The obtuse angle ϕ=180∘−θ satisfies:
2.4.2 Worked Example
Find the acute angle between y=2x+3 and y=31x−1.
Step 1: m1=2, m2=31
Step 2: tanθ=1+2⋅3131−2=1+32−35=35−35=−1
Step 3: θ=arctan(−1)=45∘ (acute angle, take absolute value)
2.5 Distance Formulas
2.5.1 Distance from a Point to a Line
The perpendicular distance from point (x1,y1) to line Ax+By+C=0:
2.5.2 Distance Between Two Parallel Lines
For parallel lines Ax+By+C1=0 and Ax+By+C2=0:
2.5.3 Worked Examples
Example 5.1 (Easy): Distance from (1,2) to the line 3x+4y−5=0.
Step 1: d=32+42∣3(1)+4(2)−5∣=5∣3+8−5∣=5∣6∣=56
Example 5.2 (Medium): Distance between parallel lines 2x−y+3=0 and 2x−y−4=0.
Step 1: A=2, B=−1, C1=3, C2=−4
Step 2: d=22+(−1)2∣3−(−4)∣=5∣7∣=57
2.6 Line of Best Fit (Straight-Line Fit)
2.6.1 Intuition
In the real world, data points rarely lie exactly on a straight line. But often they roughly follow a linear trend. Linear regression finds the line that best approximates the data by minimizing the sum of squared errors (SSE).
2.6.2 Formula for Best-Fit Line y=mx+c
For n data points (xi,yi):
where xˉ and yˉ are the means of the x-values and y-values.
The sum of squared errors is:
2.6.3 Worked Example
Find the line of best fit for the points (1,2), (2,3), (3,5), (4,4).
| xi | yi | xi−xˉ | yi−yˉ | (xi−xˉ)(yi−yˉ) | (xi−xˉ)2 |
|---|---|---|---|---|---|
| 1 | 2 | -1.5 | -1.5 | 2.25 | 2.25 |
| 2 | 3 | -0.5 | -0.5 | 0.25 | 0.25 |
| 3 | 5 | 0.5 | 1.5 | 0.75 | 0.25 |
| 4 | 4 | 1.5 | 0.5 | 0.75 | 2.25 |
xˉ=2.5, yˉ=3.5
∑(xi−xˉ)(yi−yˉ)=2.25+0.25+0.75+0.75=4
∑(xi−xˉ)2=2.25+0.25+0.25+2.25=5
m=54=0.8, c=3.5−0.8(2.5)=3.5−2=1.5
📐 Key Formulas — Summary Table
| Concept | Formula | Notes |
|---|---|---|
| Slope | m=x2−x1y2−y1=tanθ | Undefined for vertical lines |
| Point-slope | y−y1=m(x−x1) | Given slope + point |
| Slope-intercept | y=mx+c | c = y-intercept |
| Two-point | y−y1=x2−x1y2−y1(x−x1) | Given two points |
| Intercept | ax+by=1 | a = x-int, b = y-int |
| General | Ax+By+C=0 | All lines |
| Parallel condition | m1=m2 or A1B2=A2B1 | |
| Perpendicular | m1⋅m2=−1 or A1A2+B1B2=0 | |
| Angle between lines | tanθ=1+m1m2m2−m1 | Acute angle |
| Point-to-line distance | $d = \frac{ | Ax_1 + By_1 + C |
| Parallel lines distance | $d = \frac{ | C_1 - C_2 |
| Best-fit slope | m=∑(xi−xˉ)2∑(xi−xˉ)(yi−yˉ) | Linear regression |
| Best-fit intercept | c=yˉ−mxˉ | |
| Sum of squared errors | SSE=∑(yi−mxi−c)2 | Minimized by best-fit |
⚠️ Common Pitfalls
Pitfall 1: Confusing x-intercept with y-intercept
Mistake: Saying y=mx+c gives the x-intercept as c.
Correct: c is the y-intercept (the point (0,c)). The x-intercept is found by setting y=0: 0=mx+c⟹x=−c/m.
Pitfall 2: Thinking Slope is the Same as the Angle
Mistake: If slope is 2, the angle is 2 radians or degrees.
Correct: Slope m=tanθ. So θ=arctan(m). For m=2, θ≈63.4∘, not 2∘.
Pitfall 3: Forgetting the Vertical Line Has No Slope
Mistake: Saying a vertical line has slope 0 (confusing with horizontal).
Correct: Horizontal (y=a): slope 0. Vertical (x=a): slope undefined.
Pitfall 4: Using Wrong Ratio for Perpendicular Lines
Mistake: Using m2=−m1 for perpendicular lines (that's for reflection across x-axis).
Correct: m1⋅m2=−1, so m2=−1/m1. Example: if m1=2, then m2=−1/2.
📝 Practice Questions
Q1: Find the slope of the line through (3,−2) and (7,6).Strategy Hint: Use m=(y2−y1)/(x2−x1).m=7−36−(−2)=48=2m=2 Q2: Write the equation of the line with slope −3 passing through (2,5).Strategy Hint: Use point-slope form.y−5=−3(x−2)⟹y−5=−3x+6⟹y=−3x+11y=−3x+11 Q3: Are y=−32x+4 and 3x−2y+5=0 perpendicular?Strategy Hint: Find slopes and check m1⋅m2=−1.Line 1: m1=−32 Line 2: y=23x+25⟹m2=23 m1⋅m2=−32⋅23=−1 ✓Yes, perpendicular Q4: Find the distance from (4,−1) to 5x−12y+3=0.Strategy Hint: Use the point-to-line distance formula.d=52+(−12)2∣5(4)−12(−1)+3∣=13∣20+12+3∣=13351335 units Q5: Find the equation of the line parallel to 3x+4y=12 passing through (0,0).Strategy Hint: Parallel lines have the same A and B (different C).Since lines are parallel, 3x+4y+C=0. Passes through (0,0): 3(0)+4(0)+C=0⟹C=0.3x+4y=0 Q6: Find the acute angle between y=x+1 and y=3x−2.Strategy Hint: Use tanθ=1+m1m2m2−m1.m1=1, m2=3 tanθ=1+1⋅33−1=1+33−1=3−1(3−1)2=24−23=2−3θ=arctan(2−3)=15∘15∘ Q7: Write 2x−5y+10=0 in intercept form.Strategy Hint: Get ax+by=1.2x−5y+10=0⟹2x−5y=−10⟹−5x+2y=1−5x+2y=1 Q8: Find the line through (3,2) perpendicular to x=5.Strategy Hint: x=5 is vertical. Perpendicular to vertical is horizontal.x=5 is vertical. A perpendicular line is horizontal: y=k. Through (3,2): y=2.y=2 Q9: Find the distance between 2x−3y+7=0 and 4x−6y−5=0.Strategy Hint: First check parallel (they are), then make A, B same.Line 2: 4x−6y−5=0⟹2x−3y−25=0 d=22+(−3)2∣7−(−5/2)∣=13∣7+2.5∣=139.5=2131921319 units Q10: Find the line with x-intercept 2 and y-intercept −3.Strategy Hint: Intercept form directly.2x+−3y=1⟹2x−3y=1⟹3x−2y=63x−2y=6 Q11: For points (0,1), (2,3), (4,5), find the best-fit line.Strategy Hint: Use the formulas for m and c.xˉ=2, yˉ=3 ∑(xi−xˉ)(yi−yˉ)=(−2)(−2)+0(0)+2(2)=4+0+4=8 ∑(xi−xˉ)2=4+0+4=8 m=88=1, c=3−1(2)=1y=x+1 Q12: If a line passes through (2,5) and (−1,2), write its equation and find its intercepts.Strategy Hint: Find slope, then use point-slope.m=−1−22−5=−3−3=1 y−5=1(x−2)⟹y=x+3 y-intercept: 3 (when x=0) x-intercept: −3 (when y=0)y=x+3, y-int=3, x-int=−3
🔗 Cross-References
- Previous topic: Coordinate Geometry
- Next topic: Quadratic Functions — non-linear curves
- Related: Derivatives — slope of a curve = derivative
- Across courses: BSMA1002 Stats 1 (linear regression, correlation); BSMA1003 Maths 2 (linear algebra, vector spaces) Join Discord Previous2.1 Coordinate GeometryNext3.1 Quadratic Functions