Quiz 2
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:
  1. Compute the slope of a line given two points or an equation
  2. Write the equation of a line in point-slope, slope-intercept, two-point, intercept, and general forms
  3. Determine whether two lines are parallel or perpendicular using slope conditions
  4. Compute the angle between two intersecting lines
  5. Calculate the distance from a point to a line, and between parallel lines
  6. 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 mm of a line passing through points P1(x1,y1)P_1(x_1, y_1) and P2(x2,y2)P_2(x_2, y_2) is:
m=y2y1x2x1=riserunm = \frac{y_2 - y_1}{x_2 - x_1} = \frac{\text{rise}}{\text{run}}
As inclination: If a line makes angle θ\theta with the positive xx-axis:
m=tanθm = \tan\theta
Key facts:
  • Horizontal line (θ=0\theta = 0^\circ): m=tan0=0m = \tan 0^\circ = 0
  • Vertical line (θ=90\theta = 90^\circ): slope is undefined (tan90\tan 90^\circ is undefined)
  • Positive slope: line goes up as xx increases (rising)
  • Negative slope: line goes down as xx increases (falling)

2.1.3 Worked Examples

Example 1.1 (Easy): Find the slope of the line through (1,2)(1, 2) and (4,8)(4, 8). Step 1: m=8241=63=2m = \frac{8 - 2}{4 - 1} = \frac{6}{3} = 2
m=2\boxed{m = 2}
Example 1.2 (Medium): Find the slope of the line through (3,5)(-3, 5) and (2,7)(2, -7). Step 1: m=752(3)=125=2.4m = \frac{-7 - 5}{2 - (-3)} = \frac{-12}{5} = -2.4
m=125\boxed{m = -\frac{12}{5}}
Example 1.3 (Edge case): Find the slope of the line through (3,4)(3, 4) and (3,9)(3, 9). Step 1: m=9433=50m = \frac{9 - 4}{3 - 3} = \frac{5}{0}, which is undefined.
Slope is undefined (vertical line)\boxed{\text{Slope is undefined (vertical line)}}

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)(x, y) lies on the line y=2x+1y = 2x + 1, then plugging in gives y=2x+1y = 2x + 1. There are several forms, each useful in different situations: (Diagram)

2.2.2 Forms Summary

FormEquationWhen to Use
Horizontaly=ay = aLine parallel to x-axis
Verticalx=ax = aLine parallel to y-axis
Point-slopeyy1=m(xx1)y - y_1 = m(x - x_1)Given a point (x1,y1)(x_1,y_1) and slope mm
Slope-intercepty=mx+cy = mx + cGiven slope mm and y-intercept cc
Two-pointyy1=y2y1x2x1(xx1)y - y_1 = \frac{y_2-y_1}{x_2-x_1}(x - x_1)Given two points
Interceptxa+yb=1\frac{x}{a} + \frac{y}{b} = 1Given x-intercept aa and y-intercept bb
GeneralAx+By+C=0Ax + By + C = 0Standard form, all lines
X-intercept formy=m(xd)y = m(x - d)Given x-intercept dd and slope mm

2.2.3 Converting Between Forms

From general form Ax+By+C=0Ax + By + C = 0:
  • Slope: m=ABm = -\frac{A}{B}
  • y-intercept: CB-\frac{C}{B}
  • x-intercept: CA-\frac{C}{A} Recipe for writing a line equation:
  1. Identify what information you have (point + slope? two points? intercepts?)
  2. Choose the corresponding form
  3. Substitute the known values
  4. 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)(2, 3) with slope 44. Step 1: Use point-slope: yy1=m(xx1)y - y_1 = m(x - x_1) Step 2: y3=4(x2)y - 3 = 4(x - 2) Step 3: Simplify: y3=4x8    y=4x5y - 3 = 4x - 8 \implies y = 4x - 5
