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, "lns_1.gif" and "lns_2.gif". 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}]}]

"lns_3.gif"

Example: Determine which of the points (-1,1), "lns_4.gif", (3,1) and "lns_5.gif" 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]}

"lns_6.gif"

{Sketch2D[{l1,p1,p3}],Sketch2D[{l1,p2,p4}]}

"lns_7.gif"

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 "lns_8.gif" is given by

"lns_9.gif"

The formula is independent of the position and order of the two points involved.

"lns_10.gif"

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

"lns_11.gif"

and the angle of inclination, "lns_12.gif".

The slope of the line containing a line segment from point "lns_13.gif" to point "lns_14.gif" can be determined directly from the formula given for lines as

"lns_15.gif"

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}]]}

"lns_16.gif"

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 "lns_17.gif" and "lns_18.gif" be the slopes of two perpendicular lines. Since

"lns_19.gif" = "lns_20.gif"
"lns_21.gif" = "lns_22.gif"
"lns_23.gif" = "lns_24.gif"
. = "lns_25.gif"
. = "lns_26.gif"

Therefore, the slopes of two perpendicular lines are negative reciprocals of each other related by the equation, "lns_27.gif". 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]}}

"lns_28.gif"

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}]}

"lns_29.gif"

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, "lns_30.gif" and "lns_31.gif", let "lns_32.gif" be the angle between the lines measured counter-clockwise from "lns_33.gif" to "lns_34.gif". Since "lns_35.gif", it follows that

"lns_36.gif"

which, in terms of slopes of the lines, yields

"lns_37.gif"

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

"lns_38.gif"

The result, 1.10715 radians, is approximately "lns_39.gif".

Sketch2D[{l1,l2}]

"lns_40.gif"

Angle2D[l2,l1] //N

"lns_41.gif"

The angle between the lines taken in the opposite order is 2.0344 radians (approximately "lns_42.gif") which is the supplement of the first angle ("lns_43.gif").

Two-Point Form [Top]

"lns_44.gif"

Two-point form of a line.

A line is determined by two distinct points on it, "lns_45.gif" and "lns_46.gif". Let P(x,y) be any other point on the line as illustrated in Figure [lns:fig8]. Then by similar triangles

"lns_47.gif"

which is called the two-point form of a line. The two-point form may also be written as

"lns_48.gif"

In general form the line is given by

"lns_49.gif"

In determinant form the equation is given by

"lns_50.gif"

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]]}

"lns_51.gif"

Sketch2D[{l1,p1,p2}]

"lns_52.gif"

The Descarta2D function Line2D[{"lns_53.gif","lns_54.gif"},{"lns_55.gif","lns_56.gif"}] is also provided to allow construction of a line by specifying two point coordinates.

Line2D[{-2,-1},{3,2}]

"lns_57.gif"

Collinear Points

In a previous chapter it was demonstrated that the three points "lns_58.gif", "lns_59.gif" and "lns_60.gif" are collinear if their coordinates satisfy the determinant equation

"lns_61.gif"

This condition may be stated in a more intuitive form using the two-point form of a line. The line defined by "lns_62.gif" and "lns_63.gif" must be satisfied by "lns_64.gif" yielding the condition

"lns_65.gif"

which can be put into the more symmetrical form

"lns_66.gif"

Point-Slope Form [Top]

Since "lns_67.gif", the two-point form of a line can be reduced to the point-slope form

"lns_68.gif"

as shown in Figure [lns:fig11]. In general form the equation of the line is

"lns_69.gif"

A vertical line cannot be represented in point-slope form. In determinant form the point-slope form is given by

"lns_70.gif"

"lns_71.gif"

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]

"lns_72.gif"

Sketch2D[{p1,l1}]

"lns_73.gif"

Line Through a Point Parallel to a Line

A line through a given point "lns_74.gif" parallel to a given line

"lns_75.gif"

would have a slope "lns_76.gif", and using "lns_77.gif" yields

"lns_78.gif"

The equation can also be written

"lns_79.gif"

In determinant form the equation is

