Weeks
Mathematics 1Week 2 · Straight Lines, Slope and Line Fit
Week 2 Notes

Mathematics for
Data Science 1

Straight lines: the coordinate plane, slope, the equations of a line, distances, angles, and fitting a line to data.

8 chapters45 worked examples~45 min read
CoordinatesSlopeEquations of a lineStraight-line fit

Chapters

  1. 01Rectangular Coordinate System and DistanceSections 2.1, 2.2
  2. 02Section Formula and Area of a TriangleSections 2.3, 2.4
  3. 03Slope, Parallel and Perpendicular LinesSection 2.5.1
  4. 04Equations and Forms of a Straight LineSections 2.5.2, 2.6
  5. 05Angle Between Two LinesSection 2.5.3
  6. 06General Equation: Conditions and DistancesSections 2.7 to 2.9
  7. 07Straight-Line Fit and Sum Squared ErrorSection 2.10
  8. 08Week 2 Summary SheetAll sections
01
Coordinates and points

Rectangular Coordinate System and Distance

Straight lines live in the coordinate plane. This part sets up that plane and gives the first tool for working in it: the distance between two points.

1.1The Cartesian coordinate system

Definition: Cartesian coordinate system

A Cartesian coordinate system fixes every point of a plane by numbers. The coordinates are the signed distances from the point to two perpendicular reference lines, measured in the same unit. Each reference line is an axis, and the point where they meet is the origin, (0,0)(0, 0).

  • The horizontal axis is the X-axis; the first coordinate of a point is its abscissa.
  • The vertical axis is the Y-axis; the second coordinate is its ordinate.
  • The axes split the plane into four quadrants, numbered anticlockwise from the top right.
xy-6-4-2246-4-224P(3, 2)Q(−4, 2)R(−4, −2)S(3, −2)IIIIIIIVO (0, 0)Signs in each quadrantxyI++II−+III−−IV+−abscissa = the x-coordinateordinate = the y-coordinate
Figure 1. The plane, its four quadrants and one example point in each

1.2Which quadrant?

Look only at the signs of the two coordinates.

PointSigns of (x, y)Quadrant
(3,2)(3, 2)+, +I
(−4,2)(-4, 2)−, +II
(−4,−2)(-4, -2)−, −III
(3,−2)(3, -2)+, −IV
(0,3)(0, 3)x is 0on the Y-axis, in no quadrant
Extra. A point with a zero coordinate lies on an axis, and axes belong to no quadrant.

1.3The distance between two points

Distance formula

The distance between (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) is

d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

It is the hypotenuse of a right triangle whose legs are the horizontal gap x2−x1x_2 - x_1 and the vertical gap y2−y1y_2 - y_1.

xy-6-4-2242468101214A(2, 4)B(−4, 12)C(−4, 4)6810horizontal gapx₂ − x₁ = −6vertical gapy₂ − y₁ = 8d² = 36 + 64 = 100d = 10a 6, 8, 10 right triangle
Figure 2. The distance between (2, 4) and (−4, 12) is the hypotenuse of a 6, 8, 10 triangle

Why the formula works

  1. Draw the horizontal leg from the first point and the vertical leg from the second; they meet at a right angle.
  2. The legs have lengths ∣x2−x1∣|x_2 - x_1| and ∣y2−y1∣|y_2 - y_1|.
  3. Pythagoras: d2=(x2−x1)2+(y2−y1)2d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2. Take the square root.
Remember

The gaps are squared, so it does not matter which point is called 1 and which 2, and negative gaps are harmless.

1.4Going deeper

  • Distance is symmetric and non-negative. It is 0 only when the two points are the same point.
  • All points at distance rr from a point form a circle of radius rr (as in Example 2).
  • Classifying triangles (extra). Find the three side lengths. For (0,0),(6,0),(0,8)(0, 0), (6, 0), (0, 8) they are 6, 8 and 10, and 62+82=1026^2 + 8^2 = 10^2, so it is a right triangle with perimeter 24.
  • Unknown coordinate means two answers. Squaring a distance equation gives ±\pm, so always check both roots.

1.5Exam tips and common mistakes

Exam tips
  • Write the formula first, then substitute with brackets around negative numbers.
  • For an unknown coordinate set up the squared equation and solve for both signs.
  • For quadrants look at the signs only.
Common mistakes
  • Forgetting the square root, and giving 100 instead of 10.
  • Losing the second answer when solving (4−y)2=9(4 - y)^2 = 9.
  • Writing (x2−x1)+(y2−y1)(x_2 - x_1) + (y_2 - y_1) inside the root instead of the sum of squares.

Practice questions (graded-assignment style)

Q1Distance

Multiple Choice Question (MCQ): choose the one correct option.

What is the distance between (−1,3)(-1, 3) and (5,−5)(5, -5)?

1
6
2
8
3
10
4
14
Solution
Idea

Find the two gaps, square and add.

  • Gaps: 5−(−1)=65 - (-1) = 6 and −5−3=−8-5 - 3 = -8.
  • d=36+64=100=10d = \sqrt{36 + 64} = \sqrt{100} = 10.
  • Answer: option 3.
Q2Unknown coordinate

Numerical Answer Type (NAT).

The distance between (k,2)(k, 2) and (−1,6)(-1, 6) is 5. Find the sum of all possible values of kk.

Solution
Idea

Square the distance equation and keep both roots.

  • (k+1)2+(2−6)2=25(k + 1)^2 + (2 - 6)^2 = 25, so (k+1)2=9(k + 1)^2 = 9 and k+1=±3k + 1 = \pm 3.
  • k=2k = 2 or k=−4k = -4. Sum: 2+(−4)=−22 + (-4) = -2.
  • Answer: -2
Q3Quadrants

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements.

1
(−3,4)(-3, 4) lies in quadrant II.
2
(5,−2)(5, -2) lies in quadrant IV.
3
(−1,−1)(-1, -1) lies in quadrant II.
4
(0,3)(0, 3) lies in quadrant I.
Solution
Idea

Read the signs: I (+,+), II (−,+), III (−,−), IV (+,−).

  • Option 1: signs (−, +), quadrant II. ✓
  • Option 2: signs (+, −), quadrant IV. ✓
  • Option 3: signs (−, −) is quadrant III, not II.
  • Option 4: x=0x = 0, so the point is on the Y-axis, in no quadrant.
  • Answer: options 1 and 2.
Q4Perimeter of a triangle

Numerical Answer Type (NAT).

Find the perimeter of the triangle with vertices (0,0)(0, 0), (6,0)(6, 0) and (0,8)(0, 8).

Solution
Idea

Find all three side lengths.

  • (6−0)2+02=6\sqrt{(6 - 0)^2 + 0^2} = 6 and 02+(8−0)2=8\sqrt{0^2 + (8 - 0)^2} = 8.
  • (0−6)2+(8−0)2=36+64=10\sqrt{(0 - 6)^2 + (8 - 0)^2} = \sqrt{36 + 64} = 10.
  • Perimeter: 6+8+10=246 + 8 + 10 = 24.
  • Answer: 24
Revision overview
CoordinatesTwo perpendicular axes
Origin is (0, 0)
Signed distances
QuadrantsI: +, +   II: −, +
III: −, −   IV: +, −
Abscissa x, ordinate y
Typical problemsDistance of two points
Unknown coordinate: ± cases
Check each answer
CoordinatesWeek 2 · Sections 2.1, 2.2
Distance formula√((x₂−x₁)² + (y₂−y₁)²)
Hypotenuse of a right triangle
Order is freeEither point can be first
Negative gaps are harmless
CirclePoints at distance r
from a centre form a circle
Revision: the coordinate plane and the distance formula on one page
Next · Coordinates and pointsSection Formula and Area of a Triangle
02
Coordinates and points

Section Formula and Area of a Triangle

Two more tools for points: the section formula finds a point that divides a segment in a given ratio, and the area formula measures the triangle formed by three points.

2.1The section formula

Let A(x1,y1)A(x_1, y_1) and B(x2,y2)B(x_2, y_2) be the ends of a segment and let P(x,y)P(x, y) divide it in the ratio m:nm : n, meaning PA:PB=m:nPA : PB = m : n.

Internal section

PP lies between AA and BB.

x=mx2+nx1m+n,y=my2+ny1m+nx = \frac{mx_2 + nx_1}{m + n}, \quad y = \frac{my_2 + ny_1}{m + n}
External section

PP lies outside the segment, on its extension (needs m≠nm \neq n).

x=mx2−nx1m−n,y=my2−ny1m−nx = \frac{mx_2 - nx_1}{m - n}, \quad y = \frac{my_2 - ny_1}{m - n}
Internal: P lies between A and BABPmnPA : PB = m : nExternal: P lies outside, on the extensionABPPA = mPB = nPA : PB = m : n, with m ≠ n
Figure 3. Internal and external division of the segment AB in the ratio m : n
Midpoint

The midpoint divides the segment in the ratio 1:11 : 1. Putting m=n=1m = n = 1 in the internal formula:

(x1+x22, y1+y22)\left(\frac{x_1 + x_2}{2},\ \frac{y_1 + y_2}{2}\right)

2.2Reading the formulas

  • Weights. In m:nm : n the number mm goes with the far end BB and nn with AA: x=mx2+nx1m+nx = \frac{m x_2 + n x_1}{m + n}. A larger mm pulls PP towards BB.
  • External needs m≠nm \neq n, because m−nm - n is in the denominator. Check: A(0,0)A(0, 0), B(2,0)B(2, 0), ratio 3:13 : 1 gives x=3(2)−1(0)3−1=3x = \frac{3(2) - 1(0)}{3 - 1} = 3, and indeed PA=3PA = 3, PB=1PB = 1.
  • Centroid (extra). The average of the three vertices, (x1+x2+x33,y1+y2+y33)\left(\frac{x_1 + x_2 + x_3}{3}, \frac{y_1 + y_2 + y_3}{3}\right), is the centre of mass of a triangle; the midpoint is the two-point version of the same averaging.