y=4x5\boxed{y = 4x - 5}
Example 2.2 (Medium — Two-Point): Find the equation of the line through (1,2)(1, 2) and (4,8)(4, 8). Step 1: Find slope: m=8241=2m = \frac{8 - 2}{4 - 1} = 2 Step 2: Use point-slope with (1,2)(1, 2): y2=2(x1)y - 2 = 2(x - 1) Step 3: Simplify: y2=2x2    y=2xy - 2 = 2x - 2 \implies y = 2x
y=2x\boxed{y = 2x}
Example 2.3 (Medium — Intercept): Find the equation of the line with x-intercept 33 and y-intercept 44. Step 1: a=3a = 3, b=4b = 4: x3+y4=1\frac{x}{3} + \frac{y}{4} = 1 Step 2: Multiply by 1212: 4x+3y=124x + 3y = 12
4x+3y=12\boxed{4x + 3y = 12}
Example 2.4 (Hard — General Form): Convert 3x2y+6=03x - 2y + 6 = 0 to slope-intercept form and find its slope and intercepts. Step 1 — Slope-intercept: 3x2y+6=0    2y=3x6    y=32x+33x - 2y + 6 = 0 \implies -2y = -3x - 6 \implies y = \frac{3}{2}x + 3 Step 2 — Slope: m=32m = \frac{3}{2} Step 3 — y-intercept: c=3c = 3 (from y=32x+3y = \frac{3}{2}x + 3) Step 4 — x-intercept: Set y=0y = 0: 3x+6=0    x=23x + 6 = 0 \implies x = -2
y=32x+3, m=32, x-int=2, y-int=3\boxed{y = \frac{3}{2}x + 3,\ m = \frac{3}{2},\ \text{x-int} = -2,\ \text{y-int} = 3}

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 (9090^\circ). Their slopes are negative reciprocals.

2.3.2 Conditions

For two non-vertical lines with slopes m1m_1 and m2m_2:
ConditionFormulaExample
Parallelm1=m2m_1 = m_2y=2x+1y = 2x + 1 , y=2x5y = 2x - 5
Perpendicularm1m2=1m_1 \cdot m_2 = -1y=2x+1y = 2x + 1 , y=12x+3y = -\frac{1}{2}x + 3
For lines in general form A1x+B1y+C1=0A_1x + B_1y + C_1 = 0 and A2x+B2y+C2=0A_2x + B_2y + C_2 = 0:
  • Parallel: A1B2=A2B1A_1 B_2 = A_2 B_1
  • Perpendicular: A1A2+B1B2=0A_1 A_2 + B_1 B_2 = 0

2.3.3 Worked Examples

Example 3.1 (Easy): Are y=3x+2y = 3x + 2 and y=3x7y = 3x - 7 parallel? Step 1: m1=3m_1 = 3, m2=3m_2 = 3 Step 2: Since m1=m2m_1 = m_2, the lines are parallel.
Yes\boxed{\text{Yes}}
Example 3.2 (Medium): Find the equation of the line perpendicular to y=12x+3y = -\frac{1}{2}x + 3 passing through (4,1)(4, 1). Step 1: Slope of given line: m1=12m_1 = -\frac{1}{2} Step 2: Slope of perpendicular: m2=1m1=11/2=2m_2 = -\frac{1}{m_1} = -\frac{1}{-1/2} = 2 Step 3: Point-slope: y1=2(x4)y - 1 = 2(x - 4) Step 4: Simplify: y1=2x8    y=2x7y - 1 = 2x - 8 \implies y = 2x - 7
y=2x7\boxed{y = 2x - 7}
Example 3.3 (Hard): Are the lines 2x+3y6=02x + 3y - 6 = 0 and 4x+6y+12=04x + 6y + 12 = 0 parallel? Step 1 — Method 1 (Slopes): Line 1: y=23x+2    m1=23y = -\frac{2}{3}x + 2 \implies m_1 = -\frac{2}{3} Line 2: y=46x2=23x2    m2=23y = -\frac{4}{6}x - 2 = -\frac{2}{3}x - 2 \implies m_2 = -\frac{2}{3} m1=m2m_1 = m_2 → parallel. Step 2 — Method 2 (General form): A1=2,B1=3A_1=2, B_1=3, A2=4,B2=6A_2=4, B_2=6 A1B2=2×6=12A_1B_2 = 2 \times 6 = 12, A2B1=4×3=12A_2B_1 = 4 \times 3 = 12 A1B2=A2B1A_1B_2 = A_2B_1 → parallel.
Yes, parallel\boxed{\text{Yes, parallel}}

2.4 Angle Between Two Lines

2.4.1 Formula

The acute angle θ\theta between two lines with slopes m1m_1 and m2m_2 (m1m21m_1 m_2 \neq -1) is:
tanθ=m2m11+m1m2\tan\theta = \frac{m_2 - m_1}{1 + m_1 m_2}
The obtuse angle ϕ=180θ\phi = 180^\circ - \theta satisfies:
tanϕ=m1m21+m1m2=tanθ\tan\phi = \frac{m_1 - m_2}{1 + m_1 m_2} = -\tan\theta

2.4.2 Worked Example