"lns_80.gif"

Line Through a Point Perpendicular to a Line

A line through a given point "lns_81.gif" perpendicular to a given line

"lns_82.gif"

would have a slope "lns_83.gif", and using "lns_84.gif" yields

"lns_85.gif"

or, in a simpler form,

"lns_86.gif"

In determinant form the equation is

"lns_87.gif"

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]}

"lns_88.gif"

Sketch2D[{p1,l1,l2,l3}]

"lns_89.gif"

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]

"lns_90.gif"

Horizontal and Vertical Lines Through a Point

Given a point "lns_91.gif", a horizontal line whose slope is 0 will have the equation "lns_92.gif". In determinant form the equation is

"lns_93.gif"

Similarly, a vertical line (whose slope is infinite) has the equation "lns_94.gif" and its determinant equation is

"lns_95.gif"

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]}

"lns_96.gif"

Sketch2D[{p1,l1,l2}]

"lns_97.gif"

Slope-Intercept Form [Top]

Specializing the point "lns_98.gif" 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

"lns_99.gif"

"lns_100.gif"

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]

"lns_101.gif"

Sketch2D[{p1,l1},PlotRange->{{-3,3},{-3,3}}]

"lns_102.gif"

Descarta2D Hint: The Sketch2D command option

PlotRange->{{"lns_103.gif","lns_104.gif"},{"lns_105.gif","lns_106.gif"}}

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]

"lns_107.gif"

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

"lns_108.gif"

In general form the equation of the line is bx+ay-ab=0; or, dividing Ax+By+C=0 by C (C≠0) gives

"lns_109.gif"

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

"lns_110.gif"

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]

"lns_111.gif"

Sketch2D[{p1,p2,l12}]

"lns_112.gif"

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.

"lns_113.gif"

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 "lns_114.gif" yielding

"lns_115.gif"

The sign of "lns_116.gif" 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 "lns_117.gif" 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]]}

"lns_118.gif"

Example: Find the line 4 units from the origin whose normal makes an angle of "lns_119.gif" 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

"lns_120.gif"

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 "lns_121.gif" we wish to offset the point a distance d in the direction of a given line "lns_122.gif". We note that the coefficients of the normalized form of "lns_123.gif" immediately give us the unit directions to offset "lns_124.gif", so the desired coordinates of the offset point are

"lns_125.gif"

If the point "lns_126.gif" is on line "lns_127.gif", then the offset point will also be on "lns_128.gif"; otherwise, the offset point will be on a line parallel to "lns_129.gif". 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]}}

"lns_130.gif"

Sketch2D[{p1,p2,p3,l1,pts}]

"lns_131.gif"

Line Offset a Distance from a Line

If a line "lns_132.gif" is parallel to a second line "lns_133.gif", the two lines will be separated by a constant distance, d. The process of constructing a line such as "lns_134.gif" which is parallel to "lns_135.gif" 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

"lns_136.gif"

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]}

"lns_137.gif"

Sketch2D[{l1,l2,l3}]

"lns_138.gif"

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 "lns_139.gif". A line M offset a distance d from L clearly has the equation M≡px+qy-r±d=0. Any point "lns_140.gif" on M satisfies the equation of M, therefore, "lns_141.gif". Solving for d and squaring to remove the ambiguous sign yields

"lns_142.gif"

Thus, the distance d from a point "lns_143.gif" to a line Ax+By+C=0 in general form is

"lns_144.gif"

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]]

"lns_145.gif"

Intersection Point of Two Lines [Top]

Two lines "lns_146.gif" and "lns_147.gif" 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

. "lns_148.gif" .
. "lns_149.gif" .

for the intersection point P(x,y). The resulting formula for the coordinates of point P is

"lns_150.gif"

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

"lns_151.gif"

and the conditions

"lns_152.gif"

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]]

"lns_153.gif"

Sketch2D[{l1,l2,p12}]

"lns_154.gif"

Point Projected Onto a Line [Top]