2.3Area of a triangle

Area formula

The area Δ\Delta of the triangle with vertices (x1,y1)(x_1, y_1), (x2,y2)(x_2, y_2), (x3,y3)(x_3, y_3) is

Δ=12∣ x1(y2−y3)+x2(y3−y1)+x3(y1−y2) ∣\Delta = \frac{1}{2}\left|\,x_1(y_2 - y_3) + x_2(y_3 - y_1) + x_3(y_1 - y_2)\,\right|

The modulus is used because an area is never negative.

Collinear points

If the area of the triangle formed by three points is zero, the three points are collinear (lie on one line).

2.4Worked examples: area and collinearity

xyP(0, 0)Q(4, 0)R(4, 3)(2, 0)(4, 1.5)(2, 1.5)Area of the midpoint triangle½ |2(0) + 4(1.5) + 2(−1.5)|= ½ |0 + 6 − 3| = 1.5Area of PQR½ · 4 · 3 = 6so it is one quarter of PQR
Figure 4. The midpoint triangle of PQR has area 1.5

2.5Exam tips and common mistakes

Exam tips
  • Say which point is AA and which is BB before using the ratio m:nm : n; the ratio is read from AA.
  • Test a section answer by computing PAPA and PBPB with the distance formula.
  • For collinear questions set the area to 0 and solve for the unknown.
Common mistakes
  • Swapping mm and nn: the answer then divides in n:mn : m.
  • Using the internal formula with m−nm - n (or the external with m+nm + n).
  • Forgetting the 12\tfrac{1}{2} or the modulus in the area formula.

Practice questions (graded-assignment style)

Q1A dividing point

Numerical Answer Type (NAT).

The point P(x,y)P(x, y) divides the segment from (1,2)(1, 2) to (7,11)(7, 11) internally in the ratio 1:21 : 2. Find x+yx + y.

Solution
Idea

Use the internal formula with m=1m = 1, n=2n = 2.

  • x=1(7)+2(1)3=3x = \dfrac{1(7) + 2(1)}{3} = 3.
  • y=1(11)+2(2)3=5y = \dfrac{1(11) + 2(2)}{3} = 5.
  • x+y=3+5=8x + y = 3 + 5 = 8.
  • Answer: 8
Q2Midpoint

Numerical Answer Type (NAT).

Find the sum of the coordinates of the midpoint of (−4,6)(-4, 6) and (10,−2)(10, -2).

Solution
Idea

Average each coordinate.

  • Midpoint: (−4+102,6−22)=(3,2)\left(\dfrac{-4 + 10}{2}, \dfrac{6 - 2}{2}\right) = (3, 2).
  • 3+2=53 + 2 = 5.
  • Answer: 5
Q3Area of a triangle

Numerical Answer Type (NAT).

Find the area of the triangle with vertices (1,1)(1, 1), (5,1)(5, 1) and (3,5)(3, 5).

Solution
Idea

Use the area formula; check with base × height.

  • Δ=12∣1(1−5)+5(5−1)+3(1−1)∣=12∣−4+20+0∣=8\Delta = \tfrac{1}{2}\left|1(1 - 5) + 5(5 - 1) + 3(1 - 1)\right| = \tfrac{1}{2}\left|-4 + 20 + 0\right| = 8.
  • Check: the base from (1,1)(1, 1) to (5,1)(5, 1) is 4 and the height is 4, so 12⋅4⋅4=8\tfrac{1}{2} \cdot 4 \cdot 4 = 8.
  • Answer: 8
Q4Collinear points

Numerical Answer Type (NAT).

The points (1,2)(1, 2), (2,4)(2, 4) and (3,k)(3, k) lie on one line. Find kk.

Solution
Idea

Collinear means the area is zero.

  • 12∣1(4−k)+2(k−2)+3(2−4)∣=12∣k−6∣\tfrac{1}{2}\left|1(4 - k) + 2(k - 2) + 3(2 - 4)\right| = \tfrac{1}{2}\left|k - 6\right|.
  • Set it to 0: k=6k = 6. (The points have slope 2 each step, so the next point is (3,6)(3, 6).)
  • Answer: 6
Q5An external point

Numerical Answer Type (NAT).

The point PP divides the segment from A(1,1)A(1, 1) to B(3,5)B(3, 5) externally in the ratio 3:23 : 2. Find the sum of the coordinates of PP.

Solution
Idea

Use the external formula with m=3m = 3, n=2n = 2.

  • x=3(3)−2(1)3−2=7x = \dfrac{3(3) - 2(1)}{3 - 2} = 7 and y=3(5)−2(1)3−2=13y = \dfrac{3(5) - 2(1)}{3 - 2} = 13.
  • Check: PA=180PA = \sqrt{180}, PB=80PB = \sqrt{80}, and 180/80=1.5=3:2\sqrt{180}/\sqrt{80} = 1.5 = 3 : 2.
  • x+y=7+13=20x + y = 7 + 13 = 20.
  • Answer: 20
Revision overview
Internal section(mx₂ + nx₁) / (m + n)
(my₂ + ny₁) / (m + n)
P between A and B
External section(mx₂ − nx₁) / (m − n)
(my₂ − ny₁) / (m − n)
P outside, m ≠ n
MidpointRatio 1 : 1
Average of the coordinates
PointsWeek 2 · Sections 2.3, 2.4
Area of a triangle½ |x₁(y₂−y₃) + x₂(y₃−y₁) + x₃(y₁−y₂)|
ModulusArea is always positive
CollinearArea 0 means the three points
lie on one line
Revision: the section formula, midpoint and triangle area on one page
Next · Straight linesSlope, Parallel and Perpendicular Lines
03
Straight lines

Slope, Parallel and Perpendicular Lines

The slope of a line is the single number that tells you how it leans. Parallel and perpendicular lines are recognised from their slopes alone.

3.1Slope of a straight line

Definition: slope

The slope mm of a line describes both its direction and its steepness:

m=ΔyΔx=y2−y1x2−x1=tan⁡θm = \frac{\Delta y}{\Delta x} = \frac{y_2 - y_1}{x_2 - x_1} = \tan\theta

where (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) are two points on the line and θ\theta is its inclination: the angle from the positive X-axis to the line.

xy1234567123456A(1, 2)B(5, 5)Δx = 4Δy = 3θSlopem = Δy / Δx = tan θ= 3 / 4Inclination θtan θ = 3/4θ ≈ 36.87°(numbers are an example)
Figure 5. Slope is the vertical change divided by the horizontal change between two points

3.2What the slope tells you

SlopeWhat the formula showsThe line
m>0m > 0Δy\Delta y and Δx\Delta x have the same signrises from left to right
m<0m < 0they have opposite signsfalls from left to right
m=0m = 0Δy=0\Delta y = 0, so tan⁡θ=0\tan\theta = 0horizontal
no slopeΔx=0\Delta x = 0: the fraction is undefinedvertical
The slope rules (parallel, perpendicular) are for non-vertical lines. A vertical line has no slope.
Example 7Slope through the origin

What is the slope of the line through the origin and the point (−3,5)(-3, 5)?

Solution

Take (x1,y1)=(0,0)(x_1, y_1) = (0, 0) and (x2,y2)=(−3,5)(x_2, y_2) = (-3, 5): m=5−0−3−0=−53m = \frac{5 - 0}{-3 - 0} = -\frac{5}{3} The slope is negative, so the line falls from left to right.

xy-5-4-3-2-1123-1123456Q(−3, 5)Δx = −3Δy = 5m = (5 − 0) / (−3 − 0)m = −5/3negative slope: the line fallsas it goes from left to right
Figure 6. The line through the origin and (−3, 5)

3.3Parallel and perpendicular lines

Let l1l_1 and l2l_2 be non-vertical lines with slopes m1m_1, m2m_2.

Parallel

l1∥l2l_1 \parallel l_2 if and only if the slopes are equal: m1=m2m_1 = m_2.

Perpendicular

l1⊥l2l_1 \perp l_2 if and only if m1m2=−1m_1 m_2 = -1.

xym₁ = 1m₂ = 1xym₁ = 2m₂ = −1/2ParallelPerpendicularm₁ = m₂m₁ · m₂ = 2 · (−1/2) = −1
Figure 7. Parallel lines lean the same way; perpendicular lines have slopes that multiply to −1
Remember

If m1m2=−1m_1 m_2 = -1 then m2=−1m1m_2 = -\dfrac{1}{m_1}: the perpendicular slope is the negative reciprocal. A line of slope 2 is perpendicular to a line of slope −12-\dfrac{1}{2}.

3.4Going deeper

  • Slope is a rate of change. A slope of 3 means y goes up by 3 for every 1 step in x. This is exactly the idea behind a fitted line in Part 7.
  • Use the same point first. In y2−y1x2−x1\dfrac{y_2 - y_1}{x_2 - x_1} both the top and the bottom must start from the same point. Swapping both gives the same answer, swapping only one flips the sign.
  • Equal slopes: parallel or the same line. To separate the two cases check whether one point of the first line lies on the second.
  • Collinearity by slope. Three points are collinear exactly when the slope from the first to the second equals the slope from the second to the third.

3.5Exam tips and common mistakes

