104Mathematics · Coordinate geometry

Line Through Two Points: Equation, Slope, Intercepts, Length, Midpoint

fx-50FH II · COMP · 130 bytes

Enter the four coordinates of two distinct points. The program shows nine values in a fixed order: P, Q, R of the line Px+Qy=R, the slope, the x- and y-intercepts, the length AB and the two midpoint coordinates.

  • 130 bytes
  • COMP mode
01

Worked examples

Example 1

The straight line AB passes through A(1,2) and B(5,4). Which of the following is the point where AB meets the x-axis?

  1. A.(−1.5, 0)
  2. B.(−3, 0)
  3. C.(3, 0)
  4. D.(6, 0)
Answer
B. (−3, 0)
Standard solution (without a calculator)
  1. Slope and equation: m=(4−2)/(5−1)=1/2. Through A(1,2): y−2=(x−1)/2, so y=x/2+3/2, that is −2x+4y=6.
  2. x-intercept: put y=0: −2x=6, so x=−3 and the line meets the x-axis at (−3,0). The answer is B.
  3. y-intercept: put x=0: 4y=6, so y=3/2 and the y-intercept is (0,3/2).
  4. Length and midpoint: AB=√((5−1)²+(4−2)²)=√20=2√5≈4.472135955, and the midpoint is ((1+5)/2,(2+4)/2)=(3,3).
Do it on the calculator

Example 2

The straight line AB passes through A(2,1) and B(2,7).

  1. (a)Write down the equation of AB and describe its slope.
  2. (b)Find the x-intercept and the y-intercept of AB, if they exist.
  3. (c)Find the length of AB and the coordinates of its midpoint.
Answer
(a) x=2; the slope is undefined. (b) x-intercept (2,0); no y-intercept. (c) AB=6; midpoint (2,4).
Standard solution (without a calculator)
  1. Recognise a vertical line: both points have x-coordinate 2, so AB is x=2. The change in x is 0, so the slope is undefined; do not divide by 0.
  2. Intercepts: AB meets the x-axis y=0 at (2,0). The line x=2 is parallel to the y-axis x=0, so there is no y-intercept.
  3. Length and midpoint: AB=√((2−2)²+(7−1)²)=6 and the midpoint is (2,4).
  4. Program check: P=−6, Q=0, R=−12 give −6x=−12, equivalent to x=2. Screens 4 and 6 show the marker 1E+99 for the undefined slope and the missing y-intercept.
Do it on the calculator

Example 3

A straight horizontal footpath on a coordinate plan has end points A(−4,3) and B(6,3).

  1. (a)Find the equation and the slope of the line containing the footpath, and its intercepts with the axes.
  2. (b)Find the length and the midpoint of the footpath.
Answer
(a) y=3; slope 0; no x-intercept; y-intercept (0,3). (b) Length 10; midpoint (1,3).
Standard solution (without a calculator)
  1. Equation and slope: both points have y-coordinate 3, so the line is horizontal: y=3. The slope is (3−3)/(6−(−4))=0. The program's P=0, Q=10, R=30 give 10y=30.
  2. Intercepts: y is always 3, so the line never meets the x-axis y=0; screen 5 shows 1E+99. It meets the y-axis x=0 at (0,3), so screen 6 is 3.
  3. Length and midpoint: AB=√((6−(−4))²+(3−3)²)=10, and the midpoint is ((−4+6)/2,(3+3)/2)=(1,3).
Do it on the calculator
02

When to use it

Use this program when a line is determined by two numerical points A(x₁,y₁) and B(x₂,y₂). In one run it gives the equation Px+Qy=R, the slope, both axis intercepts, the length AB and the midpoint, including vertical and horizontal lines. There is no mode question.

Enter the two points

  • At A?, B?, C?, D? enter x₁, y₁, x₂, y₂ in that order, pressing EXE after each. Use (−) for a negative coordinate.
  • Enter all four coordinates for every run, including zeros. A blank EXE keeps an old value, and the program overwrites A and B with the midpoint, so a retained value may be wrong.

Read the nine screens

  • Screens 1–3 are P, Q, R; read them together as Px+Qy=R. The three coefficients may share a common factor, so divide by it if the question wants the simplest form.
  • Screens 4–6 are the slope m, the x-intercept k and the y-intercept t. The x-intercept is the point (k,0) and the y-intercept is (0,t).
  • 1E+99 is a marker, never a real value: as a slope it means the line is vertical; as an intercept it means there is no intercept or the line is that whole axis. Decide which from the question.
  • Screens 7–9 are the length AB and the midpoint's x- and y-coordinates. Press EXE after each paused screen; after the ninth, press AC to leave.

Suitable questions

  • Original HKDSE compulsory mathematics coordinate-geometry practice on the line through two points: its equation, slope, intercepts, the length and midpoint of a segment, and recognising vertical and horizontal lines. Program 045 gives only the coefficients of ax+by+c=0; this program gives all nine values in one run. It does not give a written proof or exact surds.

Before using the program

  • Create and run the program in COMP with Norm 1, reserving 130 bytes in an empty slot; P1–P4 share 680 bytes. The angle setting does not affect this program; the illustrated runs use Deg.
  • The two points must be different. If they coincide there is no unique line, and the program stops with Math ERROR before showing any result.
  • 1E+99 replaces a division by zero; it is not 10⁹⁹. A slope of 1E+99 means a vertical line. An intercept of 1E+99 means the line is parallel to that axis or is the axis itself.
  • The length and other values are decimal approximations; keep exact forms such as √20=2√5 in a written answer. Very large or very small coordinates, or two points extremely close together, can lose accuracy.
  • A, B, C, D, X, Y and M are overwritten; Ans also changes. No memory needs clearing first. The program works with numerical coordinates only, not symbolic parameters.

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.

Checking access…

Sign in to unlock the full programme

Checking access…

The programme code and appendix unlock together.