A point "lns_155.gif" is said to be projected onto a point "lns_156.gif" on a line "lns_157.gif", if the line "lns_158.gif" is perpendicular to "lns_159.gif". 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 "lns_160.gif" onto the line "lns_161.gif" 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

"lns_162.gif"

In standard mathematical notation the coordinates of the projected point "lns_163.gif" are

"lns_164.gif"

The coordinates of the projected point can also be written in a somewhat more intuitive form given by

"lns_165.gif"

where

"lns_166.gif"

Simple algebra confirms that the two forms are equivalent. If the point "lns_167.gif" is on the line, then it is clear from the second form that the projected point "lns_168.gif" has coordinates "lns_169.gif" since d, which is the signed distance from the point to the line, is equal to zero when "lns_170.gif" is on "lns_171.gif". 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]]

"lns_172.gif"

Sketch2D[{p1,p2,l2},PlotRange->{{-4,1},{-1,4}}]

"lns_173.gif"

Line Perpendicular to Line Segment [Top]

Given a line segment bounded by the points "lns_174.gif" and "lns_175.gif", 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

"lns_176.gif"

In standard mathematical notation the equation of the line is

"lns_177.gif"

In determinant form the equation is given by

"lns_178.gif"

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]

"lns_179.gif"

Sketch2D[{ls1,l1,Point2D[{-3,-1}],Point2D[{5,3}]}]

"lns_180.gif"

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

"lns_181.gif"

Angle Bisector Lines [Top]

The angle bisectors of two lines "lns_182.gif" and "lns_183.gif" 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

"lns_184.gif"

Equating the two yields the equation of the angle bisectors given by

"lns_185.gif"

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]}]

"lns_186.gif"

Sketch2D[{l1,l2,l12}]

"lns_187.gif"

Concurrent Lines [Top]

Three lines that intersect in a single, common point are called concurrent lines. Using Mathematica we will prove that three lines

. "lns_188.gif" .
. "lns_189.gif" .
. "lns_190.gif" .

will be concurrent when the determinant of their coefficients is zero. The determinant equation is given by

"lns_191.gif"

We create four points, "lns_192.gif", "lns_193.gif", "lns_194.gif" and "lns_195.gif", where "lns_196.gif" will be the common point of the three lines "lns_197.gif", "lns_198.gif" and "lns_199.gif".

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}]

"lns_200.gif"

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

"lns_201.gif"

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]]

"lns_202.gif"

Sketch2D[{l1,l2,l3},CurveLength2D->12]

"lns_203.gif"

Pencils of Lines [Top]

Pencil of Intersecting Lines

Let "lns_204.gif" and "lns_205.gif" be the equations of two lines in the plane. Consider the equation "lns_206.gif", where k is an arbitrary constant. L is clearly an equation of the first-degree as it can be written

"lns_207.gif"

Assume that "lns_208.gif" and "lns_209.gif" intersect in some point P(x,y); then, by definition, "lns_210.gif" and "lns_211.gif", 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 "lns_212.gif". 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]

"lns_213.gif"

pt=Point2D[{4,2}];
eqn=Equation2D[L3,Coordinates2D[pt]]

"lns_214.gif"

ans=Solve[eqn]

"lns_215.gif"

Sketch2D[{L1,L2,(L3 /. ans[[1]]),pt}]

"lns_216.gif"

Pencil of Lines Through a Point

"lns_217.gif"

Pencil of lines through a point.

Consider the equation of a line L passing through points "lns_218.gif" and P(x,y) as shown in Figure [lns:fig30]. L is parameterized by the angle θ and the coordinates of P are given by

"lns_219.gif"

The equation of the line as determined by the two-point form is given by

"lns_220.gif"

Clearly, the point "lns_221.gif" is on L as the coordinates of "lns_222.gif" satisfy the equation of L. Also, since the slope m of L is given by

"lns_223.gif"

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]

"lns_224.gif"

The following commands plot several members of this pencil of lines.