Exam tips
  • For perpendicular, flip the fraction and change the sign: slope 34\tfrac{3}{4} becomes −43-\tfrac{4}{3}.
  • Check any slope answer by plugging both points back into ΔyΔx\dfrac{\Delta y}{\Delta x}.
Common mistakes
  • Mixing up the order: y2−y1x1−x2\dfrac{y_2 - y_1}{x_1 - x_2}.
  • Using the slope rules for a vertical line, which has no slope.
  • Thinking perpendicular means m1=−m2m_1 = -m_2. It means m1m2=−1m_1 m_2 = -1.

Practice questions (graded-assignment style)

Q1A slope

Numerical Answer Type (NAT).

Find the slope of the line through (2,−3)(2, -3) and (6,5)(6, 5).

Solution
Idea

Rise over run.

  • m=5−(−3)6−2=84=2m = \dfrac{5 - (-3)}{6 - 2} = \dfrac{8}{4} = 2.
  • Answer: 2
Q2Parallel condition

Numerical Answer Type (NAT).

The line through (1,1)(1, 1) and (3,k)(3, k) is parallel to the line through (0,0)(0, 0) and (2,6)(2, 6). Find kk.

Solution
Idea

Parallel lines have equal slopes.

  • Slope of the second line: 6−02−0=3\dfrac{6 - 0}{2 - 0} = 3.
  • k−13−1=3\dfrac{k - 1}{3 - 1} = 3 gives k−1=6k - 1 = 6, so k=7k = 7.
  • Answer: 7
Q3Perpendicular condition

Numerical Answer Type (NAT).

The line through (0,0)(0, 0) and (a,6)(a, 6) is perpendicular to a line of slope 32\dfrac{3}{2}. Find aa.

Solution
Idea

The product of slopes is −1.

  • Required slope: −23-\dfrac{2}{3}.
  • 6a=−23\dfrac{6}{a} = -\dfrac{2}{3} gives a=−9a = -9.
  • Check: 6−9=−23\dfrac{6}{-9} = -\dfrac{2}{3} and −23×32=−1-\dfrac{2}{3} \times \dfrac{3}{2} = -1.
  • Answer: -9
Q4Slope facts

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements.

1
The line through (1,2)(1, 2) and (3,6)(3, 6) rises from left to right.
2
Lines of slope 2 and −12-\dfrac{1}{2} are perpendicular.
3
Lines of slope 2 and 3 are parallel.
4
A vertical line has slope 0.
Solution
Idea

Use the sign of the slope and the two rules.

  • Option 1: slope 2>02 > 0. ✓
  • Option 2: 2×(−12)=−12 \times (-\tfrac{1}{2}) = -1. ✓
  • Option 3: parallel needs equal slopes, and 2≠32 \neq 3.
  • Option 4: a vertical line has no slope (the fraction is undefined); a horizontal line has slope 0.
  • Answer: options 1 and 2.
Revision overview
Definitionm = Δy / Δx
= (y₂ − y₁) / (x₂ − x₁)
= tan θ
MeaningDirection and steepness
θ from the positive X-axis
Signsm > 0 rises, m < 0 falls
m = 0 horizontal
vertical: no slope
SlopeWeek 2 · Section 2.5.1
Parallelm₁ = m₂
If and only if
(or the same line)
Perpendicularm₁ × m₂ = −1
Negative reciprocal
If and only if
Non-verticalThe rules are for lines
that have a slope
Revision: slope and its two key consequences
Next · Straight linesEquations and Forms of a Straight Line
04
Straight lines

Equations and Forms of a Straight Line

A line is described by an equation: a relation between x and y that is true for exactly the points on the line. There are several standard forms, and each suits different given information.

4.1The three basic forms

A line is described by an equation: a relation between xx and yy that is true for exactly the points on the line. Each standard form suits different given information.

Slope-intercept
y=mx+cy = mx + c

mm is the slope and cc is the y-intercept.

Point-slope
y−y1=m(x−x1)y - y_1 = m(x - x_1)

A line of slope mm through (x1,y1)(x_1, y_1).

Two-point
y−y1=y2−y1x2−x1(x−x1)y - y_1 = \frac{y_2 - y_1}{x_2 - x_1}(x - x_1)

The line joining two points. It is the point-slope form with the slope m=y2−y1x2−x1m = \frac{y_2 - y_1}{x_2 - x_1} worked out from the two points.

4.2All the forms of a straight line

FormRepresentationUse it when you know
Generalax+by+c=0ax + by + c = 0a standard shape for any line
Slope-point(y−y0)=m(x−x0)(y - y_0) = m(x - x_0)slope and one point
Slope-intercept (y)y=mx+cy = mx + cslope and the y-intercept
Slope-intercept (x)y=m(x−d)y = m(x - d)slope and the x-intercept dd
Interceptxa+yb=1\dfrac{x}{a} + \dfrac{y}{b} = 1both intercepts aa and bb
Two-point(y−y1)=y2−y1x2−x1(x−x1)(y - y_1) = \dfrac{y_2 - y_1}{x_2 - x_1}(x - x_1)two points on the line

In the x-intercept form y=m(x−d)y = m(x - d), putting y=0y = 0 gives x=dx = d, so dd is the x-intercept. In the intercept form aa and bb are the x- and y-intercepts.

xy-112345-1123(3, 0)(0, 2)2x + 3y − 6 = 0General2x + 3y − 6 = 0y-intercept formy = (−2/3)x + 2x-intercept formy = (−2/3)(x − 3)Intercept formx/3 + y/2 = 1Point-slopey − 2 = (−2/3)(x − 0)Two-pointy − 0 = ((2 − 0)/(0 − 3))(x − 3)
Figure 8. One line, 2x + 3y − 6 = 0, written in every form

4.3Choosing the form

What you knowForm to use
Slope and the y-intercepty=mx+cy = mx + c
Slope and one point(y−y1)=m(x−x1)(y - y_1) = m(x - x_1)
Two points(y−y1)=y2−y1x2−x1(x−x1)(y - y_1) = \dfrac{y_2 - y_1}{x_2 - x_1}(x - x_1)
Slope and the x-intercepty=m(x−d)y = m(x - d)
Both interceptsxa+yb=1\dfrac{x}{a} + \dfrac{y}{b} = 1
Any line, in a standard shapeax+by+c=0ax + by + c = 0

4.4Going deeper

  • Read the general form directly (extra). For ax+by+c=0ax + by + c = 0 with b≠0b \neq 0: slope =−ab= -\dfrac{a}{b}, y-intercept =−cb= -\dfrac{c}{b}, and (if a≠0a \neq 0) x-intercept =−ca= -\dfrac{c}{a}. For 2x+3y−6=02x + 3y - 6 = 0: −23-\tfrac{2}{3}, 22 and 33.
  • Horizontal and vertical lines (extra). A horizontal line is y=ky = k (slope 0). A vertical line is x=hx = h and has no slope, so it cannot be written as y=mx+cy = mx + c.
  • A point lies on a line exactly when its coordinates satisfy the equation. Substitute and see whether both sides agree.
  • The six forms describe the same line. Conversion is only algebra: expand, move terms, divide.

4.5Exam tips and common mistakes

Exam tips
  • Pick the form from what is given (Section 4.3), then convert only if the question asks for another form.
  • Always verify by substituting a given point into your final equation.
Common mistakes
  • Mixing x1x_1 and y1y_1 in point-slope form: it is y−y1y - y_1 with m(x−x1)m(x - x_1).
  • Sign errors when moving terms to the other side.
  • Using the intercept form when an intercept is 0 (the line passes through the origin).

Practice questions (graded-assignment style)

Q1Slope and a point

Multiple Choice Question (MCQ): choose the one correct option.

Which is the line of slope −2-2 through the point (3,1)(3, 1)?

1
y=−2x+7y = -2x + 7
2
y=−2x+5y = -2x + 5
3
y=2x−5y = 2x - 5
4
y=−2x−7y = -2x - 7
Solution
Idea

Use the point-slope form and expand.

  • y−1=−2(x−3)=−2x+6y - 1 = -2(x - 3) = -2x + 6, so y=−2x+7y = -2x + 7.
  • Check: at x=3x = 3, −2(3)+7=1-2(3) + 7 = 1. ✓
  • Answer: option 1.
Q2The y-intercept

Numerical Answer Type (NAT).

Find the y-intercept of the line through (2,3)(2, 3) and (4,7)(4, 7).

Solution
Idea

Slope first, then the equation.

  • m=7−34−2=2m = \dfrac{7 - 3}{4 - 2} = 2.
  • y−3=2(x−2)y - 3 = 2(x - 2), so y=2x−1y = 2x - 1.
  • The y-intercept is c=−1c = -1.
  • Answer: -1
Q3The x-intercept

Numerical Answer Type (NAT).

Find the x-intercept of the line 3x−2y+12=03x - 2y + 12 = 0.

Solution
Idea

Put y=0y = 0.

  • y=0y = 0 gives 3x+12=03x + 12 = 0, so x=−4x = -4.
  • Answer: -4
Q4Intercept form

Multiple Choice Question (MCQ): choose the one correct option.

A line has x-intercept 4 and y-intercept −2-2. Which is its intercept form?

1
x4+y−2=1\dfrac{x}{4} + \dfrac{y}{-2} = 1
2
x4+y2=1\dfrac{x}{4} + \dfrac{y}{2} = 1
3
x2+y4=1\dfrac{x}{2} + \dfrac{y}{4} = 1
4
x−4+y2=1\dfrac{x}{-4} + \dfrac{y}{2} = 1
Solution
Idea

