## Lines - The Devil Is in the Details

Maple 14

Points and lines, and the relationships between them, are essential ingredients of so many problems in, for example, calculus. In particular, obtaining the equation of the perpendicular bisector of a line segment, dropping a perpendicular from a point to a given line, and calculating the distance from a point to a line are three tasks treated in elementary analytic geometry that recur in the applications. Let's explore the tools that Maple has for implementing these basic calculations.

 Given a line segment determined by two points in the plane, obtain the equation of the perpendicular bisector of the line segment.

Table 1 illustrates how to find the equation of the perpendicular bisector of the segment determined by the points  and . The approach incorporates the direct mathematical steps of finding the midpoint and slope of the line segment, and constructing the equation of the perpendicular bisector via the point-slope form of the line.

 • Obtain the midpoint of the segment.

=

 • Obtain the slope of the segment.

=

 • Use the point-slope form of the line with slope taken as the negative reciprocal of the slope of the segment, and the point as the midpoint of the segment.

Table 1   Top-level calculation of the equation of the perpendicular bisector of a line segment

Table 2 implements the calculation with tools from the Student Precalculus package.

Tools_Load Package: Student Precalculus

Loading Student:-Precalculus

 • Enter the first point. Context Menu: Assign Name

 • Enter the second point. Context Menu: Assign Name

 • Obtain the equation of the perpendicular bisector with the Line command. Note the use of the Slope and Midpoint commands.

Table 2   Perpendicular bisector via the Slope, Midpoint, and Line commands of Student Precalculus

Table 3 shows how to obtain the equation of the perpendicular bisector with the tools of the geometry package. There is a bit of overhead in this package, but the commands available are robust and powerful. If the names of the variables associated with the horizontal and vertical axes are not explicitly declared, then a pop-up will request this information when the Equation command is used to extract the equation of the perpendicular bisector.

 • Install the geometry package.

 • Declare to the package the names associated with the horizontal and vertical axes.

 • Define the two points as objects in the package.

 • Construct the line  as the perpendicular bisector of the segment connecting points  and .

 • Extract the equation of the perpendicular bisector.
 • Context Menu: Solve_Isolate Expression for_

Table 3   Use of the geometry package to obtain the perpendicular bisector of a line segment

It is unfortunate that the data structures for points and lines at top level and in the Precalculus package are not compatible with those in the geometry package. Essentially, that means calculations within the geometry package are isolated from many of the top-level functionalities of Maple, and vice versa. The devil is always in the details.

 Given a line in the plane, and a point not on the line, obtain the equation of the line that passes through the given point and is perpendicular to the given line.

Table 4 illustrates how to use top-level functionality for dropping a perpendicular from the point  to the line .

 • Enter the equation of the given line. Press the Enter key.
 • Context Menu: Solve_Isolate Expression for_

 (1)

 • Using the point-slope form of the line, write the equation of the line through the given point and having as its slope, the negative reciprocal of the slope of the given line.

 (2)
 • Using equation labels, form a sequence of the given line and its perpendicular. Press the Enter key.
 • Context Menu: Plots_Plot Builder Set the ranges   Options: Color given line black; perpendicular, red                Constrained Scaling                Add title

A more satisfying figure can be drawn if first, the intersection of the given line and its perpendicular is calculated.

 • Using equation labels, form a sequence of the equations of the given line and its perpendicular. Press the Enter key.
 • Context Menu: Solve_Solve
 • Using the evaluation template from the Expression palette, convert the solution to a list that represents a point at top-level in Maple. Press the Enter key.

 (3)

 (4)

Tools_Load Package: Plots

Loading plots

 • Create separate plots of the given point and the point of intersection of the given line and its perpendicular.
 • Create a plot of the line segment connecting these two points.
 • Create a plot of the given line.
 • Merge all three graphs into Figure 2.

Table 4   Using top-level functionalities to drop a perpendicular from a point to a line

Figure 2 could also be created interactively using the Plot Builder accessed from the Context Menu, but this would entail dragging and dropping components onto the final graph. It's more difficult to describe these operations than it is to execute them, so we have opted for the command-based construction of the figure.

Table 5 shows how the calculations in Table 4 could be implemented using tools from the Student Precalculus package. It is not necessary to re-install this package if this has once been done in the session, but for the sake of completeness, this step is repeated.

Tools_Load Package: Student Precalculus

Loading Student:-Precalculus

 • Control-drag (copy/paste or type) the equation of the given line.
 • Context Menu: Solve_Isolate Expression for_

 • Supply to the Line command the negative reciprocal of the slope of the given line, and the point from which the perpendicular is to be dropped.

Table 5   Using the Student Precalculus package to drop a perpendicular from a point to a line

Table 6 shows how the calculations in Table 4 could be implemented in the geometry package. It is not necessary to re-install this package or to again declare the variables associated with the horizontal and vertical axes if this has once been done in the session, but for the sake of completeness, these steps are repeated.

 • Install the geometry package.
 • Declare the names of the variables associated with the horizontal and vertical axes.

 • Define the given point and line as objects in the geometry package.

 • Define the perpendicular through the given point and obtain its equation.
 • Context Menu: Solve_Isolate Expression for_  (This rewrite of the equation is simply to facilitate comparison with the result in Table 4.)

 • Obtain the coordinates of the point of intersection of the given line and the perpendicular. (This is to facilitate drawing a figure comparable to Figure 2.)

Define the line segment connecting the given point and the point of intersection of the given line and its perpendicular.

 • Use the draw command in the geometry package to draw the package objects, namely, the given line, the line segment , and the points  and .

Table 6   Using the geometry package to drop a perpendicular from a point to a line

Although the paradigm for naming in the geometry package is not the norm for Maple, the package provides many useful commands for working in analytic (coordinate) geometry. In particular, the draw command is useful because it will draw the package objects, objects which the ordinary plotting commands in Maple are not designed to graph. Note also how the coordinates of a point of intersection of two lines is returned as a list, unlike the return of the top-level solve command.  It is these small details that determines how easy a calculation will be to implement is a particular piece of software.

 Calculate the distance from a point to a line.

Although the distance from the point  to the line  is given by the formula

let's calculate the distance of the point  from the line  from first principles. Hence, we need to drop a perpendicular from  to the line, obtain the coordinates of the point of intersection of the given line with this perpendicular, and compute the distance from these two points.

From Table 4, the point of intersection of the perpendicular from  to the given line is . Hence, the distance  is given by

=

As a check, the distance formula also gives

=

The Distance command in the Precalculus package gives

=

and (using Table 6) the distance command in the geometry package gives

=

which, of course, simplifies to .

Download Blog_10.mw

﻿