Sketch2D[Map[(l1 /. t->#)&,Pi*Range[0,10]/10]]

"lns_225.gif"

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

"lns_226.gif"

This parameterization, however, cannot represent vertical lines.

Parametric Equations [Top]

We wish to formulate parametric equations for the line "lns_227.gif". 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 "lns_228.gif" on "lns_229.gif" nearest the origin by projecting the origin onto "lns_230.gif".

Clear[A1,B1,C1];
p0=Point2D[Point2D[{0,0}],Line2D[A1,B1,C1]]

"lns_231.gif"

Now consider a right triangle with sides at and bt as shown in Figure [lns:fig26]. In this triangle "lns_232.gif" and "lns_233.gif"). The hypotenuse of this triangle is obviously of length t since

"lns_234.gif"

Also the slope is given by

"lns_235.gif"

which is the slope of the desired line, "lns_236.gif". Therefore, the parametric equations of the line are

x = "lns_237.gif"
y = "lns_238.gif"

"lns_239.gif"

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

"lns_240.gif"

Sketch2D[{l1,Map[Point2D[#]&,coords]}]

"lns_241.gif"

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 "lns_242.gif", t=1 produces the coordinates of the end point "lns_243.gif", and values 0<t<1 produce coordinates of points proportionally spaced in between "lns_244.gif" and "lns_245.gif". Let d be the distance from "lns_246.gif" to a general point P(x,y) on the directed line "lns_247.gif". 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]

"lns_248.gif"

Let t=d/D where "lns_249.gif" is the distance from "lns_250.gif" to "lns_251.gif". Solving for d=tD and substituting d into the Mathematica output above yields the parametric equations

x = "lns_252.gif"
y = "lns_253.gif"

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"lns_254.gif",y"lns_255.gif"},{x"lns_256.gif",y"lns_257.gif"}][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}]

"lns_258.gif"

Sketch2D[{l1,Map[Point2D,coords]}]

"lns_259.gif"

The point at parameter value t=-1 is on the line connecting points "lns_260.gif" and "lns_261.gif", at the same distance from "lns_262.gif" as "lns_263.gif", but in the opposite direction.

Explorations [Top]

Distance between Parallel Lines. [lnsdst.html]

Demonstrate that the distance, d, between two parallel lines

"lns_264.gif" and "lns_265.gif"

is given by

"lns_266.gif"

Intersection of Lines in Intercept Form. [intrsct.html]

Show that the point of intersection of the lines

"lns_267.gif"

is

"lns_268.gif"

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

"lns_269.gif"

is also perpendicular.

Vertical/Horizontal Distance to a Line. [lndist.html]

Show that the vertical distance, "lns_270.gif", from a point "lns_271.gif" to a line whose equation is Ax+By+C=0 is given by

"lns_272.gif"

and the horizontal distance, "lns_273.gif", is given by

"lns_274.gif"

Line General Equation Determinant. [lndet.html]

Show that the general equation of a line Ax+By+C=0 is coincident with the line

"lns_275.gif"

given in determinant form.

Line Segment Cut by Two Lines. [lnlndist.html]

Let "lns_276.gif" and "lns_277.gif" be two intersecting lines and "lns_278.gif" a point. Describe a procedure for finding the lines through "lns_279.gif" such that "lns_280.gif" and "lns_281.gif" cut off a line segment of length S>0. Implement the solution as a numerical Mathematica function.

Intersection Point of Two Line Segments. [lnsegpt.html]

Show that the intersection point of the lines underlying two line segments "lns_282.gif" and "lns_283.gif" in terms of the coordinates of the four points is given by

x = "lns_284.gif"
y = "lns_285.gif"

Intersection Parameters of Two Line Segments. [lnsegint.html]

Show that the parameter values, "lns_286.gif" and "lns_287.gif", of the intersection point of two line segments in terms of the end point coordinates is given by

"lns_288.gif" = "lns_289.gif"
"lns_290.gif" = "lns_291.gif"

where

"lns_292.gif"

What is the significance of the values of "lns_293.gif" and "lns_294.gif" with respect to the standard parameter range for a line segment?


Copyright © 1999-2007 Donald L. Vossler, Descarta2D Publishing
www.Descarta2D.com