The form is xa+yb=1\frac{x}{a} + \frac{y}{b} = 1 with a=4a = 4, b=−2b = -2.

  • Option 1 puts a=4a = 4 and b=−2b = -2 in the right places.
  • Check: (4,0)(4, 0) gives 1+0=11 + 0 = 1 ✓ and (0,−2)(0, -2) gives 0+1=10 + 1 = 1 ✓.
  • Answer: option 1.
Q5Points on a line

Multiple Select Question (MSQ): select all that apply.

Which points lie on the line y=2x−1y = 2x - 1?

1
(1,1)(1, 1)
2
(2,3)(2, 3)
3
(0,1)(0, 1)
4
(−1,−3)(-1, -3)
Solution
Idea

Substitute the coordinates.

  • (1,1)(1, 1): 2(1)−1=12(1) - 1 = 1. ✓
  • (2,3)(2, 3): 2(2)−1=32(2) - 1 = 3. ✓
  • (0,1)(0, 1): 2(0)−1=−1≠12(0) - 1 = -1 \neq 1. ✗
  • (−1,−3)(-1, -3): 2(−1)−1=−32(-1) - 1 = -3. ✓
  • Answer: options 1, 2 and 4.
Revision overview
Slope-intercepty = mx + c
m slope, c y-intercept
y = m(x − d), d x-intercept
Point-slope(y − y₁) = m(x − x₁)
Slope plus one point
Two-pointSlope from the two points
Then use point-slope
Equations of a lineWeek 2 · Sections 2.5.2, 2.6
Intercept formx/a + y/b = 1
a and b are the intercepts
General formax + by + c = 0
Every form converts to it
CheckingSubstitute a known point
into the final equation
Revision: the six forms and when to use each
Next · Straight linesAngle Between Two Lines
05
Straight lines

Angle Between Two Lines

Two lines that meet form angles at the point of intersection. Their slopes alone are enough to find those angles.

5.1The angle between two lines

Let l1l_1 and l2l_2 be lines with slopes m1m_1, m2m_2 and inclinations α1\alpha_1, α2\alpha_2, and assume α2>α1\alpha_2 > \alpha_1. If they intersect and form adjacent angles θ\theta and φ\varphi, then:

Angle formulas
tan⁡θ=m2−m11+m2m1,tan⁡φ=m1−m21+m1m2\tan\theta = \frac{m_2 - m_1}{1 + m_2 m_1}, \qquad \tan\varphi = \frac{m_1 - m_2}{1 + m_1 m_2}
xyθα₁α₂φl₁: m₁ = 1/2l₂: m₂ = 3tan θ = (m₂ − m₁)/(1 + m₂m₁)= 2.5 / 2.5 = 1θ = 45°tan φ = −tan θ = −1φ = 135°θ = α₂ − α₁θ + φ = 180°
Figure 9. The lines l₁ and l₂, their inclinations and the angles θ and φ they form

5.2Reading the two formulas

  • The numerators are opposite, so tan⁡φ=−tan⁡θ\tan\varphi = -\tan\theta. That fits two adjacent angles on a straight line, which add up to 180∘180^\circ.
  • θ=α2−α1\theta = \alpha_2 - \alpha_1, so tan⁡θ=tan⁡(α2−α1)\tan\theta = \tan(\alpha_2 - \alpha_1): θ\theta is the gap between the two inclinations.
  • The perpendicular case. If m1m2=−1m_1 m_2 = -1, the denominator 1+m1m21 + m_1 m_2 is zero, so the tangent is undefined: the angle is exactly 90∘90^\circ. This agrees with the perpendicularity rule of Part 3.

5.3Going deeper

  • The acute angle (extra). Taking the modulus, tan⁡θ=∣m2−m11+m1m2∣\tan\theta = \left|\dfrac{m_2 - m_1}{1 + m_1 m_2}\right| always gives the acute angle between the lines, so you do not have to worry which slope is larger.
  • Equal slopes. m1=m2m_1 = m_2 gives tan⁡θ=0\tan\theta = 0, angle 0∘0^\circ: the lines are parallel.
  • Check with inclinations. For slopes 12\tfrac{1}{2} and 3: α1≈26.57∘\alpha_1 \approx 26.57^\circ, α2≈71.57∘\alpha_2 \approx 71.57^\circ, and 71.57−26.57=4571.57 - 26.57 = 45.

5.4Exam tips and common mistakes

Exam tips
  • Compute 1+m1m21 + m_1 m_2 first: if it is 0 the answer is 90∘90^\circ and you are done.
  • Give both θ\theta and φ\varphi when the question asks for "the angles", and check that they add to 180∘180^\circ.
Common mistakes
  • Writing 1−m1m21 - m_1 m_2 in the denominator.
  • Putting m1−m2m_1 - m_2 in the numerator of tan⁡θ\tan\theta (it is m2−m1m_2 - m_1 when α2>α1\alpha_2 > \alpha_1).
  • Forgetting the negative sign of tan⁡φ\tan\varphi and reporting 45∘45^\circ twice.

Practice questions (graded-assignment style)

Q1Slopes 0 and 1

Numerical Answer Type (NAT).

Find the angle θ\theta (in degrees) between lines of slopes 0 and 1.

Solution
Idea

Use m1=0m_1 = 0, m2=1m_2 = 1.

  • tan⁡θ=1−01+1⋅0=1\tan\theta = \dfrac{1 - 0}{1 + 1 \cdot 0} = 1, so θ=45∘\theta = 45^\circ.
  • Answer: 45
Q2Reciprocal of the tangent

Numerical Answer Type (NAT).

For lines of slopes 2 and 3 find 1tan⁡θ\dfrac{1}{\tan\theta}.

Solution
Idea

Compute tan⁡θ\tan\theta first.

  • tan⁡θ=3−21+3⋅2=17\tan\theta = \dfrac{3 - 2}{1 + 3 \cdot 2} = \dfrac{1}{7}.
  • So 1tan⁡θ=7\dfrac{1}{\tan\theta} = 7.
  • Answer: 7
Q3Which angle?

Multiple Choice Question (MCQ): choose the one correct option.

What is the angle between lines of slopes 3 and −13-\dfrac{1}{3}?

1
0∘0^\circ
2
45∘45^\circ
3
90∘90^\circ
4
It cannot be found
Solution
Idea

Check 1+m1m21 + m_1 m_2.

  • 1+3⋅(−13)=1−1=01 + 3 \cdot \left(-\dfrac{1}{3}\right) = 1 - 1 = 0: the tangent is undefined.
  • So the lines are perpendicular and the angle is 90∘90^\circ.
  • Answer: option 3.
Q4The adjacent angle

Numerical Answer Type (NAT).

For slopes 12\dfrac{1}{2} and 33 we found θ=45∘\theta = 45^\circ. Find φ\varphi in degrees.

Solution
Idea

Adjacent angles on a line add to 180∘180^\circ.

  • φ=180∘−45∘=135∘\varphi = 180^\circ - 45^\circ = 135^\circ.
  • Also tan⁡φ=−tan⁡θ=−1\tan\varphi = -\tan\theta = -1, which gives 135∘135^\circ.
  • Answer: 135
Q5A non-standard angle

Numerical Answer Type (NAT).

Find the angle θ\theta between lines of slopes 1 and 3, rounded to the nearest degree.

Solution
Idea

tan⁡θ\tan\theta first, then tan⁡−1\tan^{-1}.

  • tan⁡θ=3−11+3=12\tan\theta = \dfrac{3 - 1}{1 + 3} = \dfrac{1}{2}.
  • θ=tan⁡−112≈26.57∘\theta = \tan^{-1}\tfrac{1}{2} \approx 26.57^\circ, which rounds to 27∘27^\circ.
  • Answer: 27
Revision overview
SettingSlopes m₁, m₂
Inclinations α₁ < α₂
Adjacent angles θ and φ
Formula for θtan θ = (m₂ − m₁) / (1 + m₂m₁)
θ = α₂ − α₁
Formula for φtan φ = (m₁ − m₂) / (1 + m₁m₂)
tan φ = − tan θ
Angle between linesWeek 2 · Section 2.5.3
Sumθ + φ = 180°
Special case1 + m₁m₂ = 0
Lines are perpendicular
Angle is 90°
Parallelm₁ = m₂ gives tan θ = 0
Angle 0°
Revision: the angle between two lines from their slopes
Next · General equation and fittingGeneral Equation: Conditions and Distances
06
General equation and fitting

General Equation: Conditions and Distances

When a line is written in the general form ax + by + c = 0, its coefficients answer questions directly: are two lines parallel or perpendicular, how far is a point from the line, and how far apart are two parallel lines.

6.1Parallel and perpendicular lines in general form

Given two lines a1x+b1y+c1=0a_1 x + b_1 y + c_1 = 0 and a2x+b2y+c2=0a_2 x + b_2 y + c_2 = 0, with b1,b2≠0b_1, b_2 \neq 0:

Parallel

a1b2=a2b1a_1 b_2 = a_2 b_1

Same slope: −a1b1=−a2b2-\dfrac{a_1}{b_1} = -\dfrac{a_2}{b_2}, cross-multiplied.

Perpendicular

a1a2=−b1b2a_1 a_2 = -b_1 b_2

Slopes multiply to −1-1: a1a2b1b2=−1\dfrac{a_1 a_2}{b_1 b_2} = -1, cross-multiplied.

Where the conditions come from. Solving ax+by+c=0ax + by + c = 0 for yy gives y=−abx−cby = -\dfrac{a}{b}x - \dfrac{c}{b}, so the slope is −ab-\dfrac{a}{b} (this needs b≠0b \neq 0). Equal slopes give a1b2=a2b1a_1 b_2 = a_2 b_1; slopes with product −1-1 give a1a2=−b1b2a_1 a_2 = -b_1 b_2.

