Exploring Analyic Geometry with Mathematica® |
|||||
| Home | Contents | Commands | Packages | Explorations | Reference |
| Tour | Lines | Circles | Conics | Analysis | Tangents |
Lines and Line Segments
General Equation
Parallel and Perpendicular Lines
Angle between Lines
Two-Point Form
Point-Slope Form
Slope-Intercept Form
Intercept Form
Normal Form
Intersection Point of Two Lines
Point Projected Onto a Line
Line Perpendicular to Line Segment
Angle Bisector Lines
Concurrent Lines
Pencils of Lines
Parametric Equations
Explorations
The curve with the simplest equation is a straight line. There are many forms the equation can exhibit, depending on how we wish to construct the line. This chapter develops in detail the analytic geometry of a line and its close relation, the line segment.
Initialize
To initialize Descarta2D, select the input cell bracket and press SHIFT-Enter.
This initialization assumes that the Descarta2D software has been copied into one of the standard directories for AddOns which are on the Mathematica search path, $Path.
<<Descarta2D`
General Equation [Top]
Every linear equation in two unknowns can be written in the form
Ax+By+C=0.
The graph of such a linear equation is a straight line. In Descarta2D the line Ax+By+C=0 is represented as Line2D[A,B,C]. Points (x,y) whose coordinates satisfy the equation Ax+By+C=0 are said to be on the line.
A line segment is the set of points on a line between two points on the line,
and
. In Descarta2D a line segment is represented as Segment2D[coords,coords] where the coords are lists of the (x,y) coordinates of the start and end points of the line segment.
Example: Plot the lines 2x-3y+1=0 and x+2y+2=0. Plot the line segment between the points (-1,2) and (3,-1).
Solution: The Descarta2D function Sketch2D[objList] plots a sketch of the objects in the object list.
Sketch2D[{Line2D[2,-3,1], Line2D[1,2,2],
Segment2D[{-1,2},{3,-1}]}]
■
Example: Determine which of the points (-1,1),
, (3,1) and
are on the line 2x-3y+1=0.
Solution: The Descarta2D function IsOn2D[point,line] returns True if the point is on the line.
l1=Line2D[2,-3,1];
{IsOn2D[p1=Point2D[{-1,1}],l1],
IsOn2D[p2=Point2D[{2,5/3}],l1],
IsOn2D[p3=Point2D[{3,1}],l1],
IsOn2D[p4=Point2D[{-3,-5/3}],l1]}
{Sketch2D[{l1,p1,p3}],Sketch2D[{l1,p2,p4}]}
■
Inclination and Slope
The angle, θ, measured counter-clockwise from the +x-axis to a line, is called the inclination of the line. The tangent of this angle, tanθ, (generally designated by the letter m) is called the slope of the line. It is evident from Figure [lns:fig4] that the slope of line
is given by
The formula is independent of the position and order of the two points involved.
Inclination and slope of a line.
Let L≡Ax+By+C=0 be the general equation of a line. It is clear that the points (-C/A,0) and (0,-C/B) are on the line since they satisfy the equation of the line. Therefore, the slope of L is given by
and the angle of inclination,
.
The slope of the line containing a line segment from point
to point
can be determined directly from the formula given for lines as
Example: Find the angle of inclination (in degrees) and the slope of the line x-y+4=0. Find the slope of the line segment between the points (-2,1) and (3,2).
Solution: The Descarta2D function Angle2D[line] returns the inclination of a line (in radians); the function Slope2D[line] returns the slope of a line. The function Slope2D[lnseg] returns the slope of the line containing the line segment.
l1=Line2D[1,-1,4];
{Angle2D[l1]/Degree //N, Slope2D[l1],
Slope2D[Segment2D[{1,-2},{3,2}]]}
■
Mathematica Hint: The Mathematica symbol Degree equals the constant π/180. In the previous example dividing by Degree converts the angle from radians to degrees. The Mathematica function N[expr] produces a numerical approximation of an expression. The syntax expr //N is equivalent to N[expr].
Parallel and Perpendicular Lines [Top]
If two lines have the same slope they are called parallel lines. If two lines share all their points they are said to be coincident; coincident lines are also considered to be parallel. Two lines are perpendicular if the angle between them is a right angle. Let
and
be the slopes of two perpendicular lines. Since
![]()
=
![]()
![]()
=
![]()
![]()
=
![]()
.
=
![]()
.
=
![]()
Therefore, the slopes of two perpendicular lines are negative reciprocals of each other related by the equation,
. Descarta2D provides functions for querying whether pairs of lines are parallel or perpendicular.
Example: Determine which of the following pairs of lines are parallel:
(a) 2x-3y+4=0 and -4x+6y-3=0,
(b) x+2y-3=0 and -2x+y-1=0, and
(c) 3x-4y+2=0 and 2x+4y-1=0.
Additionally, determine which pairs are perpendicular.
Solution: The function IsParallel2D[line,line] will return True if the two lines are parallel; otherwise, it returns False. IsPerpendicular2D[line,line] returns True if the two lines are perpendicular; otherwise, it returns False.
l1=Line2D[2,-3,4]; l2=Line2D[-4,6,-3];
l3=Line2D[1,2,-3]; l4=Line2D[-2,1,-1];
l5=Line2D[3,-4,2]; l6=Line2D[2,4,-1];
{{IsParallel2D[l1,l2],IsPerpendicular2D[l1,l2]},
{IsParallel2D[l3,l4],IsPerpendicular2D[l3,l4]},
{IsParallel2D[l5,l6],IsPerpendicular2D[l5,l6]}}
Therefore, the lines in pair (a) are parallel, the lines in pair (b) are perpendicular, and the lines in pair (c) are neither parallel or perpendicular.
{Sketch2D[{l1,l2}],Sketch2D[{l3,l4}],Sketch2D[{l5,l6}]}
■
Angle between Lines [Top]
The angle between two non-intersecting (parallel or coincident) lines is zero (radians or degrees). In the case of two intersecting lines,
and
, let
be the angle between the lines measured counter-clockwise from
to
. Since
, it follows that
which, in terms of slopes of the lines, yields
Example: Determine the angle (in radians) between the lines x+3y-4=0 and -2x+2y+1=0.
Solution: The Descarta2D function Angle2D[line,line] returns the angle between the two lines (measured in radians from the first line to the second line).
Angle2D[l1=Line2D[1,3,-4],l2=Line2D[-2,2,1]] //N
The result, 1.10715 radians, is approximately
.
Sketch2D[{l1,l2}]
Angle2D[l2,l1] //N
The angle between the lines taken in the opposite order is 2.0344 radians (approximately
) which is the supplement of the first angle (
).
■
Two-Point Form [Top]
Two-point form of a line.
A line is determined by two distinct points on it,
and
. Let P(x,y) be any other point on the line as illustrated in Figure [lns:fig8]. Then by similar triangles
which is called the two-point form of a line. The two-point form may also be written as
In general form the line is given by
In determinant form the equation is given by
Example: Determine the line through the points (-2,-1) and (3,2).
Solution: The Descarta2D function Line2D[point,point] constructs the line through the two points. Alternately, the function Line2D[lnseg] constructs a line defined by the start and end points of a line segment.
p1=Point2D[{-2,-1}];
p2=Point2D[{3,2}];
{l1=Line2D[p1,p2],l2=Line2D[Segment2D[p1,p2]]}
Sketch2D[{l1,p1,p2}]
The Descarta2D function Line2D[{
,
},{
,
}] is also provided to allow construction of a line by specifying two point coordinates.
Line2D[{-2,-1},{3,2}]
■
Collinear Points
In a previous chapter it was demonstrated that the three points
,
and
are collinear if their coordinates satisfy the determinant equation
This condition may be stated in a more intuitive form using the two-point form of a line. The line defined by
and
must be satisfied by
yielding the condition
which can be put into the more symmetrical form
Point-Slope Form [Top]
Since
, the two-point form of a line can be reduced to the point-slope form
as shown in Figure [lns:fig11]. In general form the equation of the line is
A vertical line cannot be represented in point-slope form. In determinant form the point-slope form is given by
Point-slope form of a line.
Example: Determine the line through the point (1,2) with a slope of 1/2.
Solution: The Descarta2D function Line2D[point,m] constructs a line through the point with a given slope, m.
l1=Line2D[p1=Point2D[{1,2}],1/2]
Sketch2D[{p1,l1}]
■
Line Through a Point Parallel to a Line
A line through a given point
parallel to a given line
would have a slope
, and using
yields
The equation can also be written
In determinant form the equation is
Line Through a Point Perpendicular to a Line
A line through a given point
perpendicular to a given line
would have a slope
, and using
yields
or, in a simpler form,
In determinant form the equation is
Example: Find the lines through the point (2,1) which are parallel and perpendicular to the line 3x-2y+1=0.
Solution: Line2D[point,line,Parallel2D] constructs a line through the point and parallel to the line and Line2D[point,line,Perpendicular2D] constructs a line through the point and perpendicular to the line.
p1=Point2D[{2,1}];
l1=Line2D[3,-2,1];
{l2=Line2D[p1,l1,Parallel2D],
l3=Line2D[p1,l1,Perpendicular2D]}
Sketch2D[{p1,l1,l2,l3}]
■
Descarta2D Hint: The function Line2D[point,line] returns the same results as Line2D[point,line,Perpendicular2D]; the keyword Perpendicular2D is optional and may be omitted.
Line2D[p1,l1]
Horizontal and Vertical Lines Through a Point
Given a point
, a horizontal line whose slope is 0 will have the equation
. In determinant form the equation is
Similarly, a vertical line (whose slope is infinite) has the equation
and its determinant equation is
Example: Find the horizontal and vertical lines through the point (3,2).
Solution: The function Line2D[point,0] constructs a horizontal line through the point. The function Line2D[point,Infinity] constructs a vertical line through the point.
p1=Point2D[{3,2}];
{l1=Line2D[p1,0],l2=Line2D[p1,Infinity]}
Sketch2D[{p1,l1,l2}]
■
Slope-Intercept Form [Top]
Specializing the point
in the point-slope form of a line to the y-intercept point (0,b) as shown in Figure [lns:fig15] gives the slope-intercept form of a line y=mx+b. In general form the equation of the line is mx-y+b=0. The slope-intercept form cannot be used to represent vertical lines. In determinant form the point-slope form is given by
Slope-intercept form of a line.
Example: Find the line with a y-intercept of 1 and a slope of 2.
Solution: The Descarta2D function Line2D[point,m] constructs a line through the point with the given slope.
l1=Line2D[p1=Point2D[{0,1}],2]
Sketch2D[{p1,l1},PlotRange->{{-3,3},{-3,3}}]
■
Descarta2D Hint: The Sketch2D command option
PlotRange->{{
,
},{
,
}}
used in the example above explicitly sets the minimum and maximum coordinate range along the x-axis and y-axis, overriding the default setting which is PlotRange->Automatic. The PlotRange option is useful for focusing on a specific portion of the plot.
Intercept Form [Top]
Intercept form of a line.
Specializing the two points in the two-point form to the intercepts (a,0) and (0,b) as shown in Figure [lns:fig17] gives (y-b)/x=-b/a, or, rearranging, the intercept form
In general form the equation of the line is bx+ay-ab=0; or, dividing Ax+By+C=0 by C (C≠0) gives
Thus, in the general equation, the intercepts are given by x=-C/A and y=-C/B. Notice that a line in intercept form cannot pass through the origin, nor can it be horizontal or vertical. In determinant form the intercept form is given by
Example: Find the line whose x-intercept is 2 and y-intercept is 1.
Solution: The function Line2D[point,point] constructs a line through the two points.
p1=Point2D[{2,0}];
p2=Point2D[{0,1}];
l12=Line2D[p1,p2]
Sketch2D[{p1,p2,l12}]
■
Normal Form [Top]
Consider a directed line segment OA of length ρ starting at the origin O and making an angle θ with the +x-axis as shown in Figure [lns:fig19]. The line L which is perpendicular to OA and passes through A is completely determined by the parameters ρ and θ. We wish to determine the general equation of the line L. The coordinates of A are (ρcosθ,ρsinθ) and the slope of L is -cotθ since L is perpendicular to OA which has slope tanθ. Hence, using the point-slope form we obtain, as the normal form of the equation of line L,
y-ρsinθ=-cotθ(x-ρcosθ)
which reduces to
xcosθ+ysinθ-ρ=0.
Normal form of a line.
This form of the equation of a straight line is called the normal form (sometimes the perpendicular form) because its coefficients involve the parameters ρ and θ associated with the normal or perpendicular segment OA to the line.
To determine the coefficients of the normal form from the general form
Ax+By+C=0,
we divide by
yielding
The sign of
is chosen to be opposite to that of C to make the constant term, ρ, positive. If C is zero, the line passes through the origin. The process of dividing a linear equation by
is called normalizing the line.
Example: Normalize the lines 3x-4y-5=0 and 2x+y-3=0.
Solution: The Descarta2D function Line2D[line] constructs a line with normalized coefficients.
{Line2D[Line2D[3,-4,-5]],Line2D[Line2D[2,1,-3]]}
■
Example: Find the line 4 units from the origin whose normal makes an angle of
with the positive x-axis.
Solution: We apply directly the normal form of a line to determine the coefficients of the line in general form.
Line2D[Cos[30 Degree],Sin[30 Degree],-4] //N
■
Mathematica Hint: The Mathematica symbol Degree is the constant π/180. Multiplying an angle in degrees by Degree (as illustrated in the previous example) converts the angle to radians; radians are the angular units required in all Descarta2D functions.
Point Offset a Distance Along a Line
Given a point
we wish to offset the point a distance d in the direction of a given line
. We note that the coefficients of the normalized form of
immediately give us the unit directions to offset
, so the desired coordinates of the offset point are
If the point
is on line
, then the offset point will also be on
; otherwise, the offset point will be on a line parallel to
. The distance d may be positive or negative allowing offsets in either direction parallel to the line.
Example: Offset the points (-1,1), (1,-1) and (0,0) a distance 2 in both directions along the line 3x-4y+1=0.
Solution: The Descarta2D function Point2D[point,line,d] offsets a point along a line a given distance, d. The distance may be positive or negative.
p1=Point2D[{-1,1}];
p2=Point2D[{1,-1}];
p3=Point2D[{0,0}];
l1=Line2D[3,-4,1];
pts={{Point2D[p1,l1,2],Point2D[p1,l1,-2]},
{Point2D[p2,l1,2],Point2D[p2,l1,-2]},
{Point2D[p3,l1,2],Point2D[p3,l1,-2]}}
Sketch2D[{p1,p2,p3,l1,pts}]
■
Line Offset a Distance from a Line
If a line
is parallel to a second line
, the two lines will be separated by a constant distance, d. The process of constructing a line such as
which is parallel to
at a given distance, d, is called offsetting the line. There are two lines offset a distance d from a line Ax+By+C=0. The general equations of these two lines are easily determined from the normal form as
Example: Find and plot the two lines offset a distance of two units from the line x-3y+1=0.
Solution: The Descarta2D function Line2D[line,d] constructs a line offset a given distance, d, from a line. The distance may be positive or negative yielding one of the two possible offset lines.
l1=Line2D[1,-3,1];
{l2=Line2D[l1,2],l3=Line2D[l1,-2]}
Sketch2D[{l1,l2,l3}]
■
Distance from a Point to a Line
The normal form of a line provides a convenient method for determining the distance from a point to a line. Consider a normalized line L≡px+qy-r=0, where
. A line M offset a distance d from L clearly has the equation M≡px+qy-r±d=0. Any point
on M satisfies the equation of M, therefore,
. Solving for d and squaring to remove the ambiguous sign yields
Thus, the distance d from a point
to a line Ax+By+C=0 in general form is
where the sign is selected to produce the positive result.
Example: Find the distance from the point (3,-2) to the line 3x-4y+2=0.
Solution: The Descarta2D function Distance2D[point,line] returns the distance from the point to the line.
Distance2D[Point2D[{3,-2}],Line2D[3,-4,2]]
■
Intersection Point of Two Lines [Top]
Two lines
and
may be parallel, coincident, or intersect in a single point. In the case they where intersect in a single point, the coordinates of the point may be determined by solving the system of equations
.
![]()
.
.
![]()
.
for the intersection point P(x,y). The resulting formula for the coordinates of point P is
In the case where the denominators are zero, the lines are either parallel or coincident. If the lines are coincident the ratio of their corresponding coefficients will be a constant
and the conditions
are sufficient to insure the lines are coincident.
Example: Find the intersection point of the two lines whose equations are 2x-3y+7=0 and 3x+7y-2=0.
Solution: The Descarta2D function Point2D[line,line] constructs the intersection point of the two lines.
p12=Point2D[l1=Line2D[2,-3,7],l2=Line2D[3,7,-2]]
Sketch2D[{l1,l2,p12}]
■
Point Projected Onto a Line [Top]
A point
is said to be projected onto a point
on a line
, if the line
is perpendicular to
. To determine the coordinates of a point projected onto a line, we can build upon concepts and formulas already established. We construct a line through the point, perpendicular to the given line. This line is then intersected with the given line which yields the desired projected point. Using Descarta2D, the sequence of commands to project point
onto the line
is as follows:
Clear[x1,y1,A2,B2,C2];
p1=Point2D[{x1,y1}];
l2=Line2D[A2,B2,C2];
l1=Line2D[p1,l2,Perpendicular2D];
p2=Point2D[l1,l2] //Simplify
In standard mathematical notation the coordinates of the projected point
are
The coordinates of the projected point can also be written in a somewhat more intuitive form given by
where
Simple algebra confirms that the two forms are equivalent. If the point
is on the line, then it is clear from the second form that the projected point
has coordinates
since d, which is the signed distance from the point to the line, is equal to zero when
is on
. As shown in the next example, Descarta2D provides a specific function that projects a point onto a line.
Example: Project the point (-3,2) onto the line 5x-3y+4=0.
Solution: The Descarta2D function Point2D[point,line] projects a point onto a line and returns the projected point.
p2=Point2D[p1=Point2D[{-3,2}],l2=Line2D[5,-3,4]]
Sketch2D[{p1,p2,l2},PlotRange->{{-4,1},{-1,4}}]
■
Line Perpendicular to Line Segment [Top]
Given a line segment bounded by the points
and
, we wish to find the line that is the perpendicular bisector of the line segment. Using Descarta2D we merely construct the line perpendicular to the line segment through its midpoint.
Clear[x0,y0,x1,y1];
ls=Segment2D[{x0,y0},{x1,y1}];
Line2D[Point2D[ls],Line2D[ls],Perpendicular2D] //Simplify
In standard mathematical notation the equation of the line is
In determinant form the equation is given by
Example: Find the line that is the perpendicular bisector of the line segment bounded by the points (-3,-1) and (5,3).
Solution: The function Line2D[lnseg,Perpendicular2D] constructs the perpendicular bisector of the line segment.
ls1=Segment2D[{-3,-1},{5,3}];
l1=Line2D[ls1,Perpendicular2D]
Sketch2D[{ls1,l1,Point2D[{-3,-1}],Point2D[{5,3}]}]
■
Descarta2D Hint: In the previous example, the resulting line 16x+8y-24=0, can be expressed in a simpler form by dividing the coefficients by 8, resulting in the equation 2x+y-3=0. The Mathematica function Simplify[expr] (or expr //Simplify) can be used to simplify the result of any Descarta2D computation. Be aware, however, that the computation may take a significant amount of time to complete and, sometimes, no simpler expression is found. The Descarta2D Line2D object has a special Simplify function that removes common factors from the coefficients of a line.
Line2D[16,8,-24] //Simplify
■
Angle Bisector Lines [Top]
The angle bisectors of two lines
and
are defined by the locus of points equidistant from the two lines. If P(x,y) is an arbitrary point on the angle bisectors, then using the distance formula for both lines yields
Equating the two yields the equation of the angle bisectors given by
Example: Find and plot the angle bisector lines of the lines x-3y+2=0 and x+4y-2=0.
Solution: The Descarta2D function MedialLoci2D[{line,line}] returns a list of two lines that are the angle bisectors of the two given lines.
l12=MedialLoci2D[{l1=Line2D[1,-3,2],l2=Line2D[1,4,-2]}]
Sketch2D[{l1,l2,l12}]
■
Concurrent Lines [Top]
Three lines that intersect in a single, common point are called concurrent lines. Using Mathematica we will prove that three lines
.
![]()
.
.
![]()
.
.
![]()
.
will be concurrent when the determinant of their coefficients is zero. The determinant equation is given by
We create four points,
,
,
and
, where
will be the common point of the three lines
,
and
.
Clear[x0,y0,x1,y1,x2,y2,x3,y3];
p0=Point2D[{x0,y0}];
p1=Point2D[{x1,y1}];
p2=Point2D[{x2,y2}];
p3=Point2D[{x3,y3}];
{l1,l2,l3}=Map[Line2D[p0,#]&,{p1,p2,p3}]
We now extract the coefficients of the lines and apply the postulated determinant.
{A1,B1,C1}=List @@ l1;
{A2,B2,C2}=List @@ l2;
{A3,B3,C3}=List @@ l3;
Det[{{A1,B1,C1},
{A2,B2,C2},
{A3,B3,C3}}] //Simplify
The condition defined by the determinant is therefore necessary; it is also sufficient provided the slopes of the lines are distinct.
Mathematica Hint: The Mathematica function Apply[f,expr] (or f @@ expr) replaces the head of expr by f. In the Mathematica statements above, the Apply function is used to convert a Line2D object into a list of coefficients.
Example: Verify that the three lines given by x-y+6=0, 2x+y-5=0 and -x-2y+11=0 are concurrent.
Solution: The function IsConcurrent2D[line,line,line] returns True if the three lines are concurrent; otherwise, it returns False.
IsConcurrent2D[l1=Line2D[1,-1,6],
l2=Line2D[2,1,-5],
l3=Line2D[-1,-2,11]]
Sketch2D[{l1,l2,l3},CurveLength2D->12]
■
Pencils of Lines [Top]
Pencil of Intersecting Lines
Let
and
be the equations of two lines in the plane. Consider the equation
, where k is an arbitrary constant. L is clearly an equation of the first-degree as it can be written
Assume that
and
intersect in some point P(x,y); then, by definition,
and
, since P is on both lines. Furthermore, L now represents a family, or system, of lines passing through P. Such a family of lines is called a pencil of lines. The variable k can be set to a value in a manner that produces a line in the pencil that will satisfy one additional condition. This is a useful technique for solving certain types of geometric problems as demonstrated in the next example.
Example: Find the family (pencil) of lines that pass through the intersection point of x-2y+4=0 and 2x+3y-2=0. Find the value of k and the associated member of the family that passes through the point (4,2).
Solution: Line2D[line,line,k,Pencil2D] constructs a line representing the pencil of lines
. Equation2D[line,coords] returns a Mathematica equation that establishes the condition of the point being on the line.
Clear[k];
L3=Line2D[L1=Line2D[1,-2,4],
L2=Line2D[2,3,-2],k,Pencil2D]
pt=Point2D[{4,2}];
eqn=Equation2D[L3,Coordinates2D[pt]]
ans=Solve[eqn]
Sketch2D[{L1,L2,(L3 /. ans[[1]]),pt}]
■
Pencil of Lines Through a Point
Pencil of lines through a point.
Consider the equation of a line L passing through points
and P(x,y) as shown in Figure [lns:fig30]. L is parameterized by the angle θ and the coordinates of P are given by
The equation of the line as determined by the two-point form is given by
Clearly, the point
is on L as the coordinates of
satisfy the equation of L. Also, since the slope m of L is given by
we can create a line with any given slope. A vertical line, whose slope is infinite, can be represented using θ=π/2. A complete pencil of lines, therefore, can be created for values 0≤θ<π.
Example: Find the parametric equation of a pencil of lines passing through the point (2,3).
Solution: The function Line2D[point,θ,Pencil2D] constructs a line parameterized by angle θ and passing through the given point.
Clear[t];
l1=Line2D[Point2D[{2,3}],t,Pencil2D]
The following commands plot several members of this pencil of lines.
Sketch2D[Map[(l1 /. t->#)&,Pi*Range[0,10]/10]]
■
A simpler parameterization involves applying the point-slope form of a line and using the slope, m, as the parameter of the pencil. This approach yields the parameterized pencil of lines
This parameterization, however, cannot represent vertical lines.
Parametric Equations [Top]
We wish to formulate parametric equations for the line
. Since there are an infinite number of valid parameterizations, we will specify that we desire a particular parameterization with the properties that the point nearest the origin will be at parameter value t=0, and the other points on the line will be parameterized by distance along the line. For example, the parameters t=±2 will generate the pair of points at a distance two from the point on the line nearest the origin.
Using Descarta2D we can determine the point
on
nearest the origin by projecting the origin onto
.
Clear[A1,B1,C1];
p0=Point2D[Point2D[{0,0}],Line2D[A1,B1,C1]]
Now consider a right triangle with sides at and bt as shown in Figure [lns:fig26]. In this triangle
and
). The hypotenuse of this triangle is obviously of length t since
Also the slope is given by
which is the slope of the desired line,
. Therefore, the parametric equations of the line are
x
=

y
=

Parametric equation of a line.
Example: Find the coordinates of the points on the line x-2y+3=0 for parameter values t=-2,-1,0,1,2. Plot the lines and the points.
Solution: The Descarta2D function Line2D[A,B,C][t] returns the coordinates of the point at parameter value t on the line.
l1=Line2D[1,-2,3];
coords=Map[l1[#]&,{-2,-1,0,1,2}] //N
Sketch2D[{l1,Map[Point2D[#]&,coords]}]
■
Mathematica Hint: The Mathematica function Map[f,expr] (or f /@ expr) applies to f to each element on the first level in expr. In the previous example Map is used to evaluate a line using a list of parameter values.
Line Segment
We wish to define the parametric equations for a line segment such that the parameter value t=0 produces the coordinates of the start point
, t=1 produces the coordinates of the end point
, and values 0<t<1 produce coordinates of points proportionally spaced in between
and
. Let d be the distance from
to a general point P(x,y) on the directed line
. We use Descarta2D to produce the formulas for the coordinates of P:
Clear[x1,y1,x2,y2,d];
pt=Point2D[Point2D[{x1,y1}],Point2D[{x2,y2}],d]
Let t=d/D where
is the distance from
to
. Solving for d=tD and substituting d into the Mathematica output above yields the parametric equations
x
=
![]()
y
=
![]()
Example: Find the coordinates of the points at parameter values 0, 1/2 and 1 on the line segment whose start and end points are (-2,1) and (1,0), respectively. To what point does the parameter value t=-1 correspond? Plot the objects.
Solution: The function Segment2D[{x
,y
},{x
,y
}][t] returns the coordinates of the point on a line segment at parameter value t.
l1=Segment2D[{-2,1},{1,0}];
coords=Map[l1[#]&,{-1,0,1/2,1}]
Sketch2D[{l1,Map[Point2D,coords]}]
The point at parameter value t=-1 is on the line connecting points
and
, at the same distance from
as
, but in the opposite direction.
■
Explorations [Top]
Distance between Parallel Lines. [lnsdst.html]
Demonstrate that the distance, d, between two parallel lines
and
is given by
Intersection of Lines in Intercept Form. [intrsct.html]
Show that the point of intersection of the lines
is
Equations of Perpendicular Lines. [lnsperp.html]
Show that the pair of lines ax+by+c=0 and bx-ay+c'=0 are perpendicular. Show that the pair
is also perpendicular.
Vertical/Horizontal Distance to a Line. [lndist.html]
Show that the vertical distance,
, from a point
to a line whose equation is Ax+By+C=0 is given by
and the horizontal distance,
, is given by
Line General Equation Determinant. [lndet.html]
Show that the general equation of a line Ax+By+C=0 is coincident with the line
given in determinant form.