Find the acute angle between y=2x+3y = 2x + 3 and y=13x1y = \frac{1}{3}x - 1. Step 1: m1=2m_1 = 2, m2=13m_2 = \frac{1}{3} Step 2: tanθ=1321+213=531+23=5353=1\tan\theta = \frac{\frac{1}{3} - 2}{1 + 2 \cdot \frac{1}{3}} = \frac{-\frac{5}{3}}{1 + \frac{2}{3}} = \frac{-\frac{5}{3}}{\frac{5}{3}} = -1 Step 3: θ=arctan(1)=45\theta = \arctan(-1) = 45^\circ (acute angle, take absolute value)
θ=45\boxed{\theta = 45^\circ}

2.5 Distance Formulas

2.5.1 Distance from a Point to a Line

The perpendicular distance from point (x1,y1)(x_1, y_1) to line Ax+By+C=0Ax + By + C = 0:
d=Ax1+By1+CA2+B2d = \frac{|Ax_1 + By_1 + C|}{\sqrt{A^2 + B^2}}

2.5.2 Distance Between Two Parallel Lines

For parallel lines Ax+By+C1=0Ax + By + C_1 = 0 and Ax+By+C2=0Ax + By + C_2 = 0:
d=C1C2A2+B2d = \frac{|C_1 - C_2|}{\sqrt{A^2 + B^2}}

2.5.3 Worked Examples

Example 5.1 (Easy): Distance from (1,2)(1, 2) to the line 3x+4y5=03x + 4y - 5 = 0. Step 1: d=3(1)+4(2)532+42=3+855=65=65d = \frac{|3(1) + 4(2) - 5|}{\sqrt{3^2 + 4^2}} = \frac{|3 + 8 - 5|}{5} = \frac{|6|}{5} = \frac{6}{5}
d=1.2 units\boxed{d = 1.2 \text{ units}}
Example 5.2 (Medium): Distance between parallel lines 2xy+3=02x - y + 3 = 0 and 2xy4=02x - y - 4 = 0. Step 1: A=2A=2, B=1B=-1, C1=3C_1=3, C2=4C_2=-4 Step 2: d=3(4)22+(1)2=75=75d = \frac{|3 - (-4)|}{\sqrt{2^2 + (-1)^2}} = \frac{|7|}{\sqrt{5}} = \frac{7}{\sqrt{5}}
d=75 units\boxed{d = \frac{7}{\sqrt{5}} \text{ units}}

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+cy = mx + c

For nn data points (xi,yi)(x_i, y_i):
m=i=1n(xixˉ)(yiyˉ)i=1n(xixˉ)2m = \frac{\sum_{i=1}^n (x_i - \bar{x})(y_i - \bar{y})}{\sum_{i=1}^n (x_i - \bar{x})^2} c=yˉmxˉc = \bar{y} - m\bar{x}
where xˉ\bar{x} and yˉ\bar{y} are the means of the xx-values and yy-values. The sum of squared errors is:
SSE=i=1n(yi(mxi+c))2SSE = \sum_{i=1}^n (y_i - (mx_i + c))^2

2.6.3 Worked Example

Find the line of best fit for the points (1,2)(1, 2), (2,3)(2, 3), (3,5)(3, 5), (4,4)(4, 4).
xix_iyiy_ixixˉx_i - \bar{x}yiyˉy_i - \bar{y}(xixˉ)(yiyˉ)(x_i-\bar{x})(y_i-\bar{y})(xixˉ)2(x_i-\bar{x})^2
12-1.5-1.52.252.25
23-0.5-0.50.250.25
350.51.50.750.25
441.50.50.752.25
xˉ=2.5\bar{x} = 2.5, yˉ=3.5\bar{y} = 3.5 (xixˉ)(yiyˉ)=2.25+0.25+0.75+0.75=4\sum(x_i-\bar{x})(y_i-\bar{y}) = 2.25 + 0.25 + 0.75 + 0.75 = 4 (xixˉ)2=2.25+0.25+0.25+2.25=5\sum(x_i-\bar{x})^2 = 2.25 + 0.25 + 0.25 + 2.25 = 5 m=45=0.8m = \frac{4}{5} = 0.8, c=3.50.8(2.5)=3.52=1.5c = 3.5 - 0.8(2.5) = 3.5 - 2 = 1.5
y=0.8x+1.5\boxed{y = 0.8x + 1.5}

📐 Key Formulas — Summary Table