6.2Distance of a point from a line

Point-to-line distance

The distance dd of the line ax+by+c=0ax + by + c = 0 from the point (x1,y1)(x_1, y_1) is

d=∣ax1+by1+c∣a2+b2d = \frac{|a x_1 + b y_1 + c|}{\sqrt{a^2 + b^2}}

Put the point into the left side of the equation, take the modulus, and divide by a2+b2\sqrt{a^2 + b^2}.

  • The result is the shortest (perpendicular) distance, so it is never negative.
  • If the numerator is 00, the point lies on the line.

6.3Distance between two parallel lines

Parallel-line distance

The distance DD between the parallel lines ax+by+c1=0ax + by + c_1 = 0 and ax+by+c2=0ax + by + c_2 = 0 is

D=∣c1−c2∣a2+b2D = \frac{|c_1 - c_2|}{\sqrt{a^2 + b^2}}
Remember

Both equations must have the same aa and bb. If not, multiply or divide one equation so that they match (as in Example 21).

xyOd = 2.4xyD = 3Point to lineBetween parallel lines|3·0 + 4·0 − 12| / 5 = 12/5|−12 − 3| / 5 = 3
Figure 10. The point-to-line distance and the distance between two parallel lines

6.4Going deeper

  • The vector (a,b)(a, b) is perpendicular to the line (extra). That is why the perpendicular distance has a2+b2\sqrt{a^2 + b^2} underneath: it is the length of (a,b)(a, b). It also explains the perpendicularity test: two lines are perpendicular when their (a,b)(a, b) vectors are, a1a2+b1b2=0a_1 a_2 + b_1 b_2 = 0.
  • Special cases. The distance of (x1,y1)(x_1, y_1) from the X-axis (y=0y = 0) is ∣y1∣|y_1|, and from the Y-axis (x=0x = 0) it is ∣x1∣|x_1|.
  • Parallel distance is a point distance. Pick any point on one line and use the point formula on the other (Example 21 does this as a check).
  • Equal cc after matching a,ba, b means the two lines are the same line, with distance 0.

6.5Perpendicular bisector, foot and reflection, and lines through an intersection point

A. Perpendicular bisector of a segment

The perpendicular bisector of ABAB passes through the midpoint of ABAB and is perpendicular to ABAB. Two ways to get it:

  • Midpoint and slope. For A(1,2)A(1, 2), B(5,4)B(5, 4): midpoint (3,3)(3, 3); slope of ABAB is 4−25−1=12\dfrac{4 - 2}{5 - 1} = \dfrac12; the perpendicular slope is −2-2. So y−3=−2(x−3)y - 3 = -2(x - 3), i.e. 2x+y=92x + y = 9.
  • Equal distances. Every point P(x,y)P(x, y) on it satisfies PA=PBPA = PB. Squaring: (x−1)2+(y−2)2=(x−5)2+(y−4)2(x - 1)^2 + (y - 2)^2 = (x - 5)^2 + (y - 4)^2, which simplifies to 8x+4y−36=08x + 4y - 36 = 0, the same line 2x+y=92x + y = 9 ✓. This also works when the segment is vertical or horizontal, where slopes cause trouble.

B. Foot of the perpendicular and reflection

Let P(x1,y1)P(x_1, y_1) and the line ax+by+c=0ax + by + c = 0. Put t=ax1+by1+ca2+b2t = \dfrac{ax_1 + by_1 + c}{a^2 + b^2}. Then

foot=(x1−at, y1−bt),reflection=(x1−2at, y1−2bt),distance=∣t∣a2+b2\text{foot} = (x_1 - at,\ y_1 - bt), \qquad \text{reflection} = (x_1 - 2at,\ y_1 - 2bt), \qquad \text{distance} = |t|\sqrt{a^2 + b^2}

Why. The direction (a,b)(a, b) is perpendicular to the line, so the foot is PP moved along (a,b)(a, b) by some multiple −t-t. Putting (x1−at, y1−bt)(x_1 - at,\ y_1 - bt) into the line equation and solving gives that tt. The reflection goes twice as far. The distance formula ∣ax1+by1+c∣a2+b2\dfrac{|ax_1 + by_1 + c|}{\sqrt{a^2 + b^2}} is the same as ∣t∣a2+b2|t|\sqrt{a^2 + b^2}.

Example. P(1,2)P(1, 2) and x+y−6=0x + y - 6 = 0. Here t=1+2−62=−32t = \dfrac{1 + 2 - 6}{2} = -\dfrac32. The foot is (1+32, 2+32)=(52,72)\left(1 + \tfrac32,\ 2 + \tfrac32\right) = \left(\tfrac52, \tfrac72\right); check: 52+72=6\tfrac52 + \tfrac72 = 6 ✓. The reflection is (1+3, 2+3)=(4,5)(1 + 3,\ 2 + 3) = (4, 5), and the midpoint of PP and (4,5)(4, 5) is (52,72)\left(\tfrac52, \tfrac72\right), the foot ✓. The distance is 322=32≈2.12\dfrac32\sqrt2 = \dfrac{3}{\sqrt2} \approx 2.12.

C. Intersection of lines, concurrency and the family of lines

  • Two lines that are not parallel meet at one point: solve the two equations together.
  • Three lines are concurrent (pass through one point) when the 3×33 \times 3 determinant of their coefficients ∣a1b1c1a2b2c2a3b3c3∣\begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{vmatrix} is 00, provided the first two are not parallel. Example: x+y−3=0x + y - 3 = 0 and 2x−y=02x - y = 0 meet at (1,2)(1, 2). The line x−2y+3=0x - 2y + 3 = 0 passes through (1,2)(1, 2) since 1−4+3=01 - 4 + 3 = 0, and the determinant ∣11−32−101−23∣=0\begin{vmatrix} 1 & 1 & -3 \\ 2 & -1 & 0 \\ 1 & -2 & 3 \end{vmatrix} = 0 ✓.
  • Family of lines. Every line through the intersection of L1=0L_1 = 0 and L2=0L_2 = 0 can be written L1+λL2=0L_1 + \lambda L_2 = 0 (for some number λ\lambda, or L2=0L_2 = 0 itself). Use one more condition to find λ\lambda. Example: the line through the intersection of 2x+3y−5=02x + 3y - 5 = 0 and x−y+1=0x - y + 1 = 0 and the origin: (2x+3y−5)+λ(x−y+1)=0(2x + 3y - 5) + \lambda(x - y + 1) = 0 at (0,0)(0, 0) gives −5+λ=0-5 + \lambda = 0, so λ=5\lambda = 5, and the line is 7x−2y=07x - 2y = 0. Check: the lines meet at (25,75)\left(\tfrac25, \tfrac75\right) and 7⋅25−2⋅75=07 \cdot \tfrac25 - 2 \cdot \tfrac75 = 0 ✓.

6.6Exam tips and common mistakes

Exam tips
  • Write each line as ax+by+c=0ax + by + c = 0 first (everything on one side) and list a,b,ca, b, c.
  • For the parallel distance make a,ba, b equal before reading the cc values.
Common mistakes
  • Forgetting the modulus, which can give a negative distance.
  • Using ∣c1−c2∣|c_1 - c_2| when a,ba, b differ between the two equations.
  • Forgetting to move the constant to the left so that the equation has =0= 0.

Practice questions (graded-assignment style)

Q1Parallel or perpendicular?

Multiple Select Question (MSQ): select all that apply.

Pair A: 2x+y−3=02x + y - 3 = 0 and 4x+2y+5=04x + 2y + 5 = 0. Pair B: 3x−2y+1=03x - 2y + 1 = 0 and 2x+3y−4=02x + 3y - 4 = 0. Choose the correct statements.

1
Pair A is parallel.
2
Pair B is perpendicular.
3
Pair A is perpendicular.
4
Pair B is parallel.
Solution
Idea

Use a1b2=a2b1a_1 b_2 = a_2 b_1 for parallel and a1a2=−b1b2a_1 a_2 = -b_1 b_2 for perpendicular.

  • Pair A: a1b2=2⋅2=4a_1 b_2 = 2 \cdot 2 = 4 and a2b1=4⋅1=4a_2 b_1 = 4 \cdot 1 = 4. Equal, so parallel.
  • Pair B: a1a2=3⋅2=6a_1 a_2 = 3 \cdot 2 = 6 and −b1b2=−(−2)(3)=6-b_1 b_2 = -(-2)(3) = 6. Equal, so perpendicular.
  • So options 3 and 4 are false.
  • Answer: options 1 and 2.
Q2A parallel condition

Numerical Answer Type (NAT).

For which kk is kx+2y−1=0kx + 2y - 1 = 0 parallel to 3x+4y+2=03x + 4y + 2 = 0?

Solution
Idea

Use a1b2=a2b1a_1 b_2 = a_2 b_1.

  • k⋅4=3⋅2k \cdot 4 = 3 \cdot 2, so k=64=1.5k = \dfrac{6}{4} = 1.5.
  • Check: slopes −1.52=−0.75-\dfrac{1.5}{2} = -0.75 and −34=−0.75-\dfrac{3}{4} = -0.75.
  • Answer: 1.5
Q3Point to line

Numerical Answer Type (NAT).

Find the distance of the point (1,2)(1, 2) from the line 3x+4y−5=03x + 4y - 5 = 0.

Solution
Idea

Substitute the point and divide by a2+b2\sqrt{a^2 + b^2}.

  • ∣3(1)+4(2)−5∣=∣3+8−5∣=6|3(1) + 4(2) - 5| = |3 + 8 - 5| = 6.
  • 32+42=5\sqrt{3^2 + 4^2} = 5, so d=65=1.2d = \dfrac{6}{5} = 1.2.
  • Answer: 1.2
Q4Between parallel lines

Numerical Answer Type (NAT).

Find the distance between x+y−2=0x + y - 2 = 0 and x+y+4=0x + y + 4 = 0, correct to two decimals.

Solution
Idea

Both lines already have the same a=b=1a = b = 1.

  • D=∣−2−4∣12+12=62=32≈4.24D = \dfrac{|-2 - 4|}{\sqrt{1^2 + 1^2}} = \dfrac{6}{\sqrt{2}} = 3\sqrt{2} \approx 4.24.
  • Answer: 4.24
Q5Another parallel condition

Numerical Answer Type (NAT).

For which kk is 2x+ky−3=02x + ky - 3 = 0 parallel to 6x+9y+1=06x + 9y + 1 = 0?

Solution
Idea

a1b2=a2b1a_1 b_2 = a_2 b_1.

  • 2⋅9=6⋅k2 \cdot 9 = 6 \cdot k, so k=3k = 3.
  • Check: slopes −23-\dfrac{2}{3} and −69=−23-\dfrac{6}{9} = -\dfrac{2}{3}.
  • Answer: 3
P1A perpendicular bisector

Numerical Answer Type (NAT).

The perpendicular bisector of the segment joining A(1,2)A(1, 2) and B(5,4)B(5, 4) is 2x+y=k2x + y = k. Find kk.

Solution
Idea

The bisector passes through the midpoint, and every point on it is equidistant from AA and BB.

  • Midpoint (3,3)(3, 3) lies on 2x+y=k2x + y = k, so k=2(3)+3=9k = 2(3) + 3 = 9.
  • Check with a second point on the line, (4,1)(4, 1): PA2=9+1=10PA^2 = 9 + 1 = 10 and PB2=1+9=10PB^2 = 1 + 9 = 10 ✓ (and 2(4)+1=92(4) + 1 = 9).
  • Answer: 9
P2Foot of a perpendicular

Numerical Answer Type (NAT).

Find the xx-coordinate of the foot of the perpendicular from P(1,2)P(1, 2) to the line x+y−6=0x + y - 6 = 0.

Solution
Idea

The foot is (x1−at, y1−bt)(x_1 - at,\ y_1 - bt) with t=ax1+by1+ca2+b2t = \dfrac{ax_1 + by_1 + c}{a^2 + b^2}.

  • t=1+2−61+1=−32t = \dfrac{1 + 2 - 6}{1 + 1} = -\dfrac32.
  • Foot =(1+32, 2+32)=(2.5,3.5)= \left(1 + \tfrac32,\ 2 + \tfrac32\right) = (2.5, 3.5). It lies on the line (2.5+3.5=62.5 + 3.5 = 6) and PP to the foot has direction (1.5,1.5)(1.5, 1.5), perpendicular to the line (slope −1-1) ✓.
  • Answer: 2.5
P3Reflection of a point

Multiple Choice Question (MCQ): choose the one correct option.

The reflection of P(1,2)P(1, 2) in the line x+y=6x + y = 6 is

1
(5,4)(5, 4)
2
(4,5)(4, 5)
3
(2.5,3.5)(2.5, 3.5)
4
(3,3)(3, 3)
Solution
Idea

The foot of the perpendicular is the midpoint of PP and its reflection.

  • The foot is (2.5,3.5)(2.5, 3.5) (see P2). If the image is (u,v)(u, v): 1+u2=2.5\tfrac{1 + u}{2} = 2.5 and 2+v2=3.5\tfrac{2 + v}{2} = 3.5, so (u,v)=(4,5)(u, v) = (4, 5).
  • Check: 4+5=94 + 5 = 9 is as far above 66 as 1+2=31 + 2 = 3 is below it. Option 3 is the foot itself, not the image.
  • Answer: option 2.
P4Concurrent lines

Numerical Answer Type (NAT).

The lines x+y−3=0x + y - 3 = 0, 2x−y=02x - y = 0 and x−2y+k=0x - 2y + k = 0 are concurrent. Find kk.

Solution
Idea

Find where the first two meet; the third must pass through that point.

  • Adding the first two equations: 3x−3=03x - 3 = 0, so x=1x = 1 and y=2y = 2. The lines meet at (1,2)(1, 2).
  • 1−2(2)+k=0⇒k=31 - 2(2) + k = 0 \Rightarrow k = 3.
  • Determinant check: ∣11−32−101−2k∣=1(−k)−1(2k)+(−3)(−4+1)=−3k+9\begin{vmatrix} 1 & 1 & -3 \\ 2 & -1 & 0 \\ 1 & -2 & k \end{vmatrix} = 1(-k) - 1(2k) + (-3)(-4 + 1) = -3k + 9, which is 00 exactly when k=3k = 3 ✓.
  • Answer: 3
P5A line through an intersection point and the origin

Numerical Answer Type (NAT).

Find the slope of the line through the origin and the point where 2x+3y−5=02x + 3y - 5 = 0 meets x−y+1=0x - y + 1 = 0.

Solution
Idea

Either solve for the intersection and use two points, or use the family L1+λL2=0L_1 + \lambda L_2 = 0.

  • From x=y−1x = y - 1: 2y−2+3y−5=02y - 2 + 3y - 5 = 0, so y=75y = \tfrac75 and x=25x = \tfrac25. The slope from the origin is 7/52/5=72=3.5\dfrac{7/5}{2/5} = \dfrac72 = 3.5.
  • Family method: (2x+3y−5)+λ(x−y+1)=0(2x + 3y - 5) + \lambda(x - y + 1) = 0 through (0,0)(0, 0) gives λ=5\lambda = 5, line 7x−2y=07x - 2y = 0, slope 72\tfrac72 ✓.
  • Answer: 3.5
Revision overview
General formax + by + c = 0
Slope is −a / b
b ≠ 0 for the tests
Parallela₁ b₂ = a₂ b₁
Same slope
Perpendiculara₁ a₂ = −b₁ b₂
Slopes multiply to −1
General equationWeek 2 · Sections 2.7 to 2.9
Point to line|ax₁ + by₁ + c| / √(a² + b²)
Insert the point, take modulus
Between parallels|c₁ − c₂| / √(a² + b²)
Same a and b first
AlwaysDistances are never negative
Numerator 0: point is on the line
Revision: conditions and distances from the general equation
Next · General equation and fittingStraight-Line Fit and Sum Squared Error
07
General equation and fitting

Straight-Line Fit and Sum Squared Error

Real data rarely lies exactly on a line. A line of fit is a straight line chosen to follow the data, and the Sum Squared Error measures how far the data is from it.

7.1Sum squared error

Real data rarely lies exactly on a line. A line of fit is a straight line chosen to follow the data, and the Sum Squared Error measures how far the data is from it.

Definition: SSE

SSE is the sum of the squares of the deviations of the predicted linear model from the actual data. For nn points (xi,yi)(x_i, y_i) and a line of fit y=mx+cy = mx + c:

SSE=∑i=1n(yi−mxi−c)2\text{SSE} = \sum_{i=1}^{n}\left(y_i - m x_i - c\right)^2

For each point, mxi+cm x_i + c is the value the line predicts and yiy_i is the actual value. Their difference is the deviation; each deviation is squared, and the squares are added.

Why square?

Deviations above the line are positive and below are negative, so adding them directly lets them cancel. In the example below the plain deviations add up to 1+0−1−2=−21 + 0 - 1 - 2 = -2, but the SSE is 6. Squares are never negative, so every miss counts.

7.2Computing the SSE

Example 22Computing the SSE

A line of fit y=2x+2y = 2x + 2 is given for the data (1,5),(2,6),(4,9),(9,18)(1, 5), (2, 6), (4, 9), (9, 18). Compute the sum squared error.

Solution
  1. There are 4 points and m=2m = 2, c=2c = 2, so SSE=∑(yi−2xi−2)2\text{SSE} = \sum (y_i - 2x_i - 2)^2.
  2. Write the four terms: (5−2−2)2+(6−4−2)2+(9−8−2)2+(18−18−2)2=(1)2+(0)2+(−1)2+(−2)2(5 - 2 - 2)^2 + (6 - 4 - 2)^2 + (9 - 8 - 2)^2 + (18 - 18 - 2)^2 = (1)^2 + (0)^2 + (-1)^2 + (-2)^2.
  3. =1+0+1+4=6= 1 + 0 + 1 + 4 = 6. The sum squared error is 6.
xy2x + 2y − (2x + 2)square
15411
26600
4910−11
91820−24
xy24681048121620(1, 5)(2, 6)(4, 9)(9, 18)y = 2x + 2xy2x+2devsq15411266004910−1191820−24SSE = 1 + 0 + 1 + 4 = 6red segments are the deviations
Figure 11. The deviations of four data points from the line y = 2x + 2

7.3Comparing lines of fit

The SSE turns "how well does this line follow the data?" into a number. For the same data, a line with a smaller SSE lies closer to the points.

Example 23Which line fits better?

For the same data find the SSE of the lines y=2x+3y = 2x + 3, y=2x+2y = 2x + 2 and y=2x+1.5y = 2x + 1.5, and say which fits best.

Solution
  1. y=2x+3y = 2x + 3: deviations 5−5,6−7,9−11,18−21=0,−1,−2,−35 - 5, 6 - 7, 9 - 11, 18 - 21 = 0, -1, -2, -3; squares 0+1+4+90 + 1 + 4 + 9; SSE = 14.
  2. y=2x+2y = 2x + 2: deviations 1,0,−1,−21, 0, -1, -2; SSE = 6.
  3. y=2x+1.5y = 2x + 1.5: deviations 1.5,0.5,−0.5,−1.51.5, 0.5, -0.5, -1.5; squares 2.25+0.25+0.25+2.252.25 + 0.25 + 0.25 + 2.25; SSE = 5.
  4. The line y=2x+1.5y = 2x + 1.5 has the smallest SSE, so of the three it follows the data best.