ConceptFormulaNotes
Slopem=y2y1x2x1=tanθm = \frac{y_2 - y_1}{x_2 - x_1} = \tan\thetaUndefined for vertical lines
Point-slopeyy1=m(xx1)y - y_1 = m(x - x_1)Given slope + point
Slope-intercepty=mx+cy = mx + ccc = y-intercept
Two-pointyy1=y2y1x2x1(xx1)y - y_1 = \frac{y_2 - y_1}{x_2 - x_1}(x - x_1)Given two points
Interceptxa+yb=1\frac{x}{a} + \frac{y}{b} = 1aa = x-int, bb = y-int
GeneralAx+By+C=0Ax + By + C = 0All lines
Parallel conditionm1=m2m_1 = m_2 or A1B2=A2B1A_1B_2 = A_2B_1
Perpendicularm1m2=1m_1 \cdot m_2 = -1 or A1A2+B1B2=0A_1A_2 + B_1B_2 = 0
Angle between linestanθ=m2m11+m1m2\tan\theta = \frac{m_2 - m_1}{1 + m_1 m_2}Acute angle
Point-to-line distance$d = \frac{Ax_1 + By_1 + C
Parallel lines distance$d = \frac{C_1 - C_2
Best-fit slopem=(xixˉ)(yiyˉ)(xixˉ)2m = \frac{\sum(x_i-\bar{x})(y_i-\bar{y})}{\sum(x_i-\bar{x})^2}Linear regression
Best-fit interceptc=yˉmxˉc = \bar{y} - m\bar{x}
Sum of squared errorsSSE=(yimxic)2SSE = \sum(y_i - mx_i - c)^2Minimized by best-fit

⚠️ Common Pitfalls

Pitfall 1: Confusing xx-intercept with yy-intercept

Mistake: Saying y=mx+cy = mx + c gives the xx-intercept as cc. Correct: cc is the yy-intercept (the point (0,c)(0, c)). The xx-intercept is found by setting y=0y = 0: 0=mx+c    x=c/m0 = mx + c \implies x = -c/m.

Pitfall 2: Thinking Slope is the Same as the Angle

Mistake: If slope is 22, the angle is 22 radians or degrees. Correct: Slope m=tanθm = \tan\theta. So θ=arctan(m)\theta = \arctan(m). For m=2m = 2, θ63.4\theta \approx 63.4^\circ, not 22^\circ.

Pitfall 3: Forgetting the Vertical Line Has No Slope

Mistake: Saying a vertical line has slope 00 (confusing with horizontal). Correct: Horizontal (y=ay = a): slope 00. Vertical (x=ax = a): slope undefined.

Pitfall 4: Using Wrong Ratio for Perpendicular Lines

Mistake: Using m2=m1m_2 = -m_1 for perpendicular lines (that's for reflection across x-axis). Correct: m1m2=1m_1 \cdot m_2 = -1, so m2=1/m1m_2 = -1/m_1. Example: if m1=2m_1 = 2, then m2=1/2m_2 = -1/2.

📝 Practice Questions

Q1: Find the slope of the line through (3,2)(3, -2) and (7,6)(7, 6).
Strategy Hint: Use m=(y2y1)/(x2x1)m = (y_2 - y_1)/(x_2 - x_1).
m=6(2)73=84=2m = \frac{6 - (-2)}{7 - 3} = \frac{8}{4} = 2
m=2\boxed{m = 2} Q2: Write the equation of the line with slope 3-3 passing through (2,5)(2, 5).
Strategy Hint: Use point-slope form.
y5=3(x2)    y5=3x+6    y=3x+11y - 5 = -3(x - 2) \implies y - 5 = -3x + 6 \implies y = -3x + 11
y=3x+11\boxed{y = -3x + 11} Q3: Are y=23x+4y = -\frac{2}{3}x + 4 and 3x2y+5=03x - 2y + 5 = 0 perpendicular?
Strategy Hint: Find slopes and check m1m2=1m_1 \cdot m_2 = -1.
Line 1: m1=23m_1 = -\frac{2}{3} Line 2: y=32x+52    m2=32y = \frac{3}{2}x + \frac{5}{2} \implies m_2 = \frac{3}{2} m1m2=2332=1m_1 \cdot m_2 = -\frac{2}{3} \cdot \frac{3}{2} = -1
Yes, perpendicular\boxed{\text{Yes, perpendicular}} Q4: Find the distance from (4,1)(4, -1) to 5x12y+3=05x - 12y + 3 = 0.
Strategy Hint: Use the point-to-line distance formula.
d=5(4)12(1)+352+(12)2=20+12+313=3513d = \frac{|5(4) - 12(-1) + 3|}{\sqrt{5^2 + (-12)^2}} = \frac{|20 + 12 + 3|}{13} = \frac{35}{13}
3513 units\boxed{\frac{35}{13} \text{ units}} Q5: Find the equation of the line parallel to 3x+4y=123x + 4y = 12 passing through (0,0)(0, 0).
Strategy Hint: Parallel lines have the same AA and BB (different CC).
Since lines are parallel, 3x+4y+C=03x + 4y + C = 0. Passes through (0,0)(0,0): 3(0)+4(0)+C=0    C=03(0) + 4(0) + C = 0 \implies C = 0.
3x+4y=0\boxed{3x + 4y = 0} Q6: Find the acute angle between y=x+1y = x + 1 and y=3x2y = \sqrt{3}x - 2.
Strategy Hint: Use tanθ=m2m11+m1m2\tan\theta = \frac{m_2 - m_1}{1 + m_1 m_2}.
m1=1m_1 = 1, m2=3m_2 = \sqrt{3} tanθ=311+13=311+3=(31)231=4232=23\tan\theta = \frac{\sqrt{3} - 1}{1 + 1 \cdot \sqrt{3}} = \frac{\sqrt{3} - 1}{1 + \sqrt{3}} = \frac{(\sqrt{3} - 1)^2}{3 - 1} = \frac{4 - 2\sqrt{3}}{2} = 2 - \sqrt{3}
θ=arctan(23)=15\theta = \arctan(2 - \sqrt{3}) = 15^\circ
15\boxed{15^\circ} Q7: Write 2x5y+10=02x - 5y + 10 = 0 in intercept form.
Strategy Hint: Get xa+yb=1\frac{x}{a} + \frac{y}{b} = 1.
2x5y+10=0    2x5y=10    x5+y2=12x - 5y + 10 = 0 \implies 2x - 5y = -10 \implies \frac{x}{-5} + \frac{y}{2} = 1
x5+y2=1\boxed{\frac{x}{-5} + \frac{y}{2} = 1} Q8: Find the line through (3,2)(3, 2) perpendicular to x=5x = 5.
Strategy Hint: x=5x = 5 is vertical. Perpendicular to vertical is horizontal.
x=5x = 5 is vertical. A perpendicular line is horizontal: y=ky = k. Through (3,2)(3, 2): y=2y = 2.
y=2\boxed{y = 2} Q9: Find the distance between 2x3y+7=02x - 3y + 7 = 0 and 4x6y5=04x - 6y - 5 = 0.
Strategy Hint: First check parallel (they are), then make A, B same.
Line 2: 4x6y5=0    2x3y52=04x - 6y - 5 = 0 \implies 2x - 3y - \frac{5}{2} = 0 d=7(5/2)22+(3)2=7+2.513=9.513=19213d = \frac{|7 - (-5/2)|}{\sqrt{2^2 + (-3)^2}} = \frac{|7 + 2.5|}{\sqrt{13}} = \frac{9.5}{\sqrt{13}} = \frac{19}{2\sqrt{13}}
19213 units\boxed{\frac{19}{2\sqrt{13}} \text{ units}} Q10: Find the line with x-intercept 22 and y-intercept 3-3.
Strategy Hint: Intercept form directly.
x2+y3=1    x2y3=1    3x2y=6\frac{x}{2} + \frac{y}{-3} = 1 \implies \frac{x}{2} - \frac{y}{3} = 1 \implies 3x - 2y = 6
3x2y=6\boxed{3x - 2y = 6} Q11: For points (0,1)(0,1), (2,3)(2,3), (4,5)(4,5), find the best-fit line.
Strategy Hint: Use the formulas for mm and cc.
xˉ=2\bar{x} = 2, yˉ=3\bar{y} = 3 (xixˉ)(yiyˉ)=(2)(2)+0(0)+2(2)=4+0+4=8\sum(x_i-\bar{x})(y_i-\bar{y}) = (-2)(-2) + 0(0) + 2(2) = 4 + 0 + 4 = 8 (xixˉ)2=4+0+4=8\sum(x_i-\bar{x})^2 = 4 + 0 + 4 = 8 m=88=1m = \frac{8}{8} = 1, c=31(2)=1c = 3 - 1(2) = 1
y=x+1\boxed{y = x + 1} Q12: If a line passes through (2,5)(2,5) and (1,2)(-1,2), write its equation and find its intercepts.
Strategy Hint: Find slope, then use point-slope.
m=2512=33=1m = \frac{2-5}{-1-2} = \frac{-3}{-3} = 1 y5=1(x2)    y=x+3y - 5 = 1(x - 2) \implies y = x + 3 y-intercept: 33 (when x=0x=0) x-intercept: 3-3 (when y=0y=0)
y=x+3, y-int=3, x-int=3\boxed{y = x + 3,\ \text{y-int}=3,\ \text{x-int}=-3}

🔗 Cross-References

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.