xy2468104812162024y = 2x + 3SSE = 14y = 2x + 2SSE = 6y = 2x + 1.5SSE = 5The smallest SSE fits best
Figure 12. Three candidate lines for the same data, compared by SSE
Beyond the source. The source defines the SSE and computes it for a given line. How to find the line with the smallest SSE, the least-squares line, is added in 7.4 below as an extra.

7.4The least-squares line: the best line of fit

The SSE tells you how good a given line is. The least-squares line is the line y=mx+cy = mx + c whose SSE is the smallest possible. This is the line a computer would fit to the data, so it is worth knowing how it is found.

A. The formulas

For nn data points (xi,yi)(x_i, y_i), write xˉ=1n∑xi\bar x = \tfrac1n\sum x_i and yˉ=1n∑yi\bar y = \tfrac1n\sum y_i. Then

m=n∑xiyi−(∑xi)(∑yi)n∑xi2−(∑xi)2,c=yˉ−mxˉm = \frac{n\sum x_iy_i - \left(\sum x_i\right)\left(\sum y_i\right)}{n\sum x_i^2 - \left(\sum x_i\right)^2}, \qquad c = \bar y - m\bar x

(The slope can also be written m=∑(xi−xˉ)(yi−yˉ)∑(xi−xˉ)2m = \dfrac{\sum (x_i - \bar x)(y_i - \bar y)}{\sum (x_i - \bar x)^2}.) These come from asking that the SSE, a quadratic in mm and cc, stops decreasing in both directions. That gives two equations, the normal equations:

∑yi=m∑xi+nc,∑xiyi=m∑xi2+c∑xi\sum y_i = m\sum x_i + nc, \qquad \sum x_iy_i = m\sum x_i^2 + c\sum x_i

B. Worked example

Data (1,2),(2,3),(3,5)(1, 2), (2, 3), (3, 5). Here n=3n = 3, ∑x=6\sum x = 6, ∑y=10\sum y = 10, ∑xy=2+6+15=23\sum xy = 2 + 6 + 15 = 23, ∑x2=1+4+9=14\sum x^2 = 1 + 4 + 9 = 14.

  • m=3⋅23−6⋅103⋅14−36=96=32m = \dfrac{3 \cdot 23 - 6 \cdot 10}{3 \cdot 14 - 36} = \dfrac{9}{6} = \dfrac32.
  • xˉ=2\bar x = 2, yˉ=103\bar y = \tfrac{10}{3}, so c=103−32⋅2=13c = \dfrac{10}{3} - \dfrac32 \cdot 2 = \dfrac13. The line is y=1.5x+13y = 1.5x + \tfrac13.
  • Predictions: 116,103,296\tfrac{11}{6}, \tfrac{10}{3}, \tfrac{29}{6}; residuals (actual −- predicted): 16,−13,16\tfrac16, -\tfrac13, \tfrac16. SSE =136+19+136=16= \tfrac1{36} + \tfrac19 + \tfrac1{36} = \tfrac16.
  • Compare y=x+1y = x + 1 (the simple line from the first practice question): SSE =1= 1. The least-squares value 16\tfrac16 is smaller, as it must be.

C. Facts to remember

  • The least-squares line always passes through (xˉ,yˉ)(\bar x, \bar y) (that is what c=yˉ−mxˉc = \bar y - m\bar x says).
  • Its residuals add up to zero: ∑(yi−mxi−c)=∑yi−m∑xi−nc=0\sum (y_i - mx_i - c) = \sum y_i - m\sum x_i - nc = 0 by the first normal equation. (For other lines the sum need not be 0, and this is why the SSE squares the deviations.)
  • No other line has a smaller SSE. The SSE is 00 only if all points lie exactly on one line (for example (0,1),(1,3),(2,5)(0, 1), (1, 3), (2, 5) gives y=2x+1y = 2x + 1 with SSE 00).
  • Mean squared error MSE=SSEn\text{MSE} = \dfrac{\text{SSE}}{n}, and the root mean squared error is MSE\sqrt{\text{MSE}}. Dividing by nn makes errors comparable across data sets of different sizes. The line minimising SSE also minimises MSE.
  • The formula needs n∑x2−(∑x)2≠0n\sum x^2 - (\sum x)^2 \neq 0: that fails only when all xix_i are equal (a vertical line of points), where there is no sensible slope.

7.5Exam tips and common mistakes

Exam tips
  • Make a table: x, y, prediction, deviation, square. Add the last column.
  • Compare lines only on the same data; a smaller SSE then means a closer fit.
Common mistakes
  • Adding the plain deviations (they cancel).
  • Computing mxi+c−yim x_i + c - y_i for some points and yi−mxi−cy_i - m x_i - c for others. Squaring hides the sign, but be consistent.
  • Skipping a data point in the sum.

Practice questions (graded-assignment style)

Q1SSE of a line

Numerical Answer Type (NAT).

For the data (1,2),(2,3),(3,5)(1, 2), (2, 3), (3, 5) and the line y=x+1y = x + 1, find the SSE.

Solution
Idea

Deviation = actual − predicted, then square.

  • Predictions: 2,3,42, 3, 4. Deviations: 0,0,10, 0, 1.
  • SSE =0+0+1=1= 0 + 0 + 1 = 1.
  • Answer: 1
Q2Deviations that cancel

Numerical Answer Type (NAT).

For the data (1,3),(2,3),(3,7)(1, 3), (2, 3), (3, 7) and the line y=2xy = 2x, find the SSE.

Solution
Idea

Squares do not cancel.

  • Predictions: 2,4,62, 4, 6. Deviations: 1,−1,11, -1, 1.
  • SSE =1+1+1=3= 1 + 1 + 1 = 3. (The plain deviations add to 1, which hides the misses.)
  • Answer: 3
Q3Which fits best?

Multiple Choice Question (MCQ): choose the one correct option.

For the data (0,1),(1,3),(2,5)(0, 1), (1, 3), (2, 5), which line has the smallest SSE?

1
A: y=2x+1y = 2x + 1
2
B: y=2xy = 2x
3
C: y=x+1y = x + 1
4
All are equal
Solution
Idea

Compute the SSE of each line.

  • A: predictions 1,3,51, 3, 5, deviations 0,0,00, 0, 0, SSE =0= 0.
  • B: predictions 0,2,40, 2, 4, deviations 1,1,11, 1, 1, SSE =3= 3.
  • C: predictions 1,2,31, 2, 3, deviations 0,1,20, 1, 2, SSE =5= 5.
  • Line A passes through every point, so its SSE is 0.
  • Answer: option 1.
Q4SSE facts

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements about the SSE.

1
The SSE is never negative.
2
Squaring stops positive and negative deviations from cancelling.
3
For the same data, a smaller SSE means a closer fit.
4
An SSE of 0 means the line passes through no data point.
Solution
Idea

Think about what a sum of squares can and cannot be.

  • Options 1, 2 and 3 are true.
  • Option 4 is false: an SSE of 0 means every deviation is 0, so the line passes through every data point.
  • Answer: options 1, 2 and 3.
L1The slope of the least-squares line

Numerical Answer Type (NAT).

Find the slope of the least-squares line for the data (1,2),(2,3),(3,5)(1, 2), (2, 3), (3, 5).

Solution
Idea

Use m=n∑xy−∑x∑yn∑x2−(∑x)2m = \dfrac{n\sum xy - \sum x\sum y}{n\sum x^2 - (\sum x)^2}.

  • n=3n = 3, ∑x=6\sum x = 6, ∑y=10\sum y = 10, ∑xy=23\sum xy = 23, ∑x2=14\sum x^2 = 14.
  • m=69−6042−36=96=1.5m = \dfrac{69 - 60}{42 - 36} = \dfrac96 = 1.5.
  • Cross-check with deviations from the means: xˉ=2\bar x = 2, yˉ=103\bar y = \tfrac{10}{3}; ∑(x−xˉ)(y−yˉ)=(−1)(−43)+0+(1)(53)=3\sum (x - \bar x)(y - \bar y) = (-1)(-\tfrac43) + 0 + (1)(\tfrac53) = 3 and ∑(x−xˉ)2=2\sum (x - \bar x)^2 = 2, giving 32\tfrac32 ✓.
  • Answer: 1.5
L2The minimum SSE

Numerical Answer Type (NAT).

For the data (1,2),(2,3),(3,5)(1, 2), (2, 3), (3, 5), what is the SSE of the least-squares line? (Give a decimal rounded to 3 places.)

Solution
Idea

Get mm and cc, then compute the SSE as usual.

  • m=1.5m = 1.5 (L1) and c=yˉ−mxˉ=103−3=13c = \bar y - m\bar x = \tfrac{10}{3} - 3 = \tfrac13.
  • Residuals: 2−116=162 - \tfrac{11}{6} = \tfrac16, 3−103=−133 - \tfrac{10}{3} = -\tfrac13, 5−296=165 - \tfrac{29}{6} = \tfrac16. Squares: 136+436+136=636=16\tfrac1{36} + \tfrac4{36} + \tfrac1{36} = \tfrac6{36} = \tfrac16.
  • Answer: 0.167
L3Properties of the least-squares line

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements about the least-squares line y=mx+cy = mx + c for a data set.

1
It passes through the point (xˉ,yˉ)(\bar x, \bar y).
2
The residuals yi−mxi−cy_i - mx_i - c add up to 00.
3
Its SSE is always 00.
4
No other line has a smaller SSE on the same data.
5
MSE=n×SSE\text{MSE} = n \times \text{SSE}.
Solution
Idea

Use c=yˉ−mxˉc = \bar y - m\bar x and the normal equations.

  • 1 ✓ mxˉ+c=yˉm\bar x + c = \bar y.
  • 2 ✓ ∑(yi−mxi−c)=nyˉ−mnxˉ−nc=n(yˉ−mxˉ−c)=0\sum (y_i - mx_i - c) = n\bar y - mn\bar x - nc = n(\bar y - m\bar x - c) = 0.
  • 3 ✗ The SSE is 00 only when the points are exactly collinear (the example (1,2),(2,3),(3,5)(1,2),(2,3),(3,5) has SSE 16\tfrac16).
  • 4 ✓ That is what "least squares" means.
  • 5 ✗ MSE=SSE/n\text{MSE} = \text{SSE}/n.
  • Answer: options 1, 2 and 4.
L4The intercept from the sums

Numerical Answer Type (NAT).

For the data (1,5),(2,6),(4,9),(9,18)(1, 5), (2, 6), (4, 9), (9, 18) the sums are ∑x=16\sum x = 16, ∑y=38\sum y = 38, ∑xy=215\sum xy = 215, ∑x2=102\sum x^2 = 102. Find the intercept cc of the least-squares line, rounded to 2 decimals.

Solution
Idea

Find mm first, then c=yˉ−mxˉc = \bar y - m\bar x.

  • m=4⋅215−16⋅384⋅102−162=860−608408−256=252152=6338≈1.658m = \dfrac{4 \cdot 215 - 16 \cdot 38}{4 \cdot 102 - 16^2} = \dfrac{860 - 608}{408 - 256} = \dfrac{252}{152} = \dfrac{63}{38} \approx 1.658.
  • xˉ=4\bar x = 4, yˉ=9.5\bar y = 9.5, so c=9.5−6338⋅4=361−25238=10938≈2.87c = 9.5 - \tfrac{63}{38}\cdot 4 = \tfrac{361 - 252}{38} = \tfrac{109}{38} \approx 2.87.
  • Check with the first normal equation: 38=16m+4c=16⋅6338+4⋅10938=1008+43638=144438=3838 = 16m + 4c = 16 \cdot \tfrac{63}{38} + 4 \cdot \tfrac{109}{38} = \tfrac{1008 + 436}{38} = \tfrac{1444}{38} = 38 ✓.
  • The SSE of this line is 2138≈0.55\tfrac{21}{38} \approx 0.55, smaller than the 55 of the best of the three lines tried in Example 23.
  • Answer: 2.87
L5Mean squared error

Numerical Answer Type (NAT).

For the data (1,5),(2,6),(4,9),(9,18)(1, 5), (2, 6), (4, 9), (9, 18) and the line y=2x+2y = 2x + 2, find the mean squared error.

Solution
Idea

MSE = SSE divided by the number of points.

  • From Example 22, SSE=6\text{SSE} = 6, and there are n=4n = 4 points.
  • MSE=6/4=1.5\text{MSE} = 6 / 4 = 1.5.
  • Answer: 1.5
Revision overview
Line of fity = mx + c
Predicted value m xᵢ + c
Actual value yᵢ
Deviationyᵢ − m xᵢ − c
Can be positive or negative
Square itSo none cancel
Plain sum −2, SSE 6
Straight-line fitWeek 2 · Section 2.10
SSEΣ (yᵢ − m xᵢ − c)²
Sum over all n points
Example: 1 + 0 + 1 + 4 = 6
UseSmaller SSE: closer fit
Compare lines on the same data
Exampley = 2x + 3: 14
y = 2x + 2: 6
y = 2x + 1.5: 5
Revision: measuring how well a line fits data
Next · All sectionsWeek 2 Summary Sheet
08
All sections

Week 2 Summary Sheet

One page to revise all of Week 2: points in the plane, lines and their slopes, the forms of a line, distances and angles, and the line of fit.

The big picture

Topic 1 · Coordinates and distance
  • Four quadrants by the signs of (x,y)(x, y).
  • d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}.
Topic 2 · Section formula and area
  • Divide a segment in m:nm : n; midpoint at 1:11 : 1.
  • Triangle area; zero area means collinear.
Topic 3 · Slope
  • m=Δy/Δx=tan⁡θm = \Delta y / \Delta x = \tan\theta.
  • Parallel: m1=m2m_1 = m_2. Perpendicular: m1m2=−1m_1 m_2 = -1.
Topic 4 · Equations of a line
  • Slope-intercept, point-slope, two-point, intercept and general forms: all the same line.
Topic 5 · Angle between lines
  • tan⁡θ=m2−m11+m2m1\tan\theta = \dfrac{m_2 - m_1}{1 + m_2 m_1}.
  • If the denominator is 0 the lines are perpendicular.
Topics 6 and 7 · Distances and SSE
  • Point-to-line and parallel-line distances from ax+by+c=0ax + by + c = 0.
  • SSE measures how well a line of fit follows the data.

Formulas to remember

TopicFormula
Distance between two points(x2−x1)2+(y2−y1)2\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}
Internal section m:nm : n(mx2+nx1m+n,my2+ny1m+n)\left(\dfrac{mx_2 + nx_1}{m + n}, \dfrac{my_2 + ny_1}{m + n}\right)
External section m:nm : n(mx2−nx1m−n,my2−ny1m−n)\left(\dfrac{mx_2 - nx_1}{m - n}, \dfrac{my_2 - ny_1}{m - n}\right)
Midpoint(x1+x22,y1+y22)\left(\dfrac{x_1 + x_2}{2}, \dfrac{y_1 + y_2}{2}\right)
Area of a triangle12∣x1(y2−y3)+x2(y3−y1)+x3(y1−y2)∣\tfrac{1}{2}\left|x_1(y_2 - y_3) + x_2(y_3 - y_1) + x_3(y_1 - y_2)\right|
Slopem=y2−y1x2−x1=tan⁡θm = \dfrac{y_2 - y_1}{x_2 - x_1} = \tan\theta
Parallel / perpendicular (slopes)m1=m2m_1 = m_2 and m1m2=−1m_1 m_2 = -1
Angle between linestan⁡θ=m2−m11+m2m1\tan\theta = \dfrac{m_2 - m_1}{1 + m_2 m_1}, tan⁡φ=m1−m21+m1m2\tan\varphi = \dfrac{m_1 - m_2}{1 + m_1 m_2}
Parallel / perpendicular (general form)a1b2=a2b1a_1 b_2 = a_2 b_1 and a1a2=−b1b2a_1 a_2 = -b_1 b_2
Point to lined=∣ax1+by1+c∣a2+b2d = \dfrac{|a x_1 + b y_1 + c|}{\sqrt{a^2 + b^2}}
Between parallel linesD=∣c1−c2∣a2+b2D = \dfrac{|c_1 - c_2|}{\sqrt{a^2 + b^2}}
Sum squared errorSSE=∑(yi−mxi−c)2\text{SSE} = \sum (y_i - m x_i - c)^2

Forms of the equation of a line

FormRepresentationUse when you know
Generalax+by+c=0ax + by + c = 0a standard shape for any line
Slope-point(y−y0)=m(x−x0)(y - y_0) = m(x - x_0)slope and one point
Slope-intercept (y)y=mx+cy = mx + cslope and y-intercept
Slope-intercept (x)y=m(x−d)y = m(x - d)slope and x-intercept
Interceptxa+yb=1\dfrac{x}{a} + \dfrac{y}{b} = 1both intercepts
Two-point(y−y1)=y2−y1x2−x1(x−x1)(y - y_1) = \dfrac{y_2 - y_1}{x_2 - x_1}(x - x_1)two points on the line

Which tool when?

QuestionTool
How far apart are two points?distance formula
A point dividing a segment in m:nm : nsection formula, internal or external
Are three points on one line?triangle area is zero
How steep is a line?m=Δy/Δx=tan⁡θm = \Delta y / \Delta x = \tan\theta
Parallel or perpendicular?m1=m2m_1 = m_2 or m1m2=−1m_1 m_2 = -1
Write the line from given factspick the form (point-slope, two-point, intercept, ...)
Angle between two linestan⁡θ=m2−m11+m2m1\tan\theta = \dfrac{m_2 - m_1}{1 + m_2 m_1}
Distance from a point or between parallels∣ax1+by1+c∣a2+b2\dfrac{|a x_1 + b y_1 + c|}{\sqrt{a^2 + b^2}}, ∣c1−c2∣a2+b2\dfrac{|c_1 - c_2|}{\sqrt{a^2 + b^2}}
How well does a line fit data?SSE=∑(yi−mxi−c)2\text{SSE} = \sum (y_i - m x_i - c)^2

Common mistakes

Mixing up the order in the slope
  • y2−y1x2−x1\dfrac{y_2 - y_1}{x_2 - x_1} needs the same point first in the numerator and the denominator.
Losing the second answer
  • (4−y)2=9(4 - y)^2 = 9 gives 4−y=±34 - y = \pm 3, so two values of yy.
Forgetting the modulus
  • The area and distance formulas use the modulus so the result is never negative.
Vertical lines with slope rules
  • A vertical line has no slope. The parallel and perpendicular slope rules are for non-vertical lines.
Different a and b for parallel distance
  • Make the two equations share the same aa and bb before using ∣c1−c2∣|c_1 - c_2|.
Skipping the square in SSE
  • Plain deviations cancel. Square each one, then add.